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
If an object contains two or more properties with the same complex type, generated json-schema object is invalid.
{ "swagger": "2.0", "info": { "title": "Test API", "version": "{{version}}" }, ... "paths": { "/foo/api": { "get": { "summary": "GET /foo/api", "description": "GET /foo/api", "operationId": "GET--foo-api", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/TestResponse" } } } } } }, "definitions": { "TestResponse": { "type": "object", "properties": { "a": { "$ref": "#/definitions/CommonDefinition" }, "b": { "$ref": "#/definitions/CommonDefinition" } } }, "CommonDefinition": { "type": "object", "properties": { "foo": { "type": "string" } } } } }
After compilation we receive following json-scheme object
{ type: "object", properties: { a: { type: "object", properties: { foo: { type: "string" } }, $id: "default_CommonDefinition" }, b: { type: "object", properties: { foo: { type: "string" } }, $id: "default_CommonDefinition" } }, $id: "default_TestResponse" }
The problem is using the $id keyword that identifies a schema resource.
If you try to validate the object described below using ajv package, you will receive the following exception
Error: reference "#default_CommonDefinition" resolves to more than one schema
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
If an object contains two or more properties with the same complex type, generated json-schema object is invalid.
Example
openapi.json
After compilation we receive following json-scheme object
The problem is using the $id keyword that identifies a schema resource.
If you try to validate the object described below using ajv package, you will receive the following exception
The text was updated successfully, but these errors were encountered: