3

What is the correct way to declare a 'char' in an OpenAPI/Swagger-file? I tried these.. but didn't work

myTestProperty:
    type: char
    example: C or B

I tired this way as well, but no luck

myTestProperty:
    type: string
    format: char
    example: C or B

The documentation does specifically mention about the char data type and can't find elsewhere as well.

Please suggest.

rakesh mehra
  • 618
  • 1
  • 9
  • 21

1 Answers1

4

There is no char data type in OpenAPI. The closest approximation would be a string that has a minLength and maxLength of 1.

exampleProperty:
  type: string
  minLength: 1
  maxLength: 1
Software2
  • 2,358
  • 1
  • 18
  • 28