Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger editor reports 'should match format "regex"' #5171

Open
AstenorOfAlembria opened this issue Jun 28, 2024 · 0 comments
Open

Swagger editor reports 'should match format "regex"' #5171

AstenorOfAlembria opened this issue Jun 28, 2024 · 0 comments

Comments

@AstenorOfAlembria
Copy link

AstenorOfAlembria commented Jun 28, 2024

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])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant