Skip to content

Conversation

@erunion
Copy link
Member

@erunion erunion commented Oct 18, 2023

🚥 Resolves RM-3674

🧰 Changes

  • Updates snippet generation for v7 compatibility where we no longer have the dynamic require('api')('...') accessor.
  • Adds support for supplying snippets a custom variable (folks apparently don't like us assigning the retrieved SDK to sdk).
  • Changes the snippet syntax from require over to import because 2023, and also codegen now supports CJS and ESM.

@erunion erunion added enhancement New feature or request area:snippets Issues related to code snippets labels Oct 18, 2023
@erunion erunion marked this pull request as ready for review October 18, 2023 18:06
* @note This function also exists in `api/fetcher`.
*/
function getProjectPrefixFromRegistryUUID(uri: string) {
const matches = uri.match(registryUUIDRegex);

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data

This [regular expression](1) that depends on [library input](2) may run slow on strings starting with '@-' and with many repetitions of '--'.
@erunion erunion requested a review from kanadgupta October 18, 2023 18:23
Copy link
Contributor

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

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

i don't see any changes related to this installation step:

CleanShot 2023-10-18 at 13 55 11@2x

does that happen in another repo?

@erunion
Copy link
Member Author

erunion commented Oct 18, 2023

@kanadgupta Yeah that's part of @readme/oas-to-snipppet. https://github.com/readmeio/oas-to-snippet/blob/main/src/supportedLanguages.ts#L149

I still need to update that library to support dual exports and will update the install step then.

@erunion erunion merged commit a7daafc into main Oct 18, 2023
@erunion erunion deleted the feat/update-snippets branch October 18, 2023 18:58
@erunion erunion added this to the v7 milestone Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:snippets Issues related to code snippets enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants