AdCombo / flask-combo-jsonapi

Flask REST JSON:API on steroids.
MIT License
32 stars 16 forks source link

Faulty way to get relationship schema #25

Closed mahenzon closed 3 years ago

mahenzon commented 4 years ago

This way to get schema works only if using apispec plugin - it resolves schema on start

https://github.com/AdCombo/flask-combo-jsonapi/blob/23a3ecf304cfba1d1fb23a4623a92d7beddcc95e/flask_combo_jsonapi/schema.py#L143

but __schema MAY and IS not resolved yet

It's resolved in Relationship.schema https://github.com/AdCombo/combojsonapi/blob/98162841423acf20414b52c96ec2dffdda9f7131/combojsonapi/utils/marshmallow_fields.py#L22

so this way it works:

def get_related_schema(schema, field):
    return schema._declared_fields[field].schema
mahenzon commented 3 years ago

fixed in #32, released in 1.0.4