python-openapi / openapi-spec-validator

OpenAPI Spec Validator is a CLI, pre-commit hook and python package that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger), OpenAPI 3.0 and OpenAPI 3.1 specification.
Apache License 2.0
322 stars 61 forks source link

legal regex doesn't validate #85

Open estimiriam opened 4 years ago

estimiriam commented 4 years ago

pattern: '^(?i)one|two|three$'

The regex does not validate. (?i) is the issue. It allows case-insensitive pattern match.

It causes this error in swagger-editor:

Structural error at components.schemas.Session.properties.operation.pattern should match format "regex" format: regex

influence160 commented 1 year ago

Hi,

I have the same problem with this

contract_id:
  in: header
  description: Identifiant 
  name: contract_id
  required: true
  schema:
    type: string
    pattern: (?i)^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
  example: 5DD440B2-197A-4AB7-B742-11CE25C9F2AB

result :

  Errors
  Hide

  Structural error at components.parameters.contract_id.schema.pattern
  should match format "regex"
  format: regex
  Jump to line 908