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
When a definition property changes from array type to another non-array type, the swagger DIFF results in a panic.
array
non-array
spec_1.json
{ "swagger": "2.0", "info": { "title": "Swagger Fixture", "version": "1.0" }, "paths": { "/a/": { "get": { "parameters": [ { "name": "", "in": "body", "schema": { "$ref": "#/definitions/A1" } } ], "responses": { "200": { "description": "200 response", "schema": { "type": "array", "items": { "$ref": "#/definitions/A1" } } } } } } }, "definitions": { "A1": { "type": "object", "properties": { "a": { "type": "array" } } } } }
spec_2.json
{ "swagger": "2.0", "info": { "title": "Swagger Fixture", "version": "1.0" }, "paths": { "/a/": { "get": { "parameters": [ { "name": "", "in": "body", "schema": { "$ref": "#/definitions/A1" } } ], "responses": { "200": { "description": "200 response", "schema": { "type": "array", "items": { "$ref": "#/definitions/A1" } } } } } } }, "definitions": { "A1": { "type": "object", "properties": { "a": { "type": "object" } } } } }
Then Run swagger diff spec_1.json spec_2.json.
swagger diff spec_1.json spec_2.json
It was result in a panic
goroutine 1 [running]: github.com/go-swagger/go-swagger/cmd/swagger/commands/diff.getTypeFromSchemaProps(0x1400054e488) /projects/go-swagger/cmd/swagger/commands/diff/schema.go:50 +0x138 github.com/go-swagger/go-swagger/cmd/swagger/commands/diff.getSchemaType({0x10549a9e0?, 0x1400054e488?}) /projects/go-swagger/cmd/swagger/commands/diff/schema.go:69 +0x108 github.com/go-swagger/go-swagger/cmd/swagger/commands/diff.fromSchemaProps(...) /projects/go-swagger/cmd/swagger/commands/diff/spec_analyser.go:489
swagger version: 2.0 go version: 1.18 OS: Mac Monterey
The text was updated successfully, but these errors were encountered:
handles scenario when a def in v1 changes from array to non-array type,
0382d24
fixes go-swagger#2894
7d4229b
fixes go-swagger#2894 Signed-off-by: Ahmad Moudani <aven30@gmail.com>
Successfully merging a pull request may close this issue.
Problem statement
When a definition property changes from
array
type to anothernon-array
type, the swagger DIFF results in a panic.Steps to reproduce
spec_1.json
spec_2.json
Then Run
swagger diff spec_1.json spec_2.json
.It was result in a panic
Environment
swagger version: 2.0
go version: 1.18
OS: Mac Monterey
The text was updated successfully, but these errors were encountered: