How to customize field representation in django drf AutoSchema?

Viewed 62

I am new to using Django drf schema generation. I installed and configured the schema according to the documentation. It generates the OpenAPI schema. Now I want to customize the choice field representation and add some description in front of each field. Current schema choice field is like below:

    condition:
          enum:
          - used
          - new
          - like new
          type: string
          nullable: true

I want the following:

    condition:
          enum:
          - used: "for used items"
          - new: "for new items"
          - like new: " brand new items"
          type: string
          nullable: true

In the documentation I could find little on how to customize the AutoSchema class but that was above my knowledge. I would be grateful if someone can help me on how can I override the schema methods to represent customize fields?

0 Answers
Related