kogosoftwarellc / open-api

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

openapi-request-validator not taking "format" specifier into account anymore since ajv upgrade #749

Closed rockebee closed 3 years ago

rockebee commented 3 years ago

Hi, I have observed that after upgrade of AJV dependency (cmp. issue #727 , MR #739 ) the request validator is not properly taking into account the format specifier in an OpenAPI specification (e. g.

"Some.Schema": {
  "type": "object",
  "properties": {
    "account_id": {
      "type": "string",
      "format": "uuid",
      "description": "An unique identifier for local account",
      "example": "13ac42d0-5a9d-4f48-a6c7-f4dbab3a5477"
    }
}

This is caused by the fact the AJV's format validation is now splitted into ajv-formats, but the now required call to addFormats function is missing although mentioned in the #727 checklist ...

Note: For openapi-schema-validator the addFormats have been properly added with MR #729

rockebee commented 3 years ago

@jsdevel, any chance to get linked PR merged in soon? With the formats not being checked anymore I kind of treat this as either a breaking change in release 9.x or a kind of high prio bug, assuming that people are upgrading their express-openapi dependency without explicitly checking this ... Let me know if there is anything more to be done/checked for the PR, looking forward.

asarver commented 3 years ago

+1, we just came across this as well

Envek commented 3 years ago

Faced this too. But I'm not using any wrappers — just bare openapi-request-validator and openapi-response-validator in AWS Lambda functions with some manual schema and request/response preprocessing.