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
Have scenario
_base.json
api.json
Got problem with parameters if they read from _base.json
{ "openapi": "3.1.0", "paths": { "/": { "get": { "parameters": [ { "name": "p", "schema": { "type": "string" }, "in": "query" } ] } } } }
var spec *openapi3.Spec if err = json.Unmarshal(errs.Must(os.ReadFile("./doc/api/_base.json")),&spec); err != nil { panic(err) }
j, err = json.MarshalIndent(spec, "", " ") if err != nil { panic(err) } fmt.Println(string(j))
will produce
{ "openapi": "3.1.0", "paths": { "/": { "get": { "parameters": [ { "name": "p", "schema": { "type": "string" }, "in": "query", "schema": { "type": "string" }, "in": "query" } ] } } } }
Parameter.SchemaXORContent
Parameter.Location
unionMarshal
SchemaXORContent is used during unmarshal as buffer, and then used back in marshalling but without any key control of unique in unionMarhal
For our case i have added
func ReadSpecForUpdate(data []byte) (*openapi3.Spec, error) { var spec *openapi3.Spec if err := json.Unmarshal(data,&spec); err != nil { return nil, err } for _, path := range spec.Paths.MapOfPathItemValues { for _, op := range path.MapOfOperationValues { for _, p := range op.Parameters { // todo - some information could be lost ??? p.Parameter.SchemaXORContent = nil p.Parameter.Location = nil } } } return spec, nil }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Have scenario
_base.json
as template of specapi.json
Got problem with parameters if they read from
_base.json
will produce
Parameter.SchemaXORContent
,Parameter.Location
andunionMarshal
SchemaXORContent is used during unmarshal as buffer, and then used back in marshalling but without any key control of
unique in unionMarhal
For our case i have added
unionMarshal
- prepare data to avoid twice - pre merge dataThe text was updated successfully, but these errors were encountered: