1

Say my API, for performance reasons, sends what semantically should be a record, as an array in JSON.
So we have arrays with fixed number of items, each with their own name and type:

/candles/{id}

[
  [
    "BTC/USD",              // Pair
    1529798400000,          // Open time
    0.00014272,             // Open price
    0.00014298,             // High price
    0.00014249,             // Low price
    0.00014249,             // Close price
    54247.00000000,         // Volume
    1529799299999,          // Close time
    {                       // Taker volume
      base: 14870.00000000,   // buy base asset volume
      quote: 2.12351540       // buy quote asset volume
    },
    7.73785568,             // Quote asset volume
  ],
  ...
]

How would one describe this in an OpenAPI/Swagger Specification configuration file ? (for consumption by swagger-ui)

lleaff
  • 4,249
  • 17
  • 23
  • In terms of OpenAPI it's just an array of arrays of numbers. What did you try so far and where are you stuck? – Helen Jul 04 '18 at 19:12
  • @Helen Ok I edited my question to provide a more distinctive example with different types. Tell me if you get my problem. Basically, can one describe the elements of an array individually ? – lleaff Jul 04 '18 at 19:25
  • 1
    If it's a mixed-type array, see the ^^ linked question. Note that you can only define the element types (string, number, object), but you cannot define their order or individual descriptions for 1st, 2nd, 3rd etc. items. – Helen Jul 05 '18 at 10:45
  • Okay thanks. So I take it that my API can't be described with Openapi. Feel free to post an answer just saying that so I can accept it! – lleaff Jul 06 '18 at 15:38

0 Answers0