-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Spectral doesn't seem to properly honor %YAML directive #481
Comments
Another approach (or maybe a first step) might be to warn the user:
|
Double-checked OAS 3.0 and yep:
We can get away with documenting that we only support YAML v1.1 and throw an error if directives are supported short term, but if we do this we need to add a new issue for supporting YAML 1.2 properly. This is up to you @P0lip, but lets do one of these two things in this hardening sprint. |
@philsturgeon @nulltoken What do you think? |
A working implementation can be found stoplightio/yaml#23 |
We only need to support a single YAML version especially because I’m sure there’s nothing in 1.1 which won’t work in 1.2. Your approach looks good to me. |
FWIW, merge keys aren't officially part of the YAML 1.2 spec. Would Spectral support them in YAML 1.2 documents would be a neat feature (Because of the ton of refactoring opportunities they offer) but should be documented in a clear and explicit manner as a freebie. Otherwise you might have to deal with issues such as "My supposedly valid Spectral YAML 1.2 docs refused to be parsed by Yaml library X or Y". |
@nulltoken |
@nulltoken yeah so merge tokens were not officially part of 1.1 either I don't think, they seemed to be an extension. I think we are moving from supporting "1.1 with merge tokens" to "1.2 with merge tokens" @P0lip could you add a note somewhere in docs about this as part of the fix, beyond bumping the stoplight/yaml library? |
Yeah, they are an extension . I'll leave a note on that somewhere in docs. |
@P0lip I know! And I'm so thankful for that <3
@philsturgeon Awesome! |
Describe the bug
YAML 1.2 spec recommends using the Core schema unless instructed otherwise.
This Core Schema doesn't specify any timestamp data type. As such, an unquoted value such as
2012-10-12
should be resolved as a string.Linting a openapi 3.0 spec described as a YAML 1.2 document makes the "valid-example" rule fail when the parsed implicit stringed example look like a date.
To Reproduce
random.1.2.openapi.yaml
Expected behavior
By default:
%YAML
directive (when defined) and using the spec recommended schema to parse it%YAML
directiveBonus features:
%YAML
directiveEnvironment (remove any that are not applicable):
@stoplight/spectral/4.0.2 win32-x64 node-v10.14.2
Additional context
You guys rock!
The text was updated successfully, but these errors were encountered: