-
-
Notifications
You must be signed in to change notification settings - Fork 229
Closed
Description
Describe the bug
When using BasicAuth in my spec, express-openapi-validator fails with the following message:
Cannot read properties of undefined (reading 'undefined')
Validator settings as follows:
app.use(OpenApiValidator.middleware({
apiSpec: specYAML /* const, path to spec generated on runtime */,
validateRequests: {
coerceTypes: false,
allowUnknownQueryParameters: false,
removeAdditional: 'all'
},
validateResponses: {
coerceTypes: false,
removeAdditional: 'failing'
}
}));I'm using the following spec (cut for consistency):
openapi: 3.0.0
paths:
/auth:
get:
operationId: auth
description: Accepts credentials in HTTP Basic Auth and validates them. Will respond with HTTP status codes but no content.
parameters: []
responses:
'200':
description: The request has succeeded.
'401':
description: Access is unauthorized.
security:
- BasicAuth: []
securitySchemes:
BasicAuth:
type: http
scheme: basicUsing the same security scheme on any other route fails with the same message. Removing the security description from the spec "solves" the issue.
Metadata
Metadata
Assignees
Labels
No labels