Search code examples
swaggerswagger-editoropenapi

What is the type for currency?


I can't find a sample of currency data type in the object definition, nor a document on the subject.


Solution

  • There is no built-in "currency" type. You would typically use type: number with an optional format modifier to indicate the meaning of the numeric type:

    type: number
    format: currency
    

    format can have arbitrary values, so you can use format: currency or format: decimal or whatever your tool supports. Tools that recognize the given format will map the value to the corresponding type.