belgif / rest-guide

REST Guidelines of Belgian government institutions
https://www.belgif.be/specification/rest/api-guide/
Apache License 2.0
24 stars 4 forks source link

Enum values should be consistent with schema #184

Open pvdbosch opened 3 months ago

pvdbosch commented 3 months ago

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 commented 3 months ago

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