hapic
hapic copied to clipboard
Input Path and nested ref doesn't work together properly (key error 'type')
I tried to do something like this :
@hapic.with_api_doc()
@hapic.input_path(UserSchema(only=('user_id',)))
def user_workspace(self, context, request: TracimRequest, hapic_data=None):
pass
with :
class UserSchema(marshmallow.Schema):
user_id = marshmallow.fields.Int(dump_only=True)
email = marshmallow.fields.Email(required=True)
display_name = marshmallow.fields.String()
created = marshmallow.fields.DateTime(format='iso8601')
is_active = marshmallow.fields.Bool()
# TODO - G.M - 17-04-2018 - Restrict timezone values
timezone = marshmallow.fields.String()
# TODO - G.M - 17-04-2018 - check this, relative url allowed ?
caldav_url = marshmallow.fields.Url(
allow_none=True,
relative=True,
attribute='calendar_url'
)
avatar_url = marshmallow.fields.Url(allow_none=True)
profile = marshmallow.fields.Nested(
ProfileSchema,
many=False,
)
I get this error:
# TODO: look schema2parameters ?
jsonschema = schema2jsonschema(schema_class, spec=spec)
for name, schema in jsonschema.get('properties', {}).items():
method_operations.setdefault('parameters', []).append({
'in': 'path',
'name': name,
'required': name in jsonschema.get('required', []),
> 'type': schema['type']
})
E KeyError: 'type'
../hapic/hapic/doc.py:97: KeyError
Look like input path and input query should be fixed in order to deal with nested ref.