Extension Field Registry

x-jsonschema-propertyNames - A schema applied to property names in an object, used when targeting OpenAPI versions that do not directly support propertyNames.

JSON Schema draft-06 introduced the propertyNames keyword to define a schema that applies to property names in an object.

The x-jsonschema-propertyNames extension mirrors this JSON Schema keyword when targeting OpenAPI versions where the keyword is not directly available, serializing it as x-jsonschema-propertyNames.

Use this extension only with JSON Schema versions before draft-06; draft-06 and later define propertyNames directly.

It can appear as a property in the following objects: ["Schema Object"].

Used by: (informational)

Schema

{"$ref"=>"#/$defs/schemaObject"}

Example

openapi: 3.0.4
info:
  title: My API
  version: 1.0.0
paths: {}
components:
  schemas:
    Metadata:
      type: object
      additionalProperties:
        type: string
      x-jsonschema-propertyNames:
        pattern: "^[a-z_]+$"