Closed slowbackspace closed 8 months ago
okay, so the problem is in openapi schema used by fastify to serialize response. without the schema the response looks as expected.
schema:
{
"response":{
"200":{
"type":"array",
"items":{
"type":"object",
"properties":{
"tx_hash":{
"type":"string",
"description":"Transaction hash that contains the specific metadata"
},
"json_metadata":{
"additionalProperties":true,
"anyOf":[
{
"type":"string"
},
{
"type":"object",
"additionalProperties":true
},
{
"type":"array",
"items":{
}
},
{
"type":"integer"
},
{
"type":"number"
},
{
"type":"boolean"
}
],
"nullable":true,
"description":"Content of the JSON metadata"
}
},
"required":[
"tx_hash",
"json_metadata"
]
},
"example":[
{
"tx_hash":"257d75c8ddb0434e9b63e29ebb6241add2b835a307aa33aedba2effe09ed4ec8",
"json_metadata":{
"ADAUSD":[
{
"value":"0.10409800535729975",
"source":"ergoOracles"
}
]
}
},
{
"tx_hash":"e865f2cc01ca7381cf98dcdc4de07a5e8674b8ea16e6a18e3ed60c186fde2b9c",
"json_metadata":{
"ADAUSD":[
{
"value":"0.15409850555139935",
"source":"ergoOracles"
}
]
}
},
{
"tx_hash":"4237501da3cfdd53ade91e8911e764bd0699d88fd43b12f44a1f459b89bc91be",
"json_metadata":null
}
]
},
"400":{
"type":"object",
"properties":{
"status_code":{
"type":"integer",
"example":400
},
"error":{
"type":"string",
"example":"Bad Request"
},
"message":{
"type":"string",
"example":"Backend did not understand your request."
}
},
"required":[
"error",
"message",
"status_code"
]
},
"403":{
"type":"object",
"properties":{
"status_code":{
"type":"integer",
"example":403
},
"error":{
"type":"string",
"example":"Forbidden"
},
"message":{
"type":"string",
"example":"Invalid project token."
}
},
"required":[
"error",
"message",
"status_code"
]
},
"404":{
"type":"object",
"properties":{
"status_code":{
"type":"integer",
"example":404
},
"error":{
"type":"string",
"example":"Not Found"
},
"message":{
"type":"string",
"example":"The requested component has not been found."
}
},
"required":[
"error",
"message",
"status_code"
]
},
"418":{
"type":"object",
"properties":{
"status_code":{
"type":"integer",
"example":418
},
"error":{
"type":"string",
"example":"Requested Banned"
},
"message":{
"type":"string",
"example":"IP has been auto-banned for flooding."
}
},
"required":[
"error",
"message",
"status_code"
]
},
"429":{
"type":"object",
"properties":{
"status_code":{
"type":"integer",
"example":429
},
"error":{
"type":"string",
"example":"Project Over Limit"
},
"message":{
"type":"string",
"example":"Usage is over limit."
}
},
"required":[
"error",
"message",
"status_code"
]
},
"500":{
"type":"object",
"properties":{
"status_code":{
"type":"integer",
"example":500
},
"error":{
"type":"string",
"example":"Internal Server Error"
},
"message":{
"type":"string",
"example":"An unexpected response was received from the backend."
}
},
"required":[
"error",
"message",
"status_code"
]
}
},
"querystring":{
"type":"object",
"properties":{
"count":{
"type":"integer",
"minimum":1,
"maximum":100,
"default":100
},
"page":{
"type":"integer",
"minimum":1,
"maximum":21474836,
"default":1
},
"order":{
"type":"string",
"enum":[
"asc",
"desc"
],
"default":"asc"
}
}
},
"params":{
"type":"object",
"properties":{
"label":{
"type":"string"
}
}
}
}
eg. string and numbers are turned in weird object format instead of the original primitive type.
Simplest way to reproduce is to fetch
/metadata/txs/labels/2?count=1
on preprod.related and fixing this issue will probably close: https://github.com/blockfrost/blockfrost-backend-ryo/issues/152