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

Formalize YAML ModSpec approach #493

Open
ronaldtse opened this issue Jan 18, 2023 · 17 comments
Open

Formalize YAML ModSpec approach #493

ronaldtse opened this issue Jan 18, 2023 · 17 comments
Assignees
Labels
enhancement New feature or request

Comments

@ronaldtse
Copy link
Contributor

In OGC GeoPose, ISO 19115-3 and ISO 19135, we have implemented a Liquid template to convert ModSpect instances from YAML to presentation.

This involves 2 Liquid templates:

  • Requirements class + Provision / Requirement / Recommendation / Permission
  • Conformance class + Conformance test

We wish to formalize this approach for users (ModSpec users including OGC and ISO/TC 211) to use.

The implementation of this can be found here:

We will also need to update documentation on metanorma.org.

This would greatly assist our current work with the MUDDI SWG.

@ronaldtse ronaldtse added the enhancement New feature or request label Jan 18, 2023
@opoudjis
Copy link
Contributor

opoudjis commented Dec 4, 2023

Remains desirable, some editors really like this; but because it hasn't been documented or advertised, not clear if it has had adequate testing or usage to solidify it.

@opoudjis
Copy link
Contributor

opoudjis commented Feb 15, 2024

This is an interim YAML solution, which we can document, pending the machine readable modspec of #242

"Could write a blog post, and reference that"

@ghobona
Copy link

ghobona commented Feb 15, 2024

Discussed 2024-02-15

@opoudjis
Copy link
Contributor

@manuelfuenmayor Could you possibly write a blog post documenting the usage of YAML in modspec? If not, I'll do so, but you are more familiar with it than I am, I like to think :)

@opoudjis
Copy link
Contributor

I will investigate whether there are YAML schemas that we can exploit in this formalisation.

@opoudjis
Copy link
Contributor

opoudjis commented Mar 19, 2024

(Old) solutions are shown on https://json-schema-everywhere.github.io/yaml

https://www.npmjs.com/package/pajv

It's in Node, and it's an extension of the horrific JSON Schema validator ajv.

If this yields unacceptable obscure validation responses, or if we we can always convert the YAML to ruby hashes, and validate them programmatically.

There are Ruby implementations of other validators listed, not based on JSON-Schema: https://rx.codesimply.com/ and https://github.com/kvs/kwalify, but they are unmaintained. (Kwalify last updated in 2009, Rx in 2008!) In fact, even pajv was last updated in 2017: https://github.com/json-schema-everywhere/pajv/ . YAML validation is simply not a current concern to people.

There are more recent Node-based validators, of which some use JSON Schema and some do not:

There are also several Ruby validators more recent than Kwalify: https://rubygems.org/search?query=yaml+validator . OTOH, Kwalify has 28M downloads, and the next generic validator gem is 50K. Kwalify clearly remains popular.

And there are JSON-Schema validators natively in Ruby; they don't consume YAML natively, but a YAML to JSON transformation is trivial.

So we have several options for validation, and the choice depends on

  • Whether we want an externally defined formal schema (which really means JSON Schema)
  • Whether we want native Ruby support

It looks like the most popular Ruby-native JSON Schema validator, https://github.com/voxpupuli/json-schema/ , would work.

@ghobona
Copy link

ghobona commented Mar 19, 2024

So it's a choice between https://github.com/voxpupuli/json-schema/ and https://github.com/kvs/kwalify

The fact that kwalify is unmaintained rules it out, in my opinion.

@ronaldtse
Copy link
Contributor Author

@opoudjis we use JSON/YAML schemas for Glossarist already so we should continue the practice.

@opoudjis
Copy link
Contributor

Right, useful to know. OK, then it will be voxpupuli, when whoever it is defines the JSON Schema for Modspec.

@ronaldtse
Copy link
Contributor Author

FYI I've made a first cut here, serializable to YAML/JSON/XML schema:

@manuelfuenmayor
Copy link

manuelfuenmayor commented Apr 5, 2024

FYI I've made a first cut here, serializable to YAML/JSON/XML schema:

Hm, perhaps this affects the validity of the blog post I've written?

@ronaldtse
Copy link
Contributor Author

Hm, perhaps this affects the validity of the blog post I've written?

The post has been merged. Thanks!

@ronaldtse
Copy link
Contributor Author

The next to do is to create a Metanorma/LutaML plugin that uses the modspec gem. It already provides the JSON/YAML/XML Schemas.

@manuelfuenmayor manuelfuenmayor moved this from 👀 In review to ✅ Done in Metanorma Editorial Apr 8, 2024
@ghobona
Copy link

ghobona commented Apr 26, 2024

Adding the Blog posts's link for future reference.

https://www.metanorma.org/blog/2024-04-04-ogc-modspec-in-yaml/

@ronaldtse
Copy link
Contributor Author

The integration ticket is:

opoudjis added a commit to metanorma/isodoc that referenced this issue Sep 9, 2024
@opoudjis
Copy link
Contributor

Get Lutaml-Model to generate a schema for this.

@ronaldtse
Copy link
Contributor Author

This is the same functionality for #242 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🆕 New
Status: Done
Development

No branches or pull requests

4 participants