Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added filename extension support for more x-codeSamples languages #1382

Merged
merged 5 commits into from
Jan 5, 2024

Conversation

shahednasser
Copy link
Contributor

What/Why/How?

The documentation for x-codeSamples mentions that lang names are supported based on this list. However, when it comes to writing the examples in their own files, the langToExt utility function only supports a subset of languages.

So, for example, if I use the lang TypeScript, the language isn't checked for in the langToExt function, which results in the file being names getundefined, as the extension file name is undefined.

This PR adds support for all the languages mentioned by the languages list, and additionally adds support for tsx language. As part of our project, we needed the support for it.

Reference

Testing

Screenshots (optional)

Check yourself

  • Code is linted
  • Tested with redoc/reference-docs/workflows (internal)
  • All new/updated code is covered with tests

Security

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

@shahednasser shahednasser requested a review from a team as a code owner January 5, 2024 08:26
Copy link

changeset-bot bot commented Jan 5, 2024

🦋 Changeset detected

Latest commit: f83f49e

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

This PR includes changesets to release 2 packages
Name Type
@redocly/cli Patch
@redocly/openapi-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

Copy link
Contributor

@tatomyr tatomyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing! Left a few comments. Also please make sure to update the appropriate test case.

.changeset/cold-moles-cover.md Outdated Show resolved Hide resolved
packages/cli/src/utils.ts Outdated Show resolved Hide resolved
@shahednasser
Copy link
Contributor Author

Also please make sure to update the appropriate test case.

I've made changes to the test at packages/cli/src/__tests__/utils.test.ts.

Copy link
Contributor

@tatomyr tatomyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you again!

@tatomyr tatomyr merged commit 147ef98 into Redocly:main Jan 5, 2024
26 checks passed
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.

2 participants