openapi-spec-validator
openapi-spec-validator copied to clipboard
0.3.2: strange pytest output
I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
-
python3 -sBm build -w --no-isolation
- because I'm calling
build
with--no-isolation
I'm using during all processes only locally installed modules - install .whl file in </install/prefix>
- run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
Looks like pytest is trying to execute pytest and that part failsbut everything finishes with ext 0. Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-openapi-spec-validator-0.3.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-openapi-spec-validator-0.3.2-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -q
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/openapi-spec-validator-0.3.2, configfile: pyproject.toml
plugins: cov-3.0.0
collected 44 items
tests/integration/test_main.py OK
.OK
.OK
...usage: pytest [-h] [--errors {best-match,all}] [--schema {2.0,3.0.0}] filename
pytest: error: argument --schema: invalid choice: 'x.x' (choose from '2.0', '3.0.0')
.# Validation Error
'openapi' is a required property
Failed validating 'required' in schema:
{'$schema': 'http://json-schema.org/draft-04/schema#',
'additionalProperties': False,
'definitions': {'APIKeySecurityScheme': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'in': {'enum': ['header',
'query',
'cookie'],
'type': 'string'},
'name': {'type': 'string'},
'type': {'enum': ['apiKey'],
'type': 'string'}},
'required': ['type',
'name',
'in'],
'type': 'object'},
'AuthorizationCodeOAuthFlow': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'authorizationUrl': {'format': 'uri-reference',
'type': 'string'},
'refreshUrl': {'format': 'uri-reference',
'type': 'string'},
'scopes': {'additionalProperties': {'type': 'string'},
'type': 'object'},
'tokenUrl': {'format': 'uri-reference',
'type': 'string'}},
'required': ['authorizationUrl',
'tokenUrl'],
'type': 'object'},
'Callback': {'additionalProperties': {'$ref': '#/definitions/PathItem'},
'patternProperties': {'^x-': {}},
'type': 'object'},
'ClientCredentialsFlow': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'refreshUrl': {'format': 'uri-reference',
'type': 'string'},
'scopes': {'additionalProperties': {'type': 'string'},
'type': 'object'},
'tokenUrl': {'format': 'uri-reference',
'type': 'string'}},
'required': ['tokenUrl'],
'type': 'object'},
'Components': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'callbacks': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Callback'}]}},
'type': 'object'},
'examples': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Example'}]}},
'type': 'object'},
'headers': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Header'}]}},
'type': 'object'},
'links': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Link'}]}},
'type': 'object'},
'parameters': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Parameter'}]}},
'type': 'object'},
'requestBodies': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/RequestBody'}]}},
'type': 'object'},
'responses': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Response'}]}},
'type': 'object'},
'schemas': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]}},
'type': 'object'},
'securitySchemes': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/SecurityScheme'}]}},
'type': 'object'}},
'type': 'object'},
'Contact': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'email': {'format': 'email',
'type': 'string'},
'name': {'type': 'string'},
'url': {'format': 'uri-reference',
'type': 'string'}},
'type': 'object'},
'Discriminator': {'properties': {'mapping': {'additionalProperties': {'type': 'string'},
'type': 'object'},
'propertyName': {'type': 'string'}},
'required': ['propertyName'],
'type': 'object'},
'Encoding': {'additionalProperties': False,
'properties': {'allowReserved': {'default': False,
'type': 'boolean'},
'contentType': {'type': 'string'},
'explode': {'type': 'boolean'},
'headers': {'additionalProperties': {'$ref': '#/definitions/Header'},
'type': 'object'},
'style': {'enum': ['form',
'spaceDelimited',
'pipeDelimited',
'deepObject'],
'type': 'string'}},
'type': 'object'},
'Example': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'externalValue': {'format': 'uri-reference',
'type': 'string'},
'summary': {'type': 'string'},
'value': {}},
'type': 'object'},
'ExampleXORExamples': {'description': 'Example and '
'examples are '
'mutually '
'exclusive',
'not': {'required': ['example',
'examples']}},
'ExternalDocumentation': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'url': {'format': 'uri-reference',
'type': 'string'}},
'required': ['url'],
'type': 'object'},
'HTTPSecurityScheme': {'additionalProperties': False,
'oneOf': [{'description': 'Bearer',
'properties': {'scheme': {'enum': ['bearer']}}},
{'description': 'Non '
'Bearer',
'not': {'required': ['bearerFormat']},
'properties': {'scheme': {'not': {'enum': ['bearer']}}}}],
'patternProperties': {'^x-': {}},
'properties': {'bearerFormat': {'type': 'string'},
'description': {'type': 'string'},
'scheme': {'type': 'string'},
'type': {'enum': ['http'],
'type': 'string'}},
'required': ['scheme', 'type'],
'type': 'object'},
'Header': {'additionalProperties': False,
'allOf': [{'$ref': '#/definitions/ExampleXORExamples'},
{'$ref': '#/definitions/SchemaXORContent'}],
'patternProperties': {'^x-': {}},
'properties': {'allowEmptyValue': {'default': False,
'type': 'boolean'},
'allowReserved': {'default': False,
'type': 'boolean'},
'content': {'additionalProperties': {'$ref': '#/definitions/MediaType'},
'maxProperties': 1,
'minProperties': 1,
'type': 'object'},
'deprecated': {'default': False,
'type': 'boolean'},
'description': {'type': 'string'},
'example': {},
'examples': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Example'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'explode': {'type': 'boolean'},
'required': {'default': False,
'type': 'boolean'},
'schema': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'style': {'default': 'simple',
'enum': ['simple'],
'type': 'string'}},
'type': 'object'},
'ImplicitOAuthFlow': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'authorizationUrl': {'format': 'uri-reference',
'type': 'string'},
'refreshUrl': {'format': 'uri-reference',
'type': 'string'},
'scopes': {'additionalProperties': {'type': 'string'},
'type': 'object'}},
'required': ['authorizationUrl',
'scopes'],
'type': 'object'},
'Info': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'contact': {'$ref': '#/definitions/Contact'},
'description': {'type': 'string'},
'license': {'$ref': '#/definitions/License'},
'termsOfService': {'format': 'uri-reference',
'type': 'string'},
'title': {'type': 'string'},
'version': {'type': 'string'}},
'required': ['title', 'version'],
'type': 'object'},
'License': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'name': {'type': 'string'},
'url': {'format': 'uri-reference',
'type': 'string'}},
'required': ['name'],
'type': 'object'},
'Link': {'additionalProperties': False,
'not': {'description': 'Operation Id and '
'Operation Ref are '
'mutually exclusive',
'required': ['operationId',
'operationRef']},
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'operationId': {'type': 'string'},
'operationRef': {'format': 'uri-reference',
'type': 'string'},
'parameters': {'additionalProperties': {},
'type': 'object'},
'requestBody': {},
'server': {'$ref': '#/definitions/Server'}},
'type': 'object'},
'MediaType': {'additionalProperties': False,
'allOf': [{'$ref': '#/definitions/ExampleXORExamples'}],
'patternProperties': {'^x-': {}},
'properties': {'encoding': {'additionalProperties': {'$ref': '#/definitions/Encoding'},
'type': 'object'},
'example': {},
'examples': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Example'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'schema': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]}},
'type': 'object'},
'OAuth2SecurityScheme': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'flows': {'$ref': '#/definitions/OAuthFlows'},
'type': {'enum': ['oauth2'],
'type': 'string'}},
'required': ['type', 'flows'],
'type': 'object'},
'OAuthFlows': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'authorizationCode': {'$ref': '#/definitions/AuthorizationCodeOAuthFlow'},
'clientCredentials': {'$ref': '#/definitions/ClientCredentialsFlow'},
'implicit': {'$ref': '#/definitions/ImplicitOAuthFlow'},
'password': {'$ref': '#/definitions/PasswordOAuthFlow'}},
'type': 'object'},
'OpenIdConnectSecurityScheme': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'openIdConnectUrl': {'format': 'uri-reference',
'type': 'string'},
'type': {'enum': ['openIdConnect'],
'type': 'string'}},
'required': ['type',
'openIdConnectUrl'],
'type': 'object'},
'Operation': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'callbacks': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Callback'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'deprecated': {'default': False,
'type': 'boolean'},
'description': {'type': 'string'},
'externalDocs': {'$ref': '#/definitions/ExternalDocumentation'},
'operationId': {'type': 'string'},
'parameters': {'items': {'oneOf': [{'$ref': '#/definitions/Parameter'},
{'$ref': '#/definitions/Reference'}]},
'type': 'array',
'uniqueItems': True},
'requestBody': {'oneOf': [{'$ref': '#/definitions/RequestBody'},
{'$ref': '#/definitions/Reference'}]},
'responses': {'$ref': '#/definitions/Responses'},
'security': {'items': {'$ref': '#/definitions/SecurityRequirement'},
'type': 'array'},
'servers': {'items': {'$ref': '#/definitions/Server'},
'type': 'array'},
'summary': {'type': 'string'},
'tags': {'items': {'type': 'string'},
'type': 'array'}},
'required': ['responses'],
'type': 'object'},
'Parameter': {'additionalProperties': False,
'allOf': [{'$ref': '#/definitions/ExampleXORExamples'},
{'$ref': '#/definitions/SchemaXORContent'},
{'$ref': '#/definitions/ParameterLocation'}],
'patternProperties': {'^x-': {}},
'properties': {'allowEmptyValue': {'default': False,
'type': 'boolean'},
'allowReserved': {'default': False,
'type': 'boolean'},
'content': {'additionalProperties': {'$ref': '#/definitions/MediaType'},
'maxProperties': 1,
'minProperties': 1,
'type': 'object'},
'deprecated': {'default': False,
'type': 'boolean'},
'description': {'type': 'string'},
'example': {},
'examples': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Example'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'explode': {'type': 'boolean'},
'in': {'type': 'string'},
'name': {'type': 'string'},
'required': {'default': False,
'type': 'boolean'},
'schema': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'style': {'type': 'string'}},
'required': ['name', 'in'],
'type': 'object'},
'ParameterLocation': {'description': 'Parameter '
'location',
'oneOf': [{'description': 'Parameter '
'in '
'path',
'properties': {'in': {'enum': ['path']},
'required': {'enum': [True]},
'style': {'default': 'simple',
'enum': ['matrix',
'label',
'simple']}},
'required': ['required']},
{'description': 'Parameter '
'in '
'query',
'properties': {'in': {'enum': ['query']},
'style': {'default': 'form',
'enum': ['form',
'spaceDelimited',
'pipeDelimited',
'deepObject']}}},
{'description': 'Parameter '
'in '
'header',
'properties': {'in': {'enum': ['header']},
'style': {'default': 'simple',
'enum': ['simple']}}},
{'description': 'Parameter '
'in '
'cookie',
'properties': {'in': {'enum': ['cookie']},
'style': {'default': 'form',
'enum': ['form']}}}]},
'PasswordOAuthFlow': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'refreshUrl': {'format': 'uri-reference',
'type': 'string'},
'scopes': {'additionalProperties': {'type': 'string'},
'type': 'object'},
'tokenUrl': {'format': 'uri-reference',
'type': 'string'}},
'required': ['tokenUrl'],
'type': 'object'},
'PathItem': {'additionalProperties': False,
'patternProperties': {'^(get|put|post|delete|options|head|patch|trace)$': {'$ref': '#/definitions/Operation'},
'^x-': {}},
'properties': {'$ref': {'type': 'string'},
'description': {'type': 'string'},
'parameters': {'items': {'oneOf': [{'$ref': '#/definitions/Parameter'},
{'$ref': '#/definitions/Reference'}]},
'type': 'array',
'uniqueItems': True},
'servers': {'items': {'$ref': '#/definitions/Server'},
'type': 'array'},
'summary': {'type': 'string'}},
'type': 'object'},
'Paths': {'additionalProperties': False,
'patternProperties': {'^\\/': {'$ref': '#/definitions/PathItem'},
'^x-': {}},
'type': 'object'},
'Reference': {'patternProperties': {'^\\$ref$': {'format': 'uri-reference',
'type': 'string'}},
'required': ['$ref'],
'type': 'object'},
'RequestBody': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'content': {'additionalProperties': {'$ref': '#/definitions/MediaType'},
'type': 'object'},
'description': {'type': 'string'},
'required': {'default': False,
'type': 'boolean'}},
'required': ['content'],
'type': 'object'},
'Response': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'content': {'additionalProperties': {'$ref': '#/definitions/MediaType'},
'type': 'object'},
'description': {'type': 'string'},
'headers': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Header'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'links': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Link'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'}},
'required': ['description'],
'type': 'object'},
'Responses': {'additionalProperties': False,
'minProperties': 1,
'patternProperties': {'^[1-5](?:\\d{2}|XX)$': {'oneOf': [{'$ref': '#/definitions/Response'},
{'$ref': '#/definitions/Reference'}]},
'^x-': {}},
'properties': {'default': {'oneOf': [{'$ref': '#/definitions/Response'},
{'$ref': '#/definitions/Reference'}]}},
'type': 'object'},
'Schema': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'additionalProperties': {'default': True,
'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'},
{'type': 'boolean'}]},
'allOf': {'items': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'type': 'array'},
'anyOf': {'items': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'type': 'array'},
'default': {},
'deprecated': {'default': False,
'type': 'boolean'},
'description': {'type': 'string'},
'discriminator': {'$ref': '#/definitions/Discriminator'},
'enum': {'items': {},
'minItems': 1,
'type': 'array',
'uniqueItems': False},
'example': {},
'exclusiveMaximum': {'default': False,
'type': 'boolean'},
'exclusiveMinimum': {'default': False,
'type': 'boolean'},
'externalDocs': {'$ref': '#/definitions/ExternalDocumentation'},
'format': {'type': 'string'},
'items': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'maxItems': {'minimum': 0,
'type': 'integer'},
'maxLength': {'minimum': 0,
'type': 'integer'},
'maxProperties': {'minimum': 0,
'type': 'integer'},
'maximum': {'type': 'number'},
'minItems': {'default': 0,
'minimum': 0,
'type': 'integer'},
'minLength': {'default': 0,
'minimum': 0,
'type': 'integer'},
'minProperties': {'default': 0,
'minimum': 0,
'type': 'integer'},
'minimum': {'type': 'number'},
'multipleOf': {'exclusiveMinimum': True,
'minimum': 0,
'type': 'number'},
'not': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'nullable': {'default': False,
'type': 'boolean'},
'oneOf': {'items': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'type': 'array'},
'pattern': {'format': 'regex',
'type': 'string'},
'properties': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'readOnly': {'default': False,
'type': 'boolean'},
'required': {'items': {'type': 'string'},
'minItems': 1,
'type': 'array',
'uniqueItems': True},
'title': {'type': 'string'},
'type': {'enum': ['array',
'boolean',
'integer',
'number',
'object',
'string'],
'type': 'string'},
'uniqueItems': {'default': False,
'type': 'boolean'},
'writeOnly': {'default': False,
'type': 'boolean'},
'xml': {'$ref': '#/definitions/XML'}},
'type': 'object'},
'SchemaXORContent': {'description': 'Schema and '
'content are '
'mutually '
'exclusive, at '
'least one is '
'required',
'not': {'required': ['schema',
'content']},
'oneOf': [{'required': ['schema']},
{'allOf': [{'not': {'required': ['style']}},
{'not': {'required': ['explode']}},
{'not': {'required': ['allowReserved']}},
{'not': {'required': ['example']}},
{'not': {'required': ['examples']}}],
'description': 'Some '
'properties '
'are '
'not '
'allowed '
'if '
'content '
'is '
'present',
'required': ['content']}]},
'SecurityRequirement': {'additionalProperties': {'items': {'type': 'string'},
'type': 'array'},
'type': 'object'},
'SecurityScheme': {'oneOf': [{'$ref': '#/definitions/APIKeySecurityScheme'},
{'$ref': '#/definitions/HTTPSecurityScheme'},
{'$ref': '#/definitions/OAuth2SecurityScheme'},
{'$ref': '#/definitions/OpenIdConnectSecurityScheme'}]},
'Server': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'url': {'type': 'string'},
'variables': {'additionalProperties': {'$ref': '#/definitions/ServerVariable'},
'type': 'object'}},
'required': ['url'],
'type': 'object'},
'ServerVariable': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'default': {'type': 'string'},
'description': {'type': 'string'},
'enum': {'items': {'type': 'string'},
'type': 'array'}},
'required': ['default'],
'type': 'object'},
'Tag': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'externalDocs': {'$ref': '#/definitions/ExternalDocumentation'},
'name': {'type': 'string'}},
'required': ['name'],
'type': 'object'},
'XML': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'attribute': {'default': False,
'type': 'boolean'},
'name': {'type': 'string'},
'namespace': {'format': 'uri',
'type': 'string'},
'prefix': {'type': 'string'},
'wrapped': {'default': False,
'type': 'boolean'}},
'type': 'object'}},
'description': 'Validation schema for OpenAPI Specification 3.0.X.',
'patternProperties': {'^x-': {}},
'properties': {'components': {'$ref': '#/definitions/Components'},
'externalDocs': {'$ref': '#/definitions/ExternalDocumentation'},
'info': {'$ref': '#/definitions/Info'},
'openapi': {'pattern': '^3\\.0\\.\\d(-.+)?$',
'type': 'string'},
'paths': {'$ref': '#/definitions/Paths'},
'security': {'items': {'$ref': '#/definitions/SecurityRequirement'},
'type': 'array'},
'servers': {'items': {'$ref': '#/definitions/Server'},
'type': 'array'},
'tags': {'items': {'$ref': '#/definitions/Tag'},
'type': 'array',
'uniqueItems': True}},
'required': ['openapi', 'info', 'paths'],
'title': 'A JSON Schema for OpenAPI 3.0.X.',
'type': 'object'}
On instance:
{'basePath': '/v1',
'consumes': ['application/json'],
'definitions': {'Error': {'properties': {'code': {'format': 'int32',
'type': 'integer'},
'message': {'type': 'string'}},
'required': ['code', 'message']},
'Pet': {'properties': {'id': {'format': 'int64',
'type': 'integer'},
'name': {'type': 'string'},
'tag': {'type': 'string'}},
'required': ['id', 'name']},
'Pets': {'items': {'$ref': '#/definitions/Pet'},
'type': 'array'}},
'host': 'petstore.swagger.io',
'info': {'license': {'name': 'MIT'},
'title': 'Swagger Petstore',
'version': '1.0.0'},
'paths': {'/pets': {'get': {'operationId': 'listPets',
'parameters': [{'description': 'How many '
'items to '
'return at '
'one time '
'(max 100)',
'format': 'int32',
'in': 'query',
'name': 'limit',
'required': False,
'type': 'integer'}],
'responses': {'200': {'description': 'A '
'paged '
'array '
'of '
'pets',
'headers': {'x-next': {'description': 'A '
'link '
'to '
'the '
'next '
'page '
'of '
'responses',
'type': 'string'}},
'schema': {'$ref': '#/definitions/Pets'}},
'default': {'description': 'unexpected '
'error',
'schema': {'$ref': '#/definitions/Error'}}},
'summary': 'List all pets',
'tags': ['pets']},
'post': {'operationId': 'createPets',
'responses': {'201': {'description': 'Null '
'response'},
'default': {'description': 'unexpected '
'error',
'schema': {'$ref': '#/definitions/Error'}}},
'summary': 'Create a pet',
'tags': ['pets']}},
'/pets/{petId}': {'get': {'operationId': 'showPetById',
'parameters': [{'description': 'The '
'id '
'of '
'the '
'pet '
'to '
'retrieve',
'in': 'path',
'name': 'petId',
'required': True,
'type': 'string'}],
'responses': {'200': {'description': 'Expected '
'response '
'to '
'a '
'valid '
'request',
'schema': {'$ref': '#/definitions/Pets'}},
'default': {'description': 'unexpected '
'error',
'schema': {'$ref': '#/definitions/Error'}}},
'summary': 'Info for a specific '
'pet',
'tags': ['pets']}}},
'produces': ['application/json'],
'schemes': ['http'],
'swagger': '2.0'}
.
.No such file: i_dont_exist.yaml
.OK
.
tests/integration/test_shortcuts.py ...............
tests/integration/test_validate.py .......
tests/integration/test_validators.py ............/usr/lib64/python3.8/site-packages/coverage/control.py:768: CoverageWarning: No data was collected. (no-data-collected)
self._warn("No data was collected.", slug="no-data-collected")
------------------------------------- generated xml file: /home/tkloczko/rpmbuild/BUILD/openapi-spec-validator-0.3.2/reports/junit.xml -------------------------------------
---------- coverage: platform linux, python 3.8.12-final-0 -----------
Name Stmts Miss Cover Missing
---------------------------------------------------------------------------
openapi_spec_validator/__init__.py 26 26 0% 2-64
openapi_spec_validator/__main__.py 52 52 0% 1-93
openapi_spec_validator/constructors.py 5 5 0% 1-14
openapi_spec_validator/decorators.py 41 41 0% 2-65
openapi_spec_validator/exceptions.py 11 11 0% 1-21
openapi_spec_validator/factories.py 28 28 0% 2-68
openapi_spec_validator/generators.py 13 13 0% 2-42
openapi_spec_validator/handlers/__init__.py 6 6 0% 1-11
openapi_spec_validator/handlers/base.py 3 3 0% 4-8
openapi_spec_validator/handlers/file.py 18 18 0% 2-31
openapi_spec_validator/handlers/requests.py 21 21 0% 2-32
openapi_spec_validator/handlers/urllib.py 14 14 0% 2-24
openapi_spec_validator/handlers/utils.py 7 7 0% 1-10
openapi_spec_validator/loaders.py 14 14 0% 1-19
openapi_spec_validator/managers.py 20 20 0% 2-36
openapi_spec_validator/readers.py 15 15 0% 1-21
openapi_spec_validator/schemas.py 15 15 0% 2-23
openapi_spec_validator/shortcuts.py 12 12 0% 2-17
openapi_spec_validator/validators.py 217 217 0% 1-348
---------------------------------------------------------------------------
TOTAL 538 538 0%
Coverage XML written to file reports/coverage.xml
============================================================================ 44 passed in 7.80s ============================================================================
BTW looks like openapi-spec-validator
install time dependencies requires jsonschema
< 4 (latest is 4.4.0) and pyrsistent
< 0.17 (latest is 0.18.0).
Do you have any plans soon to make updates for those versions?
It's just output of CLI's test. Nothing to be worry about
Do you have any plans soon to make updates for those versions?
Yes they will be updated in next releases
Just tested 0.5.4 and that I found two issues
- looks lik
six
can be romoved frompoetry.lock
[tkloczko@pers-jacek openapi-spec-validator-0.5.4]$ grep -w six -r
poetry.lock:testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"]
poetry.lock:name = "six"
poetry.lock:six = ">=1.14.0"
poetry.lock:six = [
poetry.lock: {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
poetry.lock: {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
- I see on unit failing now Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-openapi-spec-validator-0.5.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-openapi-spec-validator-0.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.16, pytest-7.2.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/openapi-spec-validator-0.5.4, configfile: pyproject.toml
collected 68 items / 26 deselected / 42 selected
tests/integration/test_main.py OK
.OK
.OK
.OK
.OK
....# Validation Error
'openapi' is a required property
Failed validating 'required' in schema:
{'$schema': 'http://json-schema.org/draft-04/schema#',
'additionalProperties': False,
'definitions': {'APIKeySecurityScheme': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'in': {'enum': ['header',
'query',
'cookie'],
'type': 'string'},
'name': {'type': 'string'},
'type': {'enum': ['apiKey'],
'type': 'string'}},
'required': ['type',
'name',
'in'],
'type': 'object'},
'AuthorizationCodeOAuthFlow': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'authorizationUrl': {'format': 'uri-reference',
'type': 'string'},
'refreshUrl': {'format': 'uri-reference',
'type': 'string'},
'scopes': {'additionalProperties': {'type': 'string'},
'type': 'object'},
'tokenUrl': {'format': 'uri-reference',
'type': 'string'}},
'required': ['authorizationUrl',
'tokenUrl'],
'type': 'object'},
'Callback': {'additionalProperties': {'$ref': '#/definitions/PathItem'},
'patternProperties': {'^x-': {}},
'type': 'object'},
'ClientCredentialsFlow': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'refreshUrl': {'format': 'uri-reference',
'type': 'string'},
'scopes': {'additionalProperties': {'type': 'string'},
'type': 'object'},
'tokenUrl': {'format': 'uri-reference',
'type': 'string'}},
'required': ['tokenUrl'],
'type': 'object'},
'Components': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'callbacks': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Callback'}]}},
'type': 'object'},
'examples': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Example'}]}},
'type': 'object'},
'headers': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Header'}]}},
'type': 'object'},
'links': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Link'}]}},
'type': 'object'},
'parameters': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Parameter'}]}},
'type': 'object'},
'requestBodies': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/RequestBody'}]}},
'type': 'object'},
'responses': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/Response'}]}},
'type': 'object'},
'schemas': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]}},
'type': 'object'},
'securitySchemes': {'patternProperties': {'^[a-zA-Z0-9\\.\\-_]+$': {'oneOf': [{'$ref': '#/definitions/Reference'},
{'$ref': '#/definitions/SecurityScheme'}]}},
'type': 'object'}},
'type': 'object'},
'Contact': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'email': {'format': 'email',
'type': 'string'},
'name': {'type': 'string'},
'url': {'format': 'uri-reference',
'type': 'string'}},
'type': 'object'},
'Discriminator': {'properties': {'mapping': {'additionalProperties': {'type': 'string'},
'type': 'object'},
'propertyName': {'type': 'string'}},
'required': ['propertyName'],
'type': 'object'},
'Encoding': {'additionalProperties': False,
'properties': {'allowReserved': {'default': False,
'type': 'boolean'},
'contentType': {'type': 'string'},
'explode': {'type': 'boolean'},
'headers': {'additionalProperties': {'$ref': '#/definitions/Header'},
'type': 'object'},
'style': {'enum': ['form',
'spaceDelimited',
'pipeDelimited',
'deepObject'],
'type': 'string'}},
'type': 'object'},
'Example': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'externalValue': {'format': 'uri-reference',
'type': 'string'},
'summary': {'type': 'string'},
'value': {}},
'type': 'object'},
'ExampleXORExamples': {'description': 'Example and '
'examples are '
'mutually '
'exclusive',
'not': {'required': ['example',
'examples']}},
'ExternalDocumentation': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'url': {'format': 'uri-reference',
'type': 'string'}},
'required': ['url'],
'type': 'object'},
'HTTPSecurityScheme': {'additionalProperties': False,
'oneOf': [{'description': 'Bearer',
'properties': {'scheme': {'enum': ['bearer']}}},
{'description': 'Non '
'Bearer',
'not': {'required': ['bearerFormat']},
'properties': {'scheme': {'not': {'enum': ['bearer']}}}}],
'patternProperties': {'^x-': {}},
'properties': {'bearerFormat': {'type': 'string'},
'description': {'type': 'string'},
'scheme': {'type': 'string'},
'type': {'enum': ['http'],
'type': 'string'}},
'required': ['scheme', 'type'],
'type': 'object'},
'Header': {'additionalProperties': False,
'allOf': [{'$ref': '#/definitions/ExampleXORExamples'},
{'$ref': '#/definitions/SchemaXORContent'}],
'patternProperties': {'^x-': {}},
'properties': {'allowEmptyValue': {'default': False,
'type': 'boolean'},
'allowReserved': {'default': False,
'type': 'boolean'},
'content': {'additionalProperties': {'$ref': '#/definitions/MediaType'},
'maxProperties': 1,
'minProperties': 1,
'type': 'object'},
'deprecated': {'default': False,
'type': 'boolean'},
'description': {'type': 'string'},
'example': {},
'examples': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Example'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'explode': {'type': 'boolean'},
'required': {'default': False,
'type': 'boolean'},
'schema': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'style': {'default': 'simple',
'enum': ['simple'],
'type': 'string'}},
'type': 'object'},
'ImplicitOAuthFlow': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'authorizationUrl': {'format': 'uri-reference',
'type': 'string'},
'refreshUrl': {'format': 'uri-reference',
'type': 'string'},
'scopes': {'additionalProperties': {'type': 'string'},
'type': 'object'}},
'required': ['authorizationUrl',
'scopes'],
'type': 'object'},
'Info': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'contact': {'$ref': '#/definitions/Contact'},
'description': {'type': 'string'},
'license': {'$ref': '#/definitions/License'},
'termsOfService': {'format': 'uri-reference',
'type': 'string'},
'title': {'type': 'string'},
'version': {'type': 'string'}},
'required': ['title', 'version'],
'type': 'object'},
'License': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'name': {'type': 'string'},
'url': {'format': 'uri-reference',
'type': 'string'}},
'required': ['name'],
'type': 'object'},
'Link': {'additionalProperties': False,
'not': {'description': 'Operation Id and '
'Operation Ref are '
'mutually exclusive',
'required': ['operationId',
'operationRef']},
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'operationId': {'type': 'string'},
'operationRef': {'format': 'uri-reference',
'type': 'string'},
'parameters': {'additionalProperties': {},
'type': 'object'},
'requestBody': {},
'server': {'$ref': '#/definitions/Server'}},
'type': 'object'},
'MediaType': {'additionalProperties': False,
'allOf': [{'$ref': '#/definitions/ExampleXORExamples'}],
'patternProperties': {'^x-': {}},
'properties': {'encoding': {'additionalProperties': {'$ref': '#/definitions/Encoding'},
'type': 'object'},
'example': {},
'examples': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Example'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'schema': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]}},
'type': 'object'},
'OAuth2SecurityScheme': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'flows': {'$ref': '#/definitions/OAuthFlows'},
'type': {'enum': ['oauth2'],
'type': 'string'}},
'required': ['type', 'flows'],
'type': 'object'},
'OAuthFlows': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'authorizationCode': {'$ref': '#/definitions/AuthorizationCodeOAuthFlow'},
'clientCredentials': {'$ref': '#/definitions/ClientCredentialsFlow'},
'implicit': {'$ref': '#/definitions/ImplicitOAuthFlow'},
'password': {'$ref': '#/definitions/PasswordOAuthFlow'}},
'type': 'object'},
'OpenIdConnectSecurityScheme': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'openIdConnectUrl': {'format': 'uri-reference',
'type': 'string'},
'type': {'enum': ['openIdConnect'],
'type': 'string'}},
'required': ['type',
'openIdConnectUrl'],
'type': 'object'},
'Operation': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'callbacks': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Callback'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'deprecated': {'default': False,
'type': 'boolean'},
'description': {'type': 'string'},
'externalDocs': {'$ref': '#/definitions/ExternalDocumentation'},
'operationId': {'type': 'string'},
'parameters': {'items': {'oneOf': [{'$ref': '#/definitions/Parameter'},
{'$ref': '#/definitions/Reference'}]},
'type': 'array',
'uniqueItems': True},
'requestBody': {'oneOf': [{'$ref': '#/definitions/RequestBody'},
{'$ref': '#/definitions/Reference'}]},
'responses': {'$ref': '#/definitions/Responses'},
'security': {'items': {'$ref': '#/definitions/SecurityRequirement'},
'type': 'array'},
'servers': {'items': {'$ref': '#/definitions/Server'},
'type': 'array'},
'summary': {'type': 'string'},
'tags': {'items': {'type': 'string'},
'type': 'array'}},
'required': ['responses'],
'type': 'object'},
'Parameter': {'additionalProperties': False,
'allOf': [{'$ref': '#/definitions/ExampleXORExamples'},
{'$ref': '#/definitions/SchemaXORContent'},
{'$ref': '#/definitions/ParameterLocation'}],
'patternProperties': {'^x-': {}},
'properties': {'allowEmptyValue': {'default': False,
'type': 'boolean'},
'allowReserved': {'default': False,
'type': 'boolean'},
'content': {'additionalProperties': {'$ref': '#/definitions/MediaType'},
'maxProperties': 1,
'minProperties': 1,
'type': 'object'},
'deprecated': {'default': False,
'type': 'boolean'},
'description': {'type': 'string'},
'example': {},
'examples': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Example'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'explode': {'type': 'boolean'},
'in': {'type': 'string'},
'name': {'type': 'string'},
'required': {'default': False,
'type': 'boolean'},
'schema': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'style': {'type': 'string'}},
'required': ['name', 'in'],
'type': 'object'},
'ParameterLocation': {'description': 'Parameter '
'location',
'oneOf': [{'description': 'Parameter '
'in '
'path',
'properties': {'in': {'enum': ['path']},
'required': {'enum': [True]},
'style': {'default': 'simple',
'enum': ['matrix',
'label',
'simple']}},
'required': ['required']},
{'description': 'Parameter '
'in '
'query',
'properties': {'in': {'enum': ['query']},
'style': {'default': 'form',
'enum': ['form',
'spaceDelimited',
'pipeDelimited',
'deepObject']}}},
{'description': 'Parameter '
'in '
'header',
'properties': {'in': {'enum': ['header']},
'style': {'default': 'simple',
'enum': ['simple']}}},
{'description': 'Parameter '
'in '
'cookie',
'properties': {'in': {'enum': ['cookie']},
'style': {'default': 'form',
'enum': ['form']}}}]},
'PasswordOAuthFlow': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'refreshUrl': {'format': 'uri-reference',
'type': 'string'},
'scopes': {'additionalProperties': {'type': 'string'},
'type': 'object'},
'tokenUrl': {'format': 'uri-reference',
'type': 'string'}},
'required': ['tokenUrl'],
'type': 'object'},
'PathItem': {'additionalProperties': False,
'patternProperties': {'^(get|put|post|delete|options|head|patch|trace)$': {'$ref': '#/definitions/Operation'},
'^x-': {}},
'properties': {'$ref': {'type': 'string'},
'description': {'type': 'string'},
'parameters': {'items': {'oneOf': [{'$ref': '#/definitions/Parameter'},
{'$ref': '#/definitions/Reference'}]},
'type': 'array',
'uniqueItems': True},
'servers': {'items': {'$ref': '#/definitions/Server'},
'type': 'array'},
'summary': {'type': 'string'}},
'type': 'object'},
'Paths': {'additionalProperties': False,
'patternProperties': {'^\\/': {'$ref': '#/definitions/PathItem'},
'^x-': {}},
'type': 'object'},
'Reference': {'patternProperties': {'^\\$ref$': {'format': 'uri-reference',
'type': 'string'}},
'required': ['$ref'],
'type': 'object'},
'RequestBody': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'content': {'additionalProperties': {'$ref': '#/definitions/MediaType'},
'type': 'object'},
'description': {'type': 'string'},
'required': {'default': False,
'type': 'boolean'}},
'required': ['content'],
'type': 'object'},
'Response': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'content': {'additionalProperties': {'$ref': '#/definitions/MediaType'},
'type': 'object'},
'description': {'type': 'string'},
'headers': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Header'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'links': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Link'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'}},
'required': ['description'],
'type': 'object'},
'Responses': {'additionalProperties': False,
'minProperties': 1,
'patternProperties': {'^[1-5](?:\\d{2}|XX)$': {'oneOf': [{'$ref': '#/definitions/Response'},
{'$ref': '#/definitions/Reference'}]},
'^x-': {}},
'properties': {'default': {'oneOf': [{'$ref': '#/definitions/Response'},
{'$ref': '#/definitions/Reference'}]}},
'type': 'object'},
'Schema': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'additionalProperties': {'default': True,
'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'},
{'type': 'boolean'}]},
'allOf': {'items': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'type': 'array'},
'anyOf': {'items': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'type': 'array'},
'default': {},
'deprecated': {'default': False,
'type': 'boolean'},
'description': {'type': 'string'},
'discriminator': {'$ref': '#/definitions/Discriminator'},
'enum': {'items': {},
'minItems': 1,
'type': 'array',
'uniqueItems': False},
'example': {},
'exclusiveMaximum': {'default': False,
'type': 'boolean'},
'exclusiveMinimum': {'default': False,
'type': 'boolean'},
'externalDocs': {'$ref': '#/definitions/ExternalDocumentation'},
'format': {'type': 'string'},
'items': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'maxItems': {'minimum': 0,
'type': 'integer'},
'maxLength': {'minimum': 0,
'type': 'integer'},
'maxProperties': {'minimum': 0,
'type': 'integer'},
'maximum': {'type': 'number'},
'minItems': {'default': 0,
'minimum': 0,
'type': 'integer'},
'minLength': {'default': 0,
'minimum': 0,
'type': 'integer'},
'minProperties': {'default': 0,
'minimum': 0,
'type': 'integer'},
'minimum': {'type': 'number'},
'multipleOf': {'exclusiveMinimum': True,
'minimum': 0,
'type': 'number'},
'not': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'nullable': {'default': False,
'type': 'boolean'},
'oneOf': {'items': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'type': 'array'},
'pattern': {'format': 'regex',
'type': 'string'},
'properties': {'additionalProperties': {'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]},
'type': 'object'},
'readOnly': {'default': False,
'type': 'boolean'},
'required': {'items': {'type': 'string'},
'minItems': 1,
'type': 'array',
'uniqueItems': True},
'title': {'type': 'string'},
'type': {'enum': ['array',
'boolean',
'integer',
'number',
'object',
'string'],
'type': 'string'},
'uniqueItems': {'default': False,
'type': 'boolean'},
'writeOnly': {'default': False,
'type': 'boolean'},
'xml': {'$ref': '#/definitions/XML'}},
'type': 'object'},
'SchemaXORContent': {'description': 'Schema and '
'content are '
'mutually '
'exclusive, at '
'least one is '
'required',
'not': {'required': ['schema',
'content']},
'oneOf': [{'required': ['schema']},
{'allOf': [{'not': {'required': ['style']}},
{'not': {'required': ['explode']}},
{'not': {'required': ['allowReserved']}},
{'not': {'required': ['example']}},
{'not': {'required': ['examples']}}],
'description': 'Some '
'properties '
'are '
'not '
'allowed '
'if '
'content '
'is '
'present',
'required': ['content']}]},
'SecurityRequirement': {'additionalProperties': {'items': {'type': 'string'},
'type': 'array'},
'type': 'object'},
'SecurityScheme': {'oneOf': [{'$ref': '#/definitions/APIKeySecurityScheme'},
{'$ref': '#/definitions/HTTPSecurityScheme'},
{'$ref': '#/definitions/OAuth2SecurityScheme'},
{'$ref': '#/definitions/OpenIdConnectSecurityScheme'}]},
'Server': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'url': {'type': 'string'},
'variables': {'additionalProperties': {'$ref': '#/definitions/ServerVariable'},
'type': 'object'}},
'required': ['url'],
'type': 'object'},
'ServerVariable': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'default': {'type': 'string'},
'description': {'type': 'string'},
'enum': {'items': {'type': 'string'},
'type': 'array'}},
'required': ['default'],
'type': 'object'},
'Tag': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'description': {'type': 'string'},
'externalDocs': {'$ref': '#/definitions/ExternalDocumentation'},
'name': {'type': 'string'}},
'required': ['name'],
'type': 'object'},
'XML': {'additionalProperties': False,
'patternProperties': {'^x-': {}},
'properties': {'attribute': {'default': False,
'type': 'boolean'},
'name': {'type': 'string'},
'namespace': {'format': 'uri',
'type': 'string'},
'prefix': {'type': 'string'},
'wrapped': {'default': False,
'type': 'boolean'}},
'type': 'object'}},
'description': 'Validation schema for OpenAPI Specification 3.0.X.',
'patternProperties': {'^x-': {}},
'properties': {'components': {'$ref': '#/definitions/Components'},
'externalDocs': {'$ref': '#/definitions/ExternalDocumentation'},
'info': {'$ref': '#/definitions/Info'},
'openapi': {'pattern': '^3\\.0\\.\\d(-.+)?$',
'type': 'string'},
'paths': {'$ref': '#/definitions/Paths'},
'security': {'items': {'$ref': '#/definitions/SecurityRequirement'},
'type': 'array'},
'servers': {'items': {'$ref': '#/definitions/Server'},
'type': 'array'},
'tags': {'items': {'$ref': '#/definitions/Tag'},
'type': 'array',
'uniqueItems': True}},
'required': ['openapi', 'info', 'paths'],
'title': 'A JSON Schema for OpenAPI 3.0.X.',
'type': 'object'}
On instance:
{'basePath': '/v1',
'consumes': ['application/json'],
'definitions': {'Error': {'properties': {'code': {'format': 'int32',
'type': 'integer'},
'message': {'type': 'string'}},
'required': ['code', 'message']},
'Pet': {'properties': {'id': {'format': 'int64',
'type': 'integer'},
'name': {'type': 'string'},
'tag': {'type': 'string'}},
'required': ['id', 'name']},
'Pets': {'items': {'$ref': '#/definitions/Pet'},
'type': 'array'}},
'host': 'petstore.swagger.io',
'info': {'license': {'name': 'MIT'},
'title': 'Swagger Petstore',
'version': '1.0.0'},
'paths': {'/pets': {'get': {'operationId': 'listPets',
'parameters': [{'description': 'How many '
'items to '
'return at '
'one time '
'(max 100)',
'format': 'int32',
'in': 'query',
'name': 'limit',
'required': False,
'type': 'integer'}],
'responses': {'200': {'description': 'A '
'paged '
'array '
'of '
'pets',
'headers': {'x-next': {'description': 'A '
'link '
'to '
'the '
'next '
'page '
'of '
'responses',
'type': 'string'}},
'schema': {'$ref': '#/definitions/Pets'}},
'default': {'description': 'unexpected '
'error',
'schema': {'$ref': '#/definitions/Error'}}},
'summary': 'List all pets',
'tags': ['pets']},
'post': {'operationId': 'createPets',
'responses': {'201': {'description': 'Null '
'response'},
'default': {'description': 'unexpected '
'error',
'schema': {'$ref': '#/definitions/Error'}}},
'summary': 'Create a pet',
'tags': ['pets']}},
'/pets/{petId}': {'get': {'operationId': 'showPetById',
'parameters': [{'description': 'The '
'id '
'of '
'the '
'pet '
'to '
'retrieve',
'in': 'path',
'name': 'petId',
'required': True,
'type': 'string'}],
'responses': {'200': {'description': 'Expected '
'response '
'to '
'a '
'valid '
'request',
'schema': {'$ref': '#/definitions/Pets'}},
'default': {'description': 'unexpected '
'error',
'schema': {'$ref': '#/definitions/Error'}}},
'summary': 'Info for a specific '
'pet',
'tags': ['pets']}}},
'produces': ['application/json'],
'schemes': ['http'],
'swagger': '2.0'}
.
.No such file: i_dont_exist.yaml
.OK
.
tests/integration/test_shortcuts.py ......
tests/integration/validation/test_exceptions.py .............F.
tests/integration/validation/test_validators.py .........
=================================== FAILURES ===================================
__ TestSpecValidatorIterErrors.test_parameter_custom_format_checker_not_found __
self = <test_exceptions.TestSpecValidatorIterErrors object at 0x7fcae9f59520>
validator_v30 = <Proxy at 0x7fcae9ff2c00 wrapping <openapi_spec_validator.validation.validators.SpecValidator object at 0x7fcaea3833a0...bHandler object at 0x7fcaea383a60>, 'file': <jsonschema_spec.handlers.urllib.UrllibHandler object at 0x7fcaea383c10>})>
def test_parameter_custom_format_checker_not_found(self, validator_v30):
spec = {
"openapi": "3.0.0",
"info": {
"title": "Test Api",
"version": "0.0.1",
},
"paths": {
"/test/": {
"get": {
"responses": {
"default": {
"description": "default response",
},
},
"parameters": [
{
"name": "param1",
"in": "query",
"schema": {
"type": "string",
"format": "custom",
"default": "customvalue",
},
},
],
},
},
},
}
errors = validator_v30.iter_errors(spec)
errors_list = list(errors)
> assert errors_list == []
E assert [<OpenAPIVali...t not found">] == []
E Left contains one more item: <OpenAPIValidationError: "Format checker for 'custom' format not found">
E Use -v to get more diff
errors = <generator object SpecValidator.iter_errors at 0x7fcae9ecd9e0>
errors_list = [<OpenAPIValidationError: "Format checker for 'custom' format not found">]
self = <test_exceptions.TestSpecValidatorIterErrors object at 0x7fcae9f59520>
spec = {'info': {'title': 'Test Api', 'version': '0.0.1'}, 'openapi': '3.0.0', 'paths': {'/test/': {'get': {'parameters': [{'in': 'query', 'name': 'param1', 'schema': {...}}], 'responses': {'default': {'description': 'default response'}}}}}}
validator_v30 = <Proxy at 0x7fcae9ff2c00 wrapping <openapi_spec_validator.validation.validators.SpecValidator object at 0x7fcaea3833a0...bHandler object at 0x7fcaea383a60>, 'file': <jsonschema_spec.handlers.urllib.UrllibHandler object at 0x7fcaea383c10>})>
tests/integration/validation/test_exceptions.py:457: AssertionError
- generated xml file: /home/tkloczko/rpmbuild/BUILD/openapi-spec-validator-0.5.4/reports/junit.xml -
=========================== short test summary info ============================
FAILED tests/integration/validation/test_exceptions.py::TestSpecValidatorIterErrors::test_parameter_custom_format_checker_not_found
================= 1 failed, 41 passed, 26 deselected in 0.49s ==================
usage: pytest [-h] [--errors {best-match,all}]
[--schema {2.0,3.0.0,3.1.0,detect}]
filename
pytest: error: argument --schema: invalid choice: 'x.x' (choose from '2.0', '3.0.0', '3.1.0', 'detect')
It's because of old openapi-schema-validator package