Skip to content

fix(join): correctly prefix discriminator mapping refs#2642

Merged
Daryna-del merged 4 commits intoRedocly:mainfrom
maxwellpeterson:fix/join-discriminator-prefix-1451
Mar 12, 2026
Merged

fix(join): correctly prefix discriminator mapping refs#2642
Daryna-del merged 4 commits intoRedocly:mainfrom
maxwellpeterson:fix/join-discriminator-prefix-1451

Conversation

@maxwellpeterson
Copy link
Copy Markdown
Contributor

What/Why/How?

join --prefix-components-with-info-prop can leave invalid discriminator mapping refs when a schema name contains the same substring as the prefix (#1451).
The join ref-rewrite logic used name.includes(componentsPrefix), which incorrectly treated names like CreateSomethingRequest as already prefixed when prefix is Something.
This change updates the discriminator mapping rewrite check to only skip refs that already start with the real prefix format (<prefix>_), and adds a regression unit test to cover this case.

Reference

Testing

  • Ran unit tests for join command:
    • npm run unit -- packages/cli/src/__tests__/commands/join.test.ts --coverage=false
  • Verified regression behavior explicitly:
    • test fails with old includes(...) logic
    • test passes with updated startsWith(prefix + '_') logic

Screenshots (optional)

N/A

Check yourself

  • Code changed? - Tested with Redoc/Realm/Reunite (internal)
  • All new/updated code is covered by tests
  • New package installed? - Tested in different environments (browser/node)
  • Documentation update considered

Security

  • The security impact of the change has been considered
  • Code follows company security practices and guidelines

@maxwellpeterson maxwellpeterson requested review from a team as code owners March 10, 2026 18:38
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 10, 2026

🦋 Changeset detected

Latest commit: 67ee74a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@redocly/cli Patch
@redocly/openapi-core Patch
@redocly/respect-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread .changeset/fuzzy-drinks-warn.md Outdated
@Daryna-del
Copy link
Copy Markdown
Contributor

Daryna-del commented Mar 11, 2026

Overall looks good to me!
Many thanks for the contribution, let's wait for the tech writer review

@maxwellpeterson
Copy link
Copy Markdown
Contributor Author

@Daryna-del Thanks for reviewing! It looks like one of the smoke tests failed to start after merging in main. Anything I can do to help with that? Would love to get this one in 🙂

@Daryna-del
Copy link
Copy Markdown
Contributor

@Daryna-del Thanks for reviewing! It looks like one of the smoke tests failed to start after merging in main. Anything I can do to help with that? Would love to get this one in 🙂

There could be some problems related to smoke test due to some external package updates. Could you please
follow those steps:

### Smoke tests

Smokes are for testing the CLI in different environments.

To run them locally, please follow the steps described in the smoke GitHub actions: [smoke-basic](.github/workflows/smoke.yaml), [smoke-plugins](.github/workflows/smoke-plugins.yaml), [smoke-rebilly](.github/workflows/smoke-rebilly.yaml).

To update smoke tests for the `build-docs` command (which sometimes fails due to external package updates), please follow the steps below:

```sh
# Build and install the current CLI build locally
npm run compile
npm run pack:prepare
npm i -g redocly-cli.tgz

# Re-build the docs
(cd tests/smoke/basic/ && redocly build-docs openapi.yaml -o pre-built/redoc.html)

You can find those steps in CONTRIBUTNG.md file

@Daryna-del Daryna-del merged commit 72ccf7d into Redocly:main Mar 12, 2026
37 checks passed
@Daryna-del
Copy link
Copy Markdown
Contributor

@maxwellpeterson Thanks for your contribution!
Smoke test fixed and those changes will be included in the new release.

@maxwellpeterson
Copy link
Copy Markdown
Contributor Author

@Daryna-del Thanks for releasing! We can close #1451 now too

@dimitropoulos
Copy link
Copy Markdown

just wanna say we recognize and really appreciate how quickly you got this released. thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants