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

World Conquest doesn't properly pass WML schema validation #6059

Open
Pentarctagon opened this issue Sep 2, 2021 · 6 comments
Open

World Conquest doesn't properly pass WML schema validation #6059

Pentarctagon opened this issue Sep 2, 2021 · 6 comments
Assignees
Labels
Bug Issues involving unexpected behavior. Schema

Comments

@Pentarctagon
Copy link
Member

Currently the EDITOR scenario created for WC is hidden from WML schema checks behind and #ifndef:

#ifndef SCHEMA_VALIDATION
{WC2_SCENARIO_NEW multiplayer WC_II {WC_II_CAMPAIGN_NAME_3P} 0}
#endif

however the WML schema should be properly updated so that this isn't needed. The issue is that when running the EDITOR validation, it errors saying that nplayers isn't a valid attribute to be present. I assume most likely this is caused by the editor using [multiplayer] rather than [scenario]. This editor specific WC scenario was added in 8daad7d.

@gfgtdf
Copy link
Contributor

gfgtdf commented Mar 21, 2023

The [generator] also contains the line nplayers={PLAYERS} twice

@CelticMinstrel
Copy link
Member

The double attribute is wrong but would not be the cause of a schema validation failure – the first instance of the attribute will be overwritten by the second before validation runs, I believe.

I think basically what is required is a schema entry for the WC map generator?

@gfgtdf
Copy link
Contributor

gfgtdf commented Mar 21, 2023

the first instance of the attribute will be overwritten by the second before validation runs, I believe

Here you said something different though:

24cf433

@CelticMinstrel
Copy link
Member

The two things are not related.

WML doesn't support having two attributes with the same name. If it happens anyway, one of them will be ignored at parse time. (I guess ideally that would be an error but I don't think it is.)

The linked commit notes that the order of attributes can make a difference to the schema validator. If attribute A is only valid when attribute B is present, then it will fail to validate if attribute A appears before attribute B but pass if attribute B appears before attribute A. (I guess this should be considered a bug in the schema validator, but I'm not really sure how to fix it.)

Making WC validate just means we need to add an if or switch to the schema definition of [generator] that contains any special keys supported by the WC map generator. Or alternatively, specify that any key is allowed.

@gfgtdf
Copy link
Contributor

gfgtdf commented Mar 22, 2023

The two things are not related. ... The linked commit notes that the order of attributes can make a difference to the schema validator

And this issue is about only the schema validator, or am i missing something ?

@CelticMinstrel
Copy link
Member

I think this issue would be about the schema, rather than the schema validator?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues involving unexpected behavior. Schema
Projects
Development

No branches or pull requests

4 participants