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

Stop auto-generation of mandatory query params and headers missing in example #1353

Merged
merged 6 commits into from
Oct 14, 2024

Conversation

yogeshnikam671
Copy link
Member

What:
Disable auto-generation of mandatory query param/header which is intentionally not specified in an example to emulate a negative scenario

Why:
If a user wants to specify an example where a mandatory query param is missing, currently specmatic auto-generates that mandatory query param even though it is not present in the example.
To fix this behaviour, this PR has been raised.

Checklist:

…ntionally not specified in an example to emulate a negative scenario
Copy link
Member

@joelrosario joelrosario left a comment

Choose a reason for hiding this comment

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

While Specmatic allows examples where mandatory query params or headers are missing for 400 status responses, there is no reason to permit an example (one that has omitted mandatory query params or headers) when it is not an example of a bad request.

This logic should therefore not apply to non 4xx statuses. It should only apply specifically to 4xx statuses.

@joelrosario joelrosario self-requested a review October 11, 2024 14:41
@yogeshnikam671
Copy link
Member Author

Hey @joelrosario, I've addressed the point raised by you. Please let me know your feedback on the same if any. Thanks.

@joelrosario joelrosario merged commit 912a497 into main Oct 14, 2024
2 checks passed
@joelrosario joelrosario deleted the auto_generated_query_param_bug_fix branch October 14, 2024 13:03
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