vitalik / django-ninja

💨 Fast, Async-ready, Openapi, type hints based framework for building APIs
https://django-ninja.dev
MIT License
7.02k stars 421 forks source link

Calculated fields are not visible in the schema #960

Open leiserfg opened 10 months ago

leiserfg commented 10 months ago

The schema of the models uses validation instead of serialization and that causes the computed fields not to be shown (see https://docs.pydantic.dev/latest/api/json_schema/#pydantic.json_schema.JsonSchemaMode).

aurbano commented 7 months ago

@vitalik is there a known workaround for this, or a plan to address?

I can try to send a PR if you point me in the direction of where to fix

vitalik commented 7 months ago

@aurbano sure - go ahead