0

In JSON, I have an object for which the possible values of the keys are constrained to an enum:

{
   "res1" : { ... },
   "res2" : { ... },
   "res3" : { ... }
}

How do I represent in OAS3 that the key itself must be a member of the following enum?

    restriction-types:
      enum:
        - res1
        - res2
        - res3

I get the impression that this should be propertyNames from the json schema core definition: https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-10.3.2.4

The swagger 3.0 documentation says propertyNames is an unsupported keyword. Is this true for the OAS 3.0 specification? https://swagger.io/docs/specification/data-models/keywords

al.truisme
  • 450
  • 2
  • 11
  • Seems that it has been requested for OpenAPI 3.1: https://github.com/OpenAPITools/openapi-generator/issues/13096 – al.truisme Feb 08 '23 at 10:54

0 Answers0