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

application/merge-patch+json is not supported #16

Closed
daniel-eichinger-bl opened this issue May 3, 2024 · 2 comments
Closed

application/merge-patch+json is not supported #16

daniel-eichinger-bl opened this issue May 3, 2024 · 2 comments

Comments

@daniel-eichinger-bl
Copy link

I'm unable to use oapi-codegen/nethttp-middleware for application/merge-patch+json Content-Types.
I generated a strict server using: https://github.com/deepmap/oapi-codegen and used your middleware to validate requests.

The request cannot be validated as https://github.com/oapi-codegen/nethttp-middleware/blob/main/oapi_validate.go#L91 returns an error as the https://github.com/getkin/kin-openapi does not provide a decoder for application/merge-patch+json.

The maintainers of getkin-openapi made the JSON body decode public (getkin/kin-openapi#896) so it should be possible to register new media types.

@kogxi
Copy link

kogxi commented Jun 3, 2024

Since openapi3filter.RegisterBodyDecoder is exported you should be able to workaround this issue by registering the openapi3filter.JSONBodyDecoder in your code. E.g., openapi3filter.RegisterBodyDecoder("application/merge-patch+json“, openapi3filter.JSONBodyDecoder).

@daniel-eichinger-bl
Copy link
Author

Closing therefore!

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

No branches or pull requests

2 participants