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

improvement: create a snippet resolver that caches the api definition… #1232

Closed
wants to merge 4 commits into from

Conversation

armandobelardo
Copy link
Contributor

… across

Short description of the changes made

This PR introduces a definition holder wrapping the snippet template resolver, allowing us to only request the api definition once per-api definition ID

Essentially just:

  • construct SnippetTemplateResolutionHolder with a definition or definition ID
  • call resolve as you would have instantiated a SnippetTemplateResolver before

ex:

const holder = new SnippetTemplateResolutionHolder({ maybeApiDefinitionId: 1 });
const snippet = await holder.resolve({ payload, endpointSnippetTemplate });

// If you still want the template resolver object, you can get that as well

const resolver = await holder.getTemplateResolver({ payload, endpointSnippetTemplate });

What was the motivation & context behind this PR?

Limit calls to FDR for getting the API definition, necessary to resolve Union templates

Copy link

vercel bot commented Aug 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fern-dashboard-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 1, 2024 6:30pm
fern-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 1, 2024 6:30pm
fern-prod ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 1, 2024 6:30pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
fern-dashboard ⬜️ Ignored (Inspect) Aug 1, 2024 6:30pm
fontawesome-cdn ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 6:30pm
private-docs ⬜️ Ignored (Inspect) Aug 1, 2024 6:30pm

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.

1 participant