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

Proposal for schema #431

Closed

Conversation

johnnybubonic
Copy link

@johnnybubonic johnnybubonic commented Jul 15, 2020

Hey all! I'm composing some XSDs for GTG.

Why?

This, combined with the porting to LXML (#401) (LXML natively supports XSD), will let you do some REALLY nice things programmatically:

  • Automatic data validation/verification
  • Automatic structure validation/verification
  • Automatic population of default attributes
  • Address and enforce concerns in Better XML format [RFC] #279 as they're implemented
  • Very easy test cases for generated XML

Review

I'd like someone more familiar with the GTG guts to give it a look over. Please review and reference the items marked:

<!--
  TODO: ...
-->

for specific questions/concerns/suggestions I have.

Outer scope changes

The gtg_tasks.xml, etc. may need to have namespaces added.

e.g. for gtg_tasks.xml, instead of:

<?xml version="1.0" ?>
<project>
<!-- ... -->
</project>

it'd be:

<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="https://wiki.gnome.org/Apps/GTG?tasks"
         xsi:schemaLocation="http://SOMEDOMAIN.TLD/SOME/PATH/TO/tasks.xsd">
<!-- ... -->
</project>

This can be done programmatically, and I can provide code to convert existing documents over to the namespaced version.

Implementation

I can provide examples of how to automatically detect, parse, fetch, and validate XSDs (and strip the namespace once the data/structure is validated/verified and defaults are applied, so the elements don't need to be referenced by namespace) with lxml, as I have direct experience with lxml in python3 and the above.

@johnnybubonic
Copy link
Author

Also mentioning @diegogangl on this since I get the impression he's doing a lot of the LXML porting.

@johnnybubonic johnnybubonic marked this pull request as draft July 15, 2020 19:47
@diegogangl
Copy link
Contributor

While I really like the idea of having a schema, wouldn't it be better to wait for the new file format? We would end up doing this twice in the end.

@johnnybubonic
Copy link
Author

yep, it would definitely be better. heh whoops. :)

any suggestions for issues/PR #'s to watch besides #279 ? i can happily write the schemas (i kind of enjoy it, to be honest), all i need to know is structure and what types of data/valid strings to accept. i can probably pick/make the proper datatypes and container types etc. from there.

This was referenced Jul 16, 2020
@diegogangl
Copy link
Contributor

Sure, #169 will also include some changes to the xml to support repeatable tasks.

@johnnybubonic
Copy link
Author

Closed to switch branches.

@nekohayo nekohayo added maintainability Automated tests suite, tooling, refactoring, or anything that makes it easier for developers RFC "Request for Comments" brainstorming tickets for things we are unsure about labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement maintainability Automated tests suite, tooling, refactoring, or anything that makes it easier for developers priority:high Pull Request RFC "Request for Comments" brainstorming tickets for things we are unsure about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants