KaiZen-OpenAPI-Editor icon indicating copy to clipboard operation
KaiZen-OpenAPI-Editor copied to clipboard

Validation: parameter declared in URI needs to be defined as a path parameter

Open tedepstein opened this issue 7 years ago • 1 comments

One of our users reported a problem shown in swagger-editor, but not reported in KZOE:

Semantic error at paths./offers/{offerId} Declared path parameter "offerId" needs to be defined as a path parameter at either the path or operation level

This is a case where the {offerId} parameter is declared as placeholder in the path item ./offers/{offerId}, but there is no corresponding definition in the path-level or operation-level parameters object.

KZOE should also detect and report this error.

tedepstein avatar Jan 31 '18 18:01 tedepstein

Specification references below.

Note: I don't see an explicit rule stating that each template variable in a path key has to have a corresponding path parameter definition. So maybe we should make this a warning instead of an error condition. Or configurable severity level, warning by default.

OpenAPI 2.0

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#user-content-fixed-fields-7

OpenAPI 3.0

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#user-content-fixed-fields-10

tedepstein avatar Jan 31 '18 18:01 tedepstein