Open hoijui opened 2 years ago
Hey !
So i've made the file that you have linked in a format i've created and temporarily named okhdf
, because i wanted a file format to describe a form that:
~
prefix), mandatory fields (*
prefix), description (between <i am field description>
), default value (after the comma of type like made: bool, false
), value's units (noted with e.g. width: float (mm)
), lists (noted with [ ]
), enums (separated by |
) and help tip (inline comment)However, this yet-another-format is not okh specific, i designed it to be usable for any web form description, and already started to use it on another test page for okw. You can also check this test file which i used for front-end development.
The file is parsed by this python parser and generates without any other modification the form of this page. The goal was that it is easy to update the form by just pushing a modification to the okhdf file.
thanks pierre! :-)
I do like the compactness of the format, and apart from the ~
(which I still don't understand), I understood everything without explanation!
In practice though, I need a JSON schema. it would be good if your python script could generate that, because.. any other way of doing it we can not ensure the two formats contents stay consistent.
alternatively .. is there a sample YAML file that contains all the attributes? As from that, I could generate a JSON schema with a tool, which I just need to fixup here and there.
~
is for a field that exists but is hidden in the interface, used here for the OKH standard version and update date which is set to today
when someone creates or updates a manifest through the form.
You can find the pseudo-yaml standard here, not sure if it's up-to-date though as we're still organizing the work and platforms : https://app.standardsrepo.com/MakerNetAlliance/OpenKnowHow/src/branch/master/1#8abddfbb-8a84-4ca6-be02-0deeee654487
Thanks a lot Piere! :-)
with the info there, I put together the JSON schema for OKH v1.0.0, and am now able to validate OKH v1 YAML file structure, and to some degree also the content of the fields. I am already using it together with Mario Velis form appropedia to improve their data and OKH generation script.
I also made a JSON schema for our own OKH LOSH standard. It now contains pretty much all data you have in your form-definition file (okh.okhdf
) and the template file embedded in the link you just posted.
Apart from validating, these JSON Schemas also allow to generate sample files.
Where/in which repo should I make a pull request for adding the schema?
For now, for our own purposes, I hosted it here:
https://github.com/OPEN-NEXT/LOSH-OKH-tool/blob/master/src/okh-v1.schema.json
If we would register this on http://schemastore.org, It would automatically be available in editors and IDEs (like VSCodium, Atom and co.), and people editing their okh.yml
files would get editing hints and descriptions and such.
It would make more sense to host in in one of your repos, though.
I saw in an other issue, that @pciavald mentioned: https://git.iostud.io/makernet/iop-cdb/-/blob/dev/server/assets/okh.okhdf That is quite good! :-) Does it follow a more widely used standard of schemas? I imagine not, as it has a custom ending that looks OKH specific. Have you though about using http://json-schema.org? I read it can be used for YAML as well.
I am also thinking about using it for OKH LOSH-v1, which we are working on. Could make sense if we use the same thing, and as we use TOML files, which are also supported by JSON-schema .. it could make conversion more standardized/clear. (We are also working on conversion)