Swagger validation which was working fine on 12th Feb is now failing validation for type: string, when it contains an example date as value
See original GitHub issueExample Swagger/OpenAPI definition:
"DateOfDelivery": {
"example": "2019-09-26",
"type": "string"
},
Describe the bug you’re encountering
The above is part of my swagger spec, and is getting validated ok in editor.swagger.io
We have release pipelines configured. The task ‘API Management - Create or Update API’ is used in the azure devops portal to configure the web api. The task’s field ‘Definition Artifact’ is given the path of the swagger spec file.
The pipeline was running OK since November 2019 until around 12th Feb 2020. Since around 13th Feb we started to get validation errors when the pipeline runs.
Error:
2020-02-14T12:21:06.8150207Z Data and type mismatch found. [#/paths/~1order-product/post/responses/200/content/application~1json/schema/properties/DateOfDelivery/example]
@{code=ValidationError; target=representation; message=Parsing error(s): The input OpenAPI file is not valid for the OpenAPI specification https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md (schema https://github.com/OAI/OpenAPI-Specification/blob/master/schemas/v3.0/schema.yaml).}
Expected behavior
No errors
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Swagger validation which was working fine on 12th Feb is ...
Swagger validation which was working fine on 12th Feb is now failing validation for type: string, when it contains an example date as...
Read more >Swagger schema validation failed
trying to import a URL and got this error: ``` Swagger schema validation failed. ... Expected type array but found type object at ......
Read more >minLength/maxLength string tests assume the property is ...
This is an error in the validator because a minLength should not imply that the property is required; it indicates the minimum length...
Read more >Correctly determine if date string is a valid date in that format
I am currently using a regex to validate the string format, which works ok, but I can see some cases where it could...
Read more >API reference - Tink Docs
Welcome to the Tink API reference! The reference provides a detailed explanation of all resources that are accessible through the Tink API.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@VitaliyKurokhtin - can you give me more detail as to what caused the issue and how/when it got resolved please.
Hi, this is related to https://github.com/Azure/api-management-developer-portal/issues/294. We had the same problem with date-only examples like you have. The workaround is to have the type be a “date-time”. (this is wrong, but will allow your API to be imported).
The underlying bug is in Microsoft’s implementation of OpenApi reader, which has gone unfixed for a very long time.
microsoft/OpenAPI.NET#407 microsoft/OpenAPI.NET#420 <-- specifically about dates https://github.com/microsoft/OpenAPI.NET/issues/429