Closed tscheburaschka closed 5 years ago
The error reported looks odd to me.
I would like to help but I would need 2 debugging prints. Could you print the vaule of raw_spec
and schema_path.as_uri()
?
I tried to reproduce your issue with no success and currently I have no access to a Windows machine.
schema_path.as_uri() :
'file:///D:/Jan/root/work/Projekte/windkraft/Code/gitWd/AnalyticsKernelPy/scripts/petstoreExample_20.yaml'
raw_spec :
{'swagger': '2.0',
'info': {'version': '1.0.0',
'title': 'Swagger Petstore',
'license': {'name': 'MIT'}},
'host': 'petstore.swagger.io',
'basePath': '/v1',
'schemes': ['http'],
'consumes': ['application/json'],
'produces': ['application/json'],
'paths': {'/pets': {'get': {'summary': 'List all pets',
'operationId': 'listPets',
'tags': ['pets'],
'parameters': [{'name': 'limit',
'in': 'query',
'description': 'How many items to return at one time (max 100)',
'required': False,
'type': 'integer',
'format': 'int32'}],
'responses': {'200': {'description': 'A paged array of pets',
'headers': {'x-next': {'type': 'string',
'description': 'A link to the next page of responses'}},
'schema': {'$ref': '#/definitions/Pets'}},
'default': {'description': 'unexpected error',
'schema': {'$ref': '#/definitions/Error'}}}},
'post': {'summary': 'Create a pet',
'operationId': 'createPets',
'tags': ['pets'],
'responses': {'201': {'description': 'Null response'},
'default': {'description': 'unexpected error',
'schema': {'$ref': '#/definitions/Error'}}}}},
'/pets/{petId}': {'get': {'summary': 'Info for a specific pet',
'operationId': 'showPetById',
'tags': ['pets'],
'parameters': [{'name': 'petId',
'in': 'path',
'required': True,
'description': 'The id of the pet to retrieve',
'type': 'string'}],
'responses': {'200': {'description': 'Expected response to a valid request',
'schema': {'$ref': '#/definitions/Pets'}},
'default': {'description': 'unexpected error',
'schema': {'$ref': '#/definitions/Error'}}}}}},
'definitions': {'Pet': {'required': ['id', 'name'],
'properties': {'id': {'type': 'integer', 'format': 'int64'},
'name': {'type': 'string'},
'tag': {'type': 'string'}}},
'Pets': {'type': 'array', 'items': {'$ref': '#/definitions/Pet'}},
'Error': {'required': ['code', 'message'],
'properties': {'code': {'type': 'integer', 'format': 'int32'},
'message': {'type': 'string'}}}}}
I borrowed a Windows VM from appveyor to provide some support 😄
I was not able to reproduce your issue, check https://gist.github.com/macisamuele/06ca2b90abd873423649aa81025449ae for more details.
If you still have issues my suggestions would be:
jsonschema[format]
is installed (pip
is not great in managing extra dependencies, https://github.com/pypa/pip/issues/3903 for more context)pip freeze
Thank you for your investigation. Unfortunately, neither can I now reproduce the bug. Maybe it was related to some hiccups in the PyCharm-debugger ... Sorry for having wasted your time. Now I am back at issue #310.
@tscheburaschka that's not wasted time. Don't worry 😄
Problem
I was trying to solve problem #310 and ran into the following issue.
Repro steps
The file petstoreExample.yaml is identical to the original example under: https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v2.0/yaml/petstore.yaml The file path to petstoreExample.yaml is D:/Jan/eight/more/subdirs/without/spaces/scripts/petstoreExample_20.yaml The code I executed was:
The last line fails with: