Open analogue opened 9 years ago
Just ran into this issue. Any word on this?
For what it's worth, I attend the Python meet-ups at Yelp if I could help out with implementing this.
No one has requested or needed this feature yet. Feel free to submit a well unit tested PR.
Eek, that's a bit out of scope for my work (this is just a side project for me). I can try to help but my main goal is to just have a client library for Bitbucket:
+1 - if no one has volunteered I will give it a shot
@seanfarley you might try turning off models in the config something like so for the time being - it works for me.
From http://bravado.readthedocs.org/en/latest/quickstart.html
client = SwaggerClient.from_url(
'http://petstore.swagger.io/v2/swagger.json',
config={'use_models': False})
Well, the whole point of using this was to get models to work. For the time being, I won't have any time to work on this. Please feel free to pick it up.
@seanfarley take a look at my pull request #63 - hope that works for you. It works in the case I needed.
edit: for what it's worth, I opted to skip modeling the class hierarchy and chose instead to just flatten the attributes recursively into each type - to be honest I didn't really feel like going "super meta"
@seanfarley I also took a look at the bitbucket swagger specification and they use the "discriminator" property quite extensively ... I did not implement support for that though I could at a later time.
Cool, I'll try to take a look later :-)
:+1:
"/schedules": {
"get": {
"tags": [
"Schedules"
],
"description": "List the on-call schedules.",
"summary": "List schedules",
"parameters": [
{
"name": "query",
"in": "query",
"description": "Filters the result, showing only the schedules whose name matches the query.",
"type": "string"
}
],
"responses": {
"200": {
"description": "A paginated array of schedule objects.",
"schema": {
"allOf": [
{
"$ref": "#/definitions/Pagination"
},
{
"type": "object",
"properties": {
"schedules": {
"type": "array",
"items": {
"$ref": "#/definitions/Schedule"
}
}
},
"required": [
"schedules"
]
}
]
},
Is anyone continuing to look at this feature? I too am trying to use this for a side project and completely fixing this by going "full meta" is probably out of scope.
Any update on this? This is a major deviation from the Swagger and OpenAPI spec.
@advance512 We have support for allOf, just not in response objects. While this is regrettable it should not be too hard to implement, given that we have schema support for allOf. Patches are highly welcome.
@sjaensch - PR #135 has the code. However, no tests. Maybe I'll add some later if I have time..
Thanks for the pull request! This gets me closer to using bitbucket's swagger file but still throws an error:
from bravado.client import SwaggerClient
client = SwaggerClient.from_url('http://api.bitbucket.org/swagger.json')
repos = client.repositories.get_repositories_username(username='seanfarley')
repos.result()
Error:
Traceback (most recent call last):
File "test.py", line 4, in <module>
repos.result()
File "/Users/sean/.virtualenvs/b/lib/python2.7/site-packages/bravado/http_future.py", line 77, in result
self.response_callbacks)
File "/Users/sean/.virtualenvs/b/lib/python2.7/site-packages/bravado/http_future.py", line 115, in unmarshal_response
operation)
File "/Users/sean/sandbox/bravado-core/bravado_core/response.py", line 107, in unmarshal_response
validate_schema_object(op.swagger_spec, content_spec, content_value)
File "/Users/sean/sandbox/bravado-core/bravado_core/validate.py", line 39, in validate_schema_object
validate_object(swagger_spec, one_schema, value)
File "/Users/sean/sandbox/bravado-core/bravado_core/validate.py", line 82, in validate_object
resolver=swagger_spec.resolver).validate(value)
File "/Users/sean/.virtualenvs/b/lib/python2.7/site-packages/jsonschema/validators.py", line 123, in validate
raise error
jsonschema.exceptions.ValidationError: Additional properties are not allowed (u'branches', u'tags' were unexpected)
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#composition-and-inheritance-polymorphism