-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
Problem statement
When Swagger doc has a recursive definition, the swagger diff
command seem to enter an infinite loop.
Swagger specification
{
"swagger": "2.0",
"info": {
"description": "",
"version": "1.0.0",
"title": "test"
},
"host": "test.example.com",
"basePath": "/",
"schemes": [
"https"
],
"paths": {
"/categories": {
"get": {
"tags": [
"categories"
],
"summary": "get all categories",
"description": "",
"produces": [
"application/xml",
"application/json"
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Category"
}
}
}
}
}
},
"definitions": {
"Category": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"subCategories": {
"$ref": "#/definitions/Category"
}
},
"xml": {
"name": "Category"
}
}
}
}
Steps to reproduce
- save the spec above to old.json
- save the spec above to new.json
- run command
swagger old.json new.json
expect the result is no change, but the command never completed
Environment
swagger version: v0.29.0
go version: 1.18.1
OS: Arch Linux
Sam-Tymoshchuk