kogosoftwarellc / open-api

A Monorepo of various packages to power OpenAPI in node
MIT License
892 stars 235 forks source link

openapi-request-validator: Make `parameters` arg optional #691

Closed dwrss closed 3 years ago

dwrss commented 3 years ago

For an openapi OperationObject, the parameters property is optional: https://github.com/kogosoftwarellc/open-api/blob/983a1c79e54e9bcef6eea43fe22615591c919aa1/packages/openapi-types/index.ts#L97 It would be useful for the equivalent parameter of the validator to be optional so that a valid operation can be easily passed to the validator.

jsdevel commented 3 years ago

can you add a test when it isn't given parameters?

dwrss commented 3 years ago

can you add a test when it isn't given parameters?

I believe this one already covers it?

jsdevel commented 3 years ago

@dwrss that has a request body though, won't that be considered a parameter?

dwrss commented 3 years ago

@dwrss that has a request body though, won't that be considered a parameter?

In OpenApi V3 requestBody and parameters are distinct keywords. They are also handled differently internally in this codebase.

This change is purely to make the Typescript definition match the implementation and the OpenApi spec.

I could write a test that passes no parameters and no request body but I'm not entirely sure that's useful?