Gi60s / openapi-enforcer

Apache License 2.0
94 stars 22 forks source link

WSCH006: Detects issues where no issue exists #142

Closed sonnypersch closed 2 years ago

sonnypersch commented 2 years ago

Hi,

Assume the following attribute definition:

birthDate:
  type: string
  pattern: ^([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))$
  example: 1980-09-22
  description: Birth date of customer

The validator reports an example problem:

at: birthDate > example
  Example not valid. [WSCH006]
    Unable to deserialize value
      Expected a string. Received: 1980-09-22T00:00:00.000Z

The received value is unequal to the example value. It seems like the script parses the field as a date incl. timestamp.

Gi60s commented 2 years ago

Thank you for submitting the issue. I'll take a look at this.

Gi60s commented 2 years ago

I am unable to repeat the issue. Could you provide a more complete OpenAPI definition and an example of how you are using the enforcer in code when the error is produced?