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 combining schema that was previously added to components with oneOf, anyOf, allOf it get referenced with doubled reference.
Example:
from apispec import APISpec from apispec.utils import OpenAPIVersion spec = APISpec('test', 'v1', OpenAPIVersion('2.0')) spec.components.schema( 'Request', { 'properties': { 'bool_field': { 'type': 'boolean' }, 'id': { 'type': 'integer' }, 'name': { 'type': 'string', 'description': 'name' }, 'list_field': { 'type': 'array', 'items': { 'type': 'integer' } } } } ) operations = { 'responses': {}, 'parameters': [ { 'in': 'body', 'required': False, 'name': 'body', 'schema': { 'allOf': [ '#/definitions/Request' ], 'example': { 'id': 1, 'name': 'test', 'bool_field': True, 'list_field': [ 1, 2, 3 ] } } } ] } spec.path(path='test', operations={'post': operations}) print(spec.to_dict())
Output: {'paths': OrderedDict([('test', {'post': {'responses': OrderedDict(), 'parameters': [{'in': 'body', 'required': False, 'name': 'body', 'schema': {'allOf': [{'$ref': '#/definitions/#/definitions/Request'}], 'example': {'id': 1, 'name': 'test', 'bool_field': True, 'list_field': [1, 2, 3]}}}]}})]), 'info': {'title': 'test', 'version': 'v1'}, 'swagger': '2.0', 'definitions': {'Request': {'properties': {'bool_field': {'type': 'boolean'}, 'id': {'type': 'integer'}, 'name': {'type': 'string', 'description': 'name'}, 'list_field': {'type': 'array', 'items': {'type': 'integer'}}}}}}
{'paths': OrderedDict([('test', {'post': {'responses': OrderedDict(), 'parameters': [{'in': 'body', 'required': False, 'name': 'body', 'schema': {'allOf': [{'$ref':
'#/definitions/#/definitions/Request'
}], 'example': {'id': 1, 'name': 'test', 'bool_field': True, 'list_field': [1, 2, 3]}}}]}})]), 'info': {'title': 'test', 'version': 'v1'}, 'swagger': '2.0', 'definitions': {'Request': {'properties': {'bool_field': {'type': 'boolean'}, 'id': {'type': 'integer'}, 'name': {'type': 'string', 'description': 'name'}, 'list_field': {'type': 'array', 'items': {'type': 'integer'}}}}}}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When combining schema that was previously added to components with oneOf, anyOf, allOf it get referenced with doubled reference.
Example:
Output:
{'paths': OrderedDict([('test', {'post': {'responses': OrderedDict(), 'parameters': [{'in': 'body', 'required': False, 'name': 'body', 'schema': {'allOf': [{'$ref':
'#/definitions/#/definitions/Request'
}], 'example': {'id': 1, 'name': 'test', 'bool_field': True, 'list_field': [1, 2, 3]}}}]}})]), 'info': {'title': 'test', 'version': 'v1'}, 'swagger': '2.0', 'definitions': {'Request': {'properties': {'bool_field': {'type': 'boolean'}, 'id': {'type': 'integer'}, 'name': {'type': 'string', 'description': 'name'}, 'list_field': {'type': 'array', 'items': {'type': 'integer'}}}}}}
The text was updated successfully, but these errors were encountered: