Forum Discussion

lnash94's avatar
lnash94
Occasional Contributor
2 years ago

Pattern property validation in swagger parser

Hi Team,

 

I'm using the Swagger parser for my tooling implementation, and I have a requirement for regex pattern validation since the Swagger specification supports ECMA flavor regex patterns. I would like to have some parser validation errors if we provide an invalid regex pattern to the OpenAPI specification.

ex:

```

openapi:

...

components:
schemas:
Person:
type: object
properties:
   name:
      type: string
      pattern: /(?<!or)ange/g

...

```

This given pattern is invalid in `/(?<!or)ange/g`  in ECMA https://regex101.com/r/jjIQfL/1/  , I'm unable to get those details from the current swagger parser.

Could you please let me know whether there is a way I can get this validation through the Swagger parser?

 

No RepliesBe the first to reply