sigmf / SigMF

The Signal Metadata Format Specification
Creative Commons Attribution Share Alike 4.0 International
350 stars 75 forks source link

No Json Schema Definition #275

Open Nepomuceno opened 1 year ago

Nepomuceno commented 1 year ago

There is no Json Schema https://json-schema.org/ that we could use to validate a metadata file. in this repo we can find the file in the python repo. https://github.com/sigmf/sigmf-python/blob/main/sigmf/schema-meta.json

But even in the python repo it does have problems of not actually validating the input of the data.

The solution would be to create a json schema file that would encompass preferable all the core values but also the extensions if possible.

jacobagilbert commented 1 year ago

Validation is indeed an area we need help with.

Are there other problems with the schema besides not having extension fields in it?

Nepomuceno commented 1 year ago

Yes there are problem on data validation for the string and numerical fields for example the datatype does allow any string to be input and the same are true for the uint fields that do not limit the min anx max for all the scenartios.

I should have a PR adding those fix by the end of the day today... My idea was to put this PR in a spec folder in this repo but I am open to suggestions.

777arc commented 1 year ago

I think the lack of a maintained json schema has been a hole, and it should live within this repo, we'll just have to determine the cleanest way for the python package to get a copy of it (e.g. submodule this repo?).

Question- for the schema associated with each extension, is there a clean way to have them in separate files? I don't think it would be sustainable to have one large schema that includes the extensions.

jacobagilbert commented 1 year ago

To add to Marc's point on individual extension schemas, adding them to a monolithic schema is unappealing since it makes it harder for people to validate just what they care about, and more importantly to add their own schema files for their own extensions.

Nepomuceno commented 1 year ago

You can use $ref in order to extend JSON schemas that way if you were using extensions you could include the $ref and use all of those schemas and for someone developing their own schema they can use $ref with their own subschemas to include the properties they want

https://json-schema.org/understanding-json-schema/structuring.html