swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

Swagger editor reports 'should match format "regex"'

Open AstenorOfAlembria opened this issue 2 months ago • 0 comments

Q&A (please complete the following information)

  • OS: Windows 11
  • Browser: Chrome
  • Version: 125.0.6422.176
  • Method of installation: N/A
  • Swagger-Editor version: Available release on the web
  • Swagger/OpenAPI version: 3.0.3

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.3 info: title: Real Estate API version: 1.0.0 paths: /realEstateSites: get: summary: Get Real Estate Sites operationId: getRealEstateSites responses: '200': description: OK content: application/json: schema: type: object properties: realEstateSite: type: object properties: timeZone: $ref: '#/components/schemas/TimeZone' components: schemas: TimeZone: description: Time zone as declared in the TZ database in the form "Area/Location". type: string minLength: 3 maxLength: 44 pattern: '^(?n)((?!Etc/GMT)[A-Z][A-Za-z_]{0,13}/[A-Z][A-Za-z_]{0,13})(/[A-Z][A-Za-z_]{0,13})?|(Etc/GMT[+-]\d{1,2})$' example: Europe/Paris

Describe the bug you're encountering

Swagger editor does not recognize the valid regex (checked with https://regex101.com/) provided as the 'pattern' of TimeZone

To reproduce...

As soon as I put the YAML in the Swagger editor, it reports

Structural error at components.schemas.TimeZone.pattern
should match format "regex"
format: regex
Jump to line 30

Expected behavior

No error

Screenshots

image

Additional context or thoughts

It seems the (?n) is not recognized On the web, I saw that the (?i) is not recognized either

(?n) match the remainder of the pattern with the following effective flags: gmn n modifier: no capture. All capturing groups () are instead treated as if they were non-capturing groups (?:). (?i) match the remainder of the pattern with the following effective flags: gmni i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z])

AstenorOfAlembria avatar Jun 28 '24 17:06 AstenorOfAlembria