-
Notifications
You must be signed in to change notification settings - Fork 389
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
Regression - OpenAPIGen breaks with String output examples #2789
Comments
If I add an explicit val endpoint = Endpoint(Method.GET / "simple/api/v1.0")
.outCodec[String](HttpCodec.content(MediaType.text.plain))
.examplesOut("a" -> "hello", "b" -> "world") |
I can only assume one default value for the MediaType. And that is Json. We support text plain and protobuf by default as well. But OpenAPI picks Json first. You have to support the explicit MediaType, if you want to only support that one type. |
That sounds sensible - but as you say - even if the MediaType is application/json those examples should be valid - and in fact they are handled without error up until the breaking commit. |
I have the same issue with a scala 3 enum return value. It worked before RC7, but now it causes a similar exception:
It looks like the example value gets wrapped in a |
I think it's this change that's causing the error: |
/bounty $75 |
💎 $75 bounty • ZIOSteps to solve:
Thank you for contributing to zio/zio-http! Add a bounty • Share on socials
|
It breaks my endpoint with an example, even if the output is JSON. The test fixtures are missing |
💡 @987Nabil submitted a pull request that claims the bounty. You can visit your bounty board to reward. |
🎉🎈 @987Nabil has been awarded $75! 🎈🎊 |
Describe the bug
A recent PR #2714 seems to have broken OpenAPIGen when providing output examples for simple String output.
To Reproduce
Expected behaviour
This seems to be a regression - it worked before and I would expect it to work.
Screenshots
![image](https://private-user-images.githubusercontent.com/356303/324262716-791c039f-394d-4d1b-821b-3825f6c254d7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUxMTU1MjcsIm5iZiI6MTcyNTExNTIyNywicGF0aCI6Ii8zNTYzMDMvMzI0MjYyNzE2LTc5MWMwMzlmLTM5NGQtNGQxYi04MjFiLTM4MjVmNmMyNTRkNy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODMxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgzMVQxNDQwMjdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02NDI5NDUzZDQ1MzA4ZTZkYzU2Mzg0YmZmNjk0M2FkOTY4MWFmMmJkNjkxMTQ5N2U2ZWE3ZTdjNzZiNTNkZjJlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.w_-iqBi3IrraMR5aHF0VbaRhFBLBRUThTlCzi7HYEa8)
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: