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

Add an XML schema for documentation #35679

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Jan 29, 2020

master version of #59213.

This makes it easier to spot syntax errors when editing the class reference. The schema is referenced locally so validation can still work offline.

Tested with the vscode-xml Visual Studio Code add-on.

@Calinou Calinou added this to the 4.0 milestone Jan 29, 2020
@Calinou Calinou changed the title Add an XML schema for documentation [WIP] Add an XML schema for documentation Jan 29, 2020
@follower
Copy link
Contributor

PS: Is there a way to forbid an element from containing anything (even text)? This would be very nice to have for <argument> elements, as they can't have a description.

Based on a very cursory web search, It seems so, with a couple of variations:

Simplest option seems to be:

<xs:complexType/>

@aaronfranke aaronfranke marked this pull request as draft April 8, 2020 23:47
@Calinou Calinou changed the title [WIP] Add an XML schema for documentation Add an XML schema for documentation Jun 12, 2020
@Calinou Calinou force-pushed the doc-add-xml-schema branch from 3dfe235 to 05f3d5b Compare June 12, 2020 21:18
@Calinou Calinou marked this pull request as ready for review June 13, 2020 11:25
@Calinou Calinou marked this pull request as draft June 14, 2020 17:32
@Calinou Calinou marked this pull request as ready for review June 29, 2020 17:54
@Calinou Calinou force-pushed the doc-add-xml-schema branch from 05f3d5b to ae88586 Compare June 29, 2020 17:54
@Calinou
Copy link
Member Author

Calinou commented Jun 29, 2020

I updated the pull request to add the XML schema mention in the root tag when using --doctool.

@Calinou Calinou removed request for a team February 14, 2022 13:19
@fire
Copy link
Member

fire commented Feb 14, 2022

I support using existing xml tools to validate our xml variation. Xml validators allows tools to check our xml docs. We didn't need validators at first, but with the growth of Godot Engine scope and scale tool validators help.

@akien-mga
Copy link
Member

I don't see code added to DocTools to actually write the XML schema to the header in new files, how does it work?

@Calinou
Copy link
Member Author

Calinou commented Feb 14, 2022

I don't see code added to DocTools to actually write the XML schema to the header in new files, how does it work?

I forgot to readd that part while remaking this PR from scratch, and I no longer have the original code around 🙁

@akien-mga
Copy link
Member

akien-mga commented Feb 14, 2022

Some of your old commits referenced above in force push notifications haven't been GC'ed yet:

https://github.com/godotengine/godot/blob/f4dbc64abbf95f00f47e23ace284855a37004f29/editor/doc_data.cpp#L1068-L1073

Could use contains() instead of find() now.

@akien-mga
Copy link
Member

@Calinou
Copy link
Member Author

Calinou commented Feb 14, 2022

Some XMLs have the wrong path: godotengine/godot/runs/5187484781?check_suite_focus=true

Fixed. I suppose this happens because I ran --doctool with the Mono module disabled, and the fallback text server is disabled when the advanced text server is enabled.

@akien-mga
Copy link
Member

There's a style issue in the DocData changes.

@Calinou Calinou force-pushed the doc-add-xml-schema branch 2 times, most recently from f3ada17 to cdbb9af Compare February 14, 2022 22:25
This makes it easier to spot syntax errors when editing the
class reference. The schema is referenced locally so validation
can still work offline.

Each class XML's schema conformance is also checked on GitHub Actions.
@Calinou
Copy link
Member Author

Calinou commented Feb 14, 2022

We could make the CI output quieter by using xmllint's --quiet option, but this option isn't available in the version that ships with Ubuntu 18.04 🙁
Redirecting stdout to /dev/null doesn't suppress successful validation messages, as they go to stderr.

--quiet works with libxml 20912 from the Fedora 34 repositories. It suppresses messages for valid XML files while keeping messages for invalid XML files.

@akien-mga akien-mga merged commit 78a767e into godotengine:master Feb 15, 2022
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

7 participants