Skip to content
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: YAML Validation does not support aliases between documents #3248

Open
Feldar99 opened this issue May 2, 2024 · 3 comments
Open

Bug: YAML Validation does not support aliases between documents #3248

Feldar99 opened this issue May 2, 2024 · 3 comments

Comments

@Feldar99
Copy link

Feldar99 commented May 2, 2024

What happened?

YAML files that contain anchors in one document which are referenced in further documents results in a validation error on https://archipelago.gg/check and a crash when used with the "Generate" option, but are valid YAML according to the official YAML linter https://www.yamllint.com/

I have attached an example file
ExampleYAML.zip

What were the expected results?

I would expect the file to pass validation on https://archipelago.gg/check and generate a multiworld with 2 games each of which picks from the same options

Software

Website

@eudaimonistic
Copy link
Contributor

I don't see this documented anywhere as an expected functionality. Why would this then be a bug?

I understand if this is a feature request, but this kind of aliasing is not explicitly supported.

@Feldar99
Copy link
Author

Feldar99 commented May 3, 2024

I'm having some trouble understanding the specification so I could be wrong, but the section about rejecting unidentified aliases says

"A well-formed character stream must match the BNF productions specified in the following chapters. Successful loading also requires that each alias shall refer to a previous node identified by the anchor. A YAML processor should reject ill-formed streams and unidentified aliases."

So it sounds like it's talking about the anchors existing in the stream not the document, and the section on streams says "A YAML stream consists of zero or more documents" This seems to be reinforced by it working in the official linter.

@nicholassaylor
Copy link
Contributor

Looking into this issue, what you want to do cannot be done with how YAML files are processed. The anchor cannot be aliased across document as documents are completely independent of each other. Therefore, any anchor must be aliased before the next ---. In your example YAML, you attempt to alias after the anchor has "expired".

I tried using your YAML on the linter that you linked to and it also failed to recognize the alias, but returned that it is valid. Deleting the anchor without deleting the alias also returns this as true, which it clearly shouldn't. The linter is only checking if it is in the right format and not if the data is valid or not. Therefore, the linter shows that it is correct while properly parsing the data on the website shows it as invalid since the anchor does not exist for the alias on your second player.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants