kogosoftwarellc / open-api

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

openapi-response-validator: Mark optional fields as optional in TypeScript types #701

Closed Envek closed 3 years ago

Envek commented 3 years ago

With given openapi-response-validator initialization:

new OpenAPIResponseValidator({
    responses: {…},
    components: {…},
});

I'm getting following error:

Argument of type '{ responses: any; components: any; }' is not assignable to parameter of type 'OpenAPIResponseValidatorArgs'.
Type '{ responses: any; components: any; }' is missing the following properties from type 'OpenAPIResponseValidatorArgs':
customFormats, definitions, externalSchemas, loggingKey

However, as these keys are marked as optional in readme, they should be marked as optional in types, I believe.

I'm not sure why tests in the repository aren't failing with this error, hence no changes in tests.

jsdevel commented 3 years ago

thank you!