Swagger complex response model with dynamic key value hash maps

后端 未结 3 878
滥情空心
滥情空心 2020-12-14 08:17

I\'m struggling with the syntax of swagger to describe a response type. What I\'m trying to model is a hash map with dynamic keys and values. This is needed to allow a local

3条回答
  •  一整个雨季
    2020-12-14 09:04

    If you're still in the design stage, instead of using dynamic keys, you can push all the other language references in an array with structure like:

    {
    "launguage":"en"
    "text":"Hello World"
    }
    

    That would simplify things a lot, and since you're not relying on additionalProperties, your generated client libraries will find this easier to digest.

提交回复
热议问题