Skip to content

pattern ignored in top-level string schemas #73

@skonves

Description

@skonves

Given the following schema:

"schemas": {
  "objectId": {
    "type": "string",
    "pattern": "^[0-9a-fA-F]{24}$",
    "description": "MongoDB ObjectId string (24-character hex)"
  },
  "someType": {
    "allOf": [
      { "$ref": "#/components/schemas/objectId" }
    ],
    "description": "REDACTED",
    "nullable": true
  }
}

We get the error

warning openapi-3/invalid-schema: Property pattern is not allowed.
6198        “pattern”: “^[0-9a-fA-F]{24}$“,

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions