Skip to content

feat(httpsnippet-client-api): updates for v7 compatibility + custom variable support - #767

Merged
erunion merged 1 commit into
mainfrom
feat/update-snippets
Oct 18, 2023
Merged

feat(httpsnippet-client-api): updates for v7 compatibility + custom variable support#767
erunion merged 1 commit into
mainfrom
feat/update-snippets

Conversation

@erunion

@erunion erunion commented Oct 18, 2023

Copy link
Copy Markdown
Member
馃殽 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

@kanadgupta kanadgupta left a comment

Copy link
Copy Markdown
Contributor

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

erunion commented Oct 18, 2023

Copy link
Copy Markdown
Member Author

@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