Also see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#model-with-mapdictionary-properties.
Example:
spec = <<~YAML
openapi: 3.0.0
components:
schemas:
Object:
type: object
additionalProperties:
type: string
YAML
payload = {
"abc" => "123",
"def" => 456
}
schemas = OpenAPIParser.parse(
YAML.load(spec),
strict_reference_validation: true
).components.schemas
### This should raise an exception due to "def" not being a string. ###
OpenAPIParser::SchemaValidator.validate(
payload,
schemas["Object"],
OpenAPIParser::SchemaValidator::Options.new(coerce_value: false)
)
Thanks!