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

fix: openapi edge case for empty payloads #1383

Closed

Conversation

acdn-tsmith
Copy link

@acdn-tsmith acdn-tsmith commented Apr 25, 2024

Motivation and Context

The generated wundergraph.openapi.json specification doesn't currently handle mutations that have no input. The requestBody shouldn't be required per the OpenAPI 3.1.0 docs, but the openapibuilder code currently assumes that we always have an input.

Now, for mutations that have no input, instead of of a payload that shows as an empty object...
Screenshot 2024-04-25 at 12 35 19 PM
We have a payload that just shows as empty and non-required:
Screenshot 2024-04-25 at 12 35 25 PM

This will correct the generated spec for the small subset mutation operations that don't consume an input.

Marketing Changelog

OpenAPI Generated Spec now formats POST's with empty payloads correctly

Checklist

Copy link

vercel bot commented Apr 25, 2024

@acdn-tsmith is attempting to deploy a commit to the WunderGraph Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Apr 25, 2024

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
wundergraph-docs-v3 ⬜️ Ignored (Inspect) Visit Preview Apr 25, 2024 4:58pm

@@ -211,6 +211,8 @@ describe('OpenAPI builder', () => {
PathName: 'MutationPath',
OperationType: OperationType.MUTATION,
AuthenticationConfig: { required: true },
VariablesSchema: personSchema,
Copy link
Author

Choose a reason for hiding this comment

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

While running the tests, I noticed that this annotate operations test will throw an error in the changed mutateOperations function due to not having a VariablesSchema. Adding a dummy VariablesSchema and ResponseSchema now.

Copy link

stale bot commented May 15, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale label May 15, 2024
@stale stale bot closed this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant