-
-
Notifications
You must be signed in to change notification settings - Fork 247
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
Path mangling when resolving references #335
Comments
Hey @nulltoken!
I spent a little investigating the first bug and I'm afraid it's caused by better-ajv-errors, a dependency we introduced in 4.x to improve the quality of our AJV validation messages. Regarding mangling - haven't verified that yet, but will try to do that as soon as possible and get back to you with more information on that. |
@nulltoken Unfortunately, I haven't had time to look into path mangling issue yet - been busy with the 4.x release lately, but will try to follow up on that as soon as possible. |
I believe that the path issues are something in ajv - ideally ajv does not need to do any resolving, since we already resolve via our own json-ref-resolver. Separately, @nulltoken I'm not sure portions of This: email_two:
description: Another mail address.
example: "one@local.com"
allOf:
- $ref: '../another_library.yaml#/definitions/other_email' Is basically the equivalent of this: email_two:
description: Another mail address.
example: "one@local.com"
$ref: '../another_library.yaml#/definitions/other_email' Which afaik is invalid, since draft 4 $ref's cannot have sibling properties. When this is dereferenced, it will end up as (clobbering the sibling description and example properties): email_two:
type: string
format: email But I might be mistaken - lmk :). |
@P0lip Works like a charm! Thanks a lot.
@marbemac You're completely correct (and I'm a complete idiot ;-) ). Btw, I've been bitten in the past more than I like to remember about this. Would there be a way for spectral to actually catch those patterns and well... warn about them? |
@nulltoken Let's absolutely make a rule for spotting $ref siblings. You are not the only person getting clobbered by this, I think we've been bitten a few times here ourselves! |
Ref siblings is over here #473 Path mangling has been solved elsewhere. I think we're good here. |
Describe the bug
Following #171 and the wonderful work in #245 (Thanks @marbemac !), here's another reference resolving relating issue.
To Reproduce
From a Windows platform, create the following tree structure
With the following content
repro/another_library.yaml
repro/nested/a_library.yaml
repro/nested/three.yaml
Then run the following commands
Expected behavior
This log message seems a bit weird:
The error messages seems to put under the light some kind of path mangling
Which, given the directory structure, should rather be
'C:\test\repo\repro\another_library.yaml'
Environment (remove any that are not applicable):
The text was updated successfully, but these errors were encountered: