How would you define an object in OpenAPI 3.x when the keys can be any value, but always a specific format, with a similar requirement for values?
For example the following structure
keyValues: {"a": ["1", "2"], "b": ["3"]}
might be defined as
properties:
keyValues:
type: object
keys:
type: string
values:
type: array
items:
type: string
I was able to solve this using
additionalProperties
. Thestring
type of the object keys seems to be implicit since JSON only supports strings for keys.