OpenAPI-Specification
OpenAPI-Specification copied to clipboard
how to define the array with serial data
I'm try to define a oai spec for a rest api. but I don't know how to define the array with serial data response as followed
{
"status": 0,
"data": {
"type": "ticker.btcusdt",
"seq": 123,
"ticker": [
7140.890000000000000000,//latest
1.000000000000000000,//volumn
7131.330000000,//best bid
233.524600000,//best bid amount
7140.890000000,//best ask
225.495049866//best ask amount
]
}
}
{
"status":0,
"data":{
"type": "depth.ethbtc",
"ts": 1523611111000,
"seq": 456,
"bids": [0.000100000/*price*/, 1.000000000/*amount*/, 0.000010000/*price*/, 1.000000000/*amount*/],
"asks": [1.000000000/*price*/, 1.000000000/*amount*/]
}
}
how to define the ticker and bids/asks, thanks a lot
That's not a valid JSON, as JSON does not allow comments. Assuming the comments are not really part of the JSON, what have you tried so far?
That's not a valid JSON, as JSON does not allow comments. Assuming the comments are not really part of the JSON, what have you tried so far?
thanks @webron yes, the comments just describe the data meaning.
I tried to use these as followed
"OrderBook": {
"properties": {
"status": {
"format": "int64",
"type": "number"
},
"data": {
"default": {},
"$ref": "#/definitions/OrderBookL2"
}
}
},
"OrderBookL2": {
"properties": {
"type": {
"type": "string"
},
"ts": {
"format": "int64",
"type": "integer"
},
"seq": {
"format": "int64",
"type": "integer"
},
"bids": {
"type": "array",
"items": {
"format": "double",
"type": "number"
}
},
"asks": {
"type": "array",
"items": {
"format": "double",
"type": "number"
}
}
},
"required": ["symbol", "ts", "seq", "bids", "asks"],
"type": "object"
}
I don't know how to define asks and bids
It looks like you defined asks and bids fine, what makes you think that's not working?
It looks like you defined
asksandbidsfine, what makes you think that's not working?
yes, it work, but I want it have members which are price and amount in asks and bids
@webron could you help me, please
These look like floating point numbers, what is unusual about them that needs special handling?
This issue has been labeled with No recent activity because there has been no recent activity. It will be closed if no further activity occurs within 28 days. Please re-open this issue or open a new one after this delay if you need to.