We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
RenderAndReload()
minimum
maximum
RenderAndReload() errors out if spec has negative floating point numbers for minimum or maximum
{ "openapi": "3.0.0", "info": { "title": "dummy", "version": "1.0.0" }, "paths": { "/dummy": { "post": { "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "value": { "type": "number", "format": "decimal", "multipleOf": 0.01, "minimum": -999.99 } } } } } }, "responses": { "200": { "description": "OK" } } } } } }
package main import ( "fmt" "github.com/pb33f/libopenapi" ) const openAPISpec = `{"openapi":"3.0.0","info":{"title":"dummy","version":"1.0.0"},"paths":{"/dummy":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"value":{"type":"number","format":"decimal","multipleOf":0.01,"minimum":-999.99}}}}}},"responses":{"200":{"description":"OK"}}}}}}` func main() { document, err := libopenapi.NewDocument([]byte(openAPISpec)) if err != nil { panic(err) } _, errList := document.BuildV3Model() if len(errList) > 0 { fmt.Println(errList) panic("error encountered while building the model") } _, _, _, errList = document.RenderAndReload() if len(errList) > 0 { fmt.Println(errList) panic("error encountered while rendering the model") } }
RenderAndReload() errors with [yaml: cannot decode !!float -999.99 as a !!int]
[yaml: cannot decode !!float -999.99 as a !!int]
Since minimum and maximum are defined as numbers , negative values should be valid
https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.4 https://datatracker.ietf.org/doc/html/rfc7159#section-6
The text was updated successfully, but these errors were encountered:
I have also tried to fix the issue PR: #377
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Issue details
RenderAndReload()
errors out if spec has negative floating point numbers forminimum
ormaximum
Steps to reproduce
Spec
Sample go program
Current behaviour
RenderAndReload()
errors with[yaml: cannot decode !!float -999.99 as a !!int]
Expected behaviour
Since
minimum
andmaximum
are defined as numbers , negative values should be validPossible cause:
Reference
https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-5.4
https://datatracker.ietf.org/doc/html/rfc7159#section-6
The text was updated successfully, but these errors were encountered: