Skip to content

"Format:" in responses causes failure #9

@mzbik

Description

@mzbik

If you have a response schema that looks like:

      responses:
        400:
          description: Failure, see body
          content:
            application/json:
              schema:
                type: string
        '200':
          description: Successfully returning document
          content:
            application/pdf:
              schema:
                type: string
                format: email # ERROR

This will throw an error (unknown format "email" ignored in schema at path "#") unless you specify strictSchema = false. It appears that compileResponseValidationSchema in validation.js creates a bare Ajv instance without adding in known formats. See what is done in @fastify/ajv-compiler or fast-json-stringify when creating Ajv instances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions