When you use additionalPropertie you cannot define the set of accepted keys. But if my understanding is correct, two example of this hashmap as JSON could be:
JSON example 1:
{
"KEY_1": { ... },
"KEY_2": { ... },
"KEY_3": { ... }
}
JSON example 2:
{
"KEY_1": { ... },
"KEY_3": { ... }
}
This hashmap with a defined set of key is basically an object which contains optional (i.e. non required) properties of type object and therefore could be defined just like any other object:
type: object
properties:
KEY_1:
type: object
KEY_2:
type: object
KEY_3:
type: object
nb: it would be a good idea to use a $ref to avoid having to define the object for each KEY property:
type: object
properties:
KEY_1:
$ref: '#/definitions/TheObjectDefinition'
KEY_2:
$ref: '#/definitions/TheObjectDefinition'
KEY_3:
$ref: '#/definitions/TheObjectDefinition'