OpenAPI-Specification
OpenAPI-Specification copied to clipboard
Media type examples map pattern
Examples map keys defined in components must adhere to a pattern: '^[a-zA-Z0-9._-]+$'. (Source: https://github.com/OAI/OpenAPI-Specification/blob/main/schemas/v3.1/schema.yaml)
However, no such restrictions are defined on the examples map. This media type object seems allowed (but questionable if it was intended to be allowed):
openapi: 3.1.0
info:
title: Path examples is this a bad map?
version: error-case
paths:
/foo:
get:
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
examples:
My invalid example (because space and parentheses are not allowed):
value:
foo: bar
A_valid_example:
value:
baz: quz
None of the examples in the docs use any characters outside of the pattern allowed in the various component maps. Is this an oversight in the schema.yaml? Or is it truly intended to be allowed in the media type examples map but not in the components examples map?