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: generate path params definition when missing #761

Merged
merged 10 commits into from
Oct 15, 2023

Conversation

msebastianb
Copy link
Contributor

Generate default param schema only if user doesn't specify a schema for param at all. If there is something, even with missing params, we should not modify it.

Suggested solution

  • Check for params in the normalized url and for missing params in schema
  • Generate a schema from the params found in the url
  • Resolve params to the destination format using the previously generated schema
  • Apply this behaviour to both specs

Closes #750

lib/util/generate-params-schema.js Outdated Show resolved Hide resolved
lib/util/generate-params-schema.js Outdated Show resolved Hide resolved
lib/util/match-params.js Show resolved Hide resolved
lib/spec/swagger/utils.js Outdated Show resolved Hide resolved
lib/spec/openapi/utils.js Outdated Show resolved Hide resolved
lib/spec/swagger/index.js Show resolved Hide resolved
lib/util/generate-params-schema.js Show resolved Hide resolved
lib/util/generate-params-schema.js Show resolved Hide resolved
Copy link
Member

@Eomm Eomm left a comment

Choose a reason for hiding this comment

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

  • Added few minor suggestions
  • We need documentation

lib/spec/openapi/utils.js Outdated Show resolved Hide resolved
lib/spec/swagger/utils.js Outdated Show resolved Hide resolved
lib/util/generate-params-schema.js Outdated Show resolved Hide resolved
lib/util/generate-params-schema.js Outdated Show resolved Hide resolved
lib/util/match-params.js Outdated Show resolved Hide resolved
@simoneb
Copy link

simoneb commented Oct 13, 2023

@Eomm , @msebastianb won't be able to keep working on this, can you take care of finishing it up?

@msebastianb msebastianb requested a review from Eomm October 14, 2023 21:24
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

This seems done to me. What's missing?

@Eomm Eomm merged commit a1963e5 into fastify:master Oct 15, 2023
15 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.

Automatically generate path params definition
5 participants