express-openapi-validator
express-openapi-validator copied to clipboard
Response validation incorrectly fails for `undefined` values for additionalProperties
Describe the bug
When using a schema that has additionalProperties set to some type, and when then returning an object that has an additional property set to undefined, the response validation fails. Instead, it should ignore the undefined values, because they will be filtered out when serializing the response to JSON.
To Reproduce Steps to reproduce the behavior.
- Create an OpenAPI spec that has some response with
additionalProperties: type: string - Activate response validation
- Return an object that has an additional property set to
undefined
Actual behavior
undefined values make validation of additionalProperties fail
Expected behavior
undefined values are ignored for validation additionalProperties in response validation