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 localization. The languages may vary, but english should always be provided.
The response would look like this in JSON:
{
id: "1234",
name: {
en: "english text",
de: "Deutscher Text"
}
}
My first try was looking like that, but I have no idea how to write the part for the name. AdditionalProperties seems to be a key, but I can't wrap my head around it. Also the requirement for english text is a mystery to me in this syntax and the example also does not seem to work as expected. It generates an empty $folded: in the UI.
delayReason:
type: object
properties:
id:
type: string
description: Identifier for a delay reason.
name:
type: object
additionalProperties:
type: string
required: [id, name]
example:
id: 123
name:
en: english text
de: Deutscher Text
There is also no clue in this that the result will have a language code as a key and the text as the value of the hash map.