Karsten
3 years agoNew Contributor
Schema in Swagger Editor?
Hello everyone,
totally new to Swagger and I'm struggeling with creating a schema for an API response:
{"1236211": "0.9375959", "1174144": "0.8684537", "1236205": "0.8637224", "1213616": "0.8455657", "1172207": "0.80773705", "1212238": "0.79395837", "1174062": "0.79395837", "947023": "0.7878885", "947007": "0.7837074", "1172208": "0.78324217", "1174053": "0.77915275", "1172204": "0.7417756"}
How does a schema for a response like this look like?
I wish it was like
{{ "id": "1236211", "percentage": "0.9375959" }, { "id": "1174144", "percentage": "0.8684537" },...
But that would be too easy.
I hope you can help. Thanks in advance.
Howdy Karsten ,
Alas we all have to deal with odd APIs/Schemas 😄
For that you'd be best looking at https://swagger.io/docs/specification/data-models/dictionaries/. One thing to keep in mind, is that based on the JSON I see here, they are both "strings" not numbers.
Here is an example for you: https://app.swaggerhub.com/apis/plett/additional-properties/1.0.0#/default/get_name_your_fields