rest-guide icon indicating copy to clipboard operation
rest-guide copied to clipboard

Enum values should be consistent with schema

Open pvdbosch opened this issue 1 year ago • 1 comments

OpenAPI allows enum values that are invalid to the rest of a schema, e.g. integer enum values for string types.

In OpenAPI such contradiction is allowed; the most restrictive constraint wins.

There may be some theoretical use case where the enum is defined in another subschema (e.g. combined with allOf) than the type, but we should at least avoid invalid enum values defined in the same inline schema.

pvdbosch avatar May 02 '24 07:05 pvdbosch

WG: OK to add that enum values should be valid wrt the schema in which they are defined. Can be added to [oas-enum]

pvdbosch avatar May 29 '24 12:05 pvdbosch