-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
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
Parameter Definitions #47
Comments
I was wrong in my initial conclusion, the error that was happening was this: tests/test_api.py F
================================================================================================================================================================================= FAILURES =================================================================================================================================================================================
___________________________________________________________________________________________________________________________________________________________________________ test_api_happy_path ____________________________________________________________________________________________________________________________________________________________________________
def test_api_happy_path():
# validator20.validate_spec_url("http://localhost:8080/swagger.json")
> client = SwaggerClient.from_url("http://localhost:8080/swagger.json")
tests/test_api.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
~/Code/.eggs/bravado-8.1.2-py3.5.egg/bravado/client.py:122: in from_url
return cls.from_spec(spec_dict, spec_url, http_client, config)
~/Code/.eggs/bravado-8.1.2-py3.5.egg/bravado/client.py:143: in from_spec
spec_dict, origin_url, http_client, config)
~/Code/.eggs/bravado_core-4.2.2-py3.5.egg/bravado_core/spec.py:152: in from_dict
spec.build()
~/Code/.eggs/bravado_core-4.2.2-py3.5.egg/bravado_core/spec.py:159: in build
http_handlers=build_http_handlers(self.http_client))
.virtualenv/lib/python3.5/site-packages/swagger_spec_validator/validator20.py:88: in validate_spec
validate_apis(apis, bound_deref)
.virtualenv/lib/python3.5/site-packages/swagger_spec_validator/validator20.py:152: in validate_apis
validate_duplicate_param(oper_params, deref)
.virtualenv/lib/python3.5/site-packages/swagger_spec_validator/validator20.py:207: in validate_duplicate_param
param = deref(param)
.virtualenv/lib/python3.5/site-packages/swagger_spec_validator/validator20.py:41: in deref
with resolver.resolving(ref) as target:
/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py:59: in __enter__
return next(self.gen)
.virtualenv/lib/python3.5/site-packages/jsonschema/validators.py:327: in resolving
url, resolved = self.resolve(ref)
.virtualenv/lib/python3.5/site-packages/jsonschema/validators.py:336: in resolve
return url, self._remote_cache(url)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <jsonschema.validators.RefResolver object at 0x10a6031d0>, url = ''
def resolve_from_url(self, url):
url, fragment = urldefrag(url)
try:
document = self.store[url]
except KeyError:
try:
document = self.resolve_remote(url)
except Exception as exc:
> raise RefResolutionError(exc)
E jsonschema.exceptions.RefResolutionError: unknown url type: ''
.virtualenv/lib/python3.5/site-packages/jsonschema/validators.py:346: RefResolutionError It appears that Swagger Spec Validator is modifying attributes on the spec without copying the spec. This can cause servers that are consuming the spec (like connexion) to have the swagger spec modified before giving it to the client. This was causing the parameter references to include |
Agreed that the validation process should not mutate the passed in |
That sounds like a plan to me! Let me know if there is anything else I can add to this |
The current swagger schema for v2.0 doesn't allow for a parameter to be defined as only a reference:
http://swagger.io/specification/#parameterObject
Taken from: https://github.com/OAI/OpenAPI-Specification/blob/master/fixtures/v2.0/json/resources/reusableParameters.json#L36
Only the bodyParameter allows you to specify the schema property (though still needs you to specify
name
andin
). While the nonBodyParameter does not support a mechanism for passing a schema.It seems like the
parameter
definition should support the schema definition.The text was updated successfully, but these errors were encountered: