-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
[BUG] payload of type date shows validation error #980
Comments
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request. |
Hi @sam0r040! The issue comes with the library we use for parsing YAML, which is js-yaml. The summary is that, whenever that parser finds a field that is not an explicit string (without quotes), it fallbacks to some schemas. The default one is called "Core" , and is supposed to be based on YAML spec, so whenever it finds a value with the format of As the first and quick solution, I encourage all those values to be enclosed with quotes. loadedObj = yaml.load(asyncapi, { schema: yaml.JSON_SCHEMA }); All tests are passing, but not 100% sure if adding that could break other documents, so not sure if this possible fix would become a breaking change 🤔 |
This bug gets fixed for both
Compiled directories used:
All tests both in Should I create PRs or might there be some hidden caveats? |
It is assumed that an update of a minor version is unlikely to break anything, so the change to |
stoplightio/spectral#2658 is merged. I hope this will help with @sam0r040's issue. |
The second step in fixing this bug is merging of PR #1042 |
The third and final step in fixing this bug is the merging of PR asyncapi/studio#1124. |
Validation of type |
Describe the bug.
AsyncAPI studio shows an error for data type date when YAML is used while data type datetime works fine.
Interestingly enough, if the date string is wrapped in double quotes, the validation error goes away.
Expected behavior
Validation passes for the provided yaml.
Screenshots
How to Reproduce
44:23 "date" property must match format "date"
🥦 Browser
None
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue ?
No, someone else can work on it
The text was updated successfully, but these errors were encountered: