redoc icon indicating copy to clipboard operation
redoc copied to clipboard

Support propertyNames

Open GeorgEchterling opened this issue 7 months ago • 2 comments

Describe the problem to be solved I would like to use JSON Schema's propertyNames key to restrict the names of an object type's additionalProperties:

steps:
  type: object
  propertyNames:
    enum:
      - prop1
      - prop2
  additionalProperties:
    type: string

However, Redoc ignores propertyNames: Image

Describe the solution you'd like Redoc should use the propertyNames key when rendering the possible additional properties.

Describe alternatives you've considered Redoc already supports patternProperties, which I could use to restrict the supported properties. However, in my actual use case, the propertyNames references a shared enum definition. I would like to avoid the manual process of keeping both definitions in-sync.

Additional context The same example expressed using patternProperties: Image propertyNames could be displayed similarly, by putting the propertyNames type in the left column.

GeorgEchterling avatar Jun 17 '25 15:06 GeorgEchterling

this is dependent on the OAS version you are using.

OpenAPI 3.0.x does not support patternProperties or propertyNames as they are not supported by the OpenAPI Schema object. https://spec.openapis.org/oas/v3.0.4#json-schema-keywords

These are only supported if you are using OAS 3.1.x or later as the Schema Object now fully supports JSON Schema Draft 2020-12.

jeremyfiel avatar Jun 23 '25 15:06 jeremyfiel

Our schema uses OpenAPI 3.1.1

GeorgEchterling avatar Jun 24 '25 12:06 GeorgEchterling