Closed robvik closed 3 years ago
Fantastic tool! Is it possible to dereference $ref entries and insert the actual definition data defined in the JSON-file in the parsing process? Here is an example:
The Petstore Swagger-specification: https://petstore.swagger.io/v2/swagger.json has the following path:
"/pet": { "post": { ... "parameters": [{ "in": "body", "name": "body", "description": "Pet object that needs to be added to the store", "required": true, "schema": { "$ref": "#/definitions/Pet" } }], ... } }
The definition is found in the JSON-file:
"Pet": { "type": "object", "required": ["name", "photoUrls"], "properties": { "id": { "type": "integer", "format": "int64" }, "category": { "$ref": "#/definitions/Category" }, "name": { "type": "string", "example": "doggie" }, "photoUrls": { "type": "array", "xml": { "wrapped": true }, "items": { "type": "string", "xml": { "name": "photoUrl" } } }, "tags": { "type": "array", "xml": { "wrapped": true }, "items": { "xml": { "name": "tag" }, "$ref": "#/definitions/Tag" } }, "status": { "type": "string", "description": "pet status in the store", "enum": ["available", "pending", "sold"] } }, "xml": { "name": "Pet" } }
Is it possible for swagger-parser to return the following dereferenced output?
"/pet": { "post": { ... "parameters": [{ "in": "body", "name": "body", "description": "Pet object that needs to be added to the store", "required": true, "schema": { "type": "object", "required": ["name", "photoUrls"], "properties": { "id": { "type": "integer", "format": "int64" }, "category": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } }, "xml": { "name": "Category" } }, "name": { "type": "string", "example": "doggie" }, "photoUrls": { "type": "array", "xml": { "wrapped": true }, "items": { "type": "string", "xml": { "name": "photoUrl" } } }, "tags": { "type": "array", "xml": { "wrapped": true }, "items": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } }, "xml": { "name": "Tag" } } }, "status": { "type": "string", "description": "pet status in the store", "enum": ["available", "pending", "sold"] } }, "xml": { "name": "Pet" } } }], ... } }
Thanks!
I cant quite tell what is being asked here, sorry.
Dereferencing
Fantastic tool! Is it possible to dereference $ref entries and insert the actual definition data defined in the JSON-file in the parsing process? Here is an example:
The Petstore Swagger-specification: https://petstore.swagger.io/v2/swagger.json has the following path:
The definition is found in the JSON-file:
Is it possible for swagger-parser to return the following dereferenced output?
Thanks!