-
Notifications
You must be signed in to change notification settings - Fork 422
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
Non-integer numbers cause incorrect OpenApi YAML #207
Comments
@gbogard the temporary work-around is to provide non-whole example values, e.g. |
We'll do that for now, thanks ! |
My current workaround is using regex: def fixDecimalExamples(s: String): String =
s.replaceAll("!!int ('\\d*\\.\\d*')", "$1")
fixDecimalExamples(myEndpoint.toOpenAPI(info).toYaml) |
@guersam Thanks for the snippet! But you're treating floats as strings then. It'll respect the types: def swagger_fixIntToFloat(s: String): String =
s.replaceAll("!!int ('\\d*\\.\\d*')", "!!float $1") |
Isn't this issue gone with circe-yaml 0.12.0? |
yes, jsut tested, should be fixed, (latest is 0.12.4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a json Input has non-integer fields (double or float) and one provides an example for the input, those fields in the example get serialized as
!!int '<the value>'
when interpreting the endpoint as OpenAPI YAML.This is causing Swagger to refuse the documentation. (See screenshot)
Reproduction
The resulting YAML :
I believe the
!!int '45.0'
is causing the issues with Swagger. This issue on the Circe-yaml project must be closely related. Any idea how I can provide examples for such types ?The text was updated successfully, but these errors were encountered: