Enum descriptions

Describe each value of an enum with x-enumDescriptions. Without it, your API users only see the list of allowed values and have to guess what each one means.

Add the x-enumDescriptions property next to the enum keyword of any schema. It accepts a map where each key is an enum value and each value is its description. Each description is then displayed alongside its value in your documentation.

Example usage #

components:
  schemas:
    PaymentStatus:
      type: string
      enum:
        - pending
        - paid
        - refunded
      x-enumDescriptions:
        pending: The payment has been initiated but not yet confirmed.
        paid: The payment has been confirmed.
        refunded: The payment has been fully refunded to the customer.
Edit this page on GitHub