Skip to content

ajv request body validation regression following an upgrade to @loopback/rest 15.0.3 #11096

Description

@fidgi

Describe the bug

Since after upgrading to @loopback/rest 15.0.3 , ajv request body validation fail when the schema contain the "discriminator" key word.

Logs

equest POST /accounts/7342217301273/actions failed with status code 500. Error: strict mode: unknown keyword: "discriminator"
    at checkStrictMode (/home/fidgi/my-app/node_modules/ajv/lib/compile/util.ts:211:28)
    at checkUnknownRules (/home/fidgi/my-app/node_modules/ajv/lib/compile/util.ts:27:22)
    at checkKeywords (/home/fidgi/my-app/node_modules/ajv/lib/compile/validate/index.ts:153:20)
    at validateFunctionCode (/home/fidgi/my-app/node_modules/ajv/lib/compile/validate/index.ts:40:5)
    at Ajv.compileSchema (/home/fidgi/my-app/node_modules/ajv/lib/compile/index.ts:163:25)
    at Ajv._compileSchemaEnv (/home/fidgi/my-app/node_modules/ajv/lib/core.ts:737:24)
    at Ajv.compile (/home/fidgi/my-app/node_modules/ajv/lib/core.ts:389:34)
    at createValidator (/home/fidgi/my-app/node_modules/@loopback/rest/src/validation/request-body.validator.ts:236:18)
    at validateValueAgainstSchema (/home/fidgi/my-app/node_modules/@loopback/rest/src/validation/request-body.validator.ts:153:16)
    at validateRequestBody (/home/fidgi/my-app/node_modules/@loopback/rest/src/validation/request-body.validator.ts:76:9)
    at buildOperationArguments (/home/fidgi/my-app/node_modules/@loopback/rest/src/parser.ts:92:28)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async MySequence.handle (/home/fidgi/my-app/src/sequence.ts:51:20)
    at async HttpHandler._handleRequest (/home/fidgi/my-app/node_modules/@loopback/rest/src/http-handler.ts:115:5)

Additional information

This seems to be related to this commit

Reproduction

n/a

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions