core-api / python-openapi-codec

An OpenAPI codec for Core API.
Other
33 stars 35 forks source link

Support for verbose_name/label #49

Open danizen opened 6 years ago

danizen commented 6 years ago

OpenAPI supports a title attribute on a field/parameter, and this is used in react-jsonschema-form to build a form label based on a schema. I am able to use the schema generated from DRF using my own OpenAPIRenderer nearly identical to that in django-rest-swagger, but the generated OpenAPI schema is missing that title field, which will be important to achieving my objectives.

At the same time, the title/label is not represented in CoreAPI, but is returned by DRF in that packages rest_framework.metadata.SimpleMetadata.

This therefore seems related to the last comment of #41, where a user suggests going to the DRF serializer to fix the problem. This is surely a bit of a hack - it works for a default represented in coreapi, but if a title or label is not represented, then one has a problem.