rest-guide
rest-guide copied to clipboard
Enum values should be consistent with schema
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.
WG: OK to add that enum values should be valid wrt the schema in which they are defined. Can be added to [oas-enum]