Generated JSON schema from the support branch causes verification failures
The schema generated from the most recent support/3.0 branch generates numerous errors.
The shacl2code version is 0.0.23.
The generated schema is different from the schema file provided by @JPEWdev on slack (which does work) - perhaps a configuration issue in how shacl2code is run?
Attached is the generated schema:
There are 2 types of differences, the "spdxId" is replaced by "@id":
"type": "object",
"properties": {
- "spdxId": { "$ref": "#/$defs/IRI" },
+ "@id": { "$ref": "#/$defs/IRI" },
"type": { "type": "string" }
},
- "required": ["spdxId"]
+ "required": ["@id"]
},
and the extension classes are different.
The CI file which generates the schema is publish_v3.yaml.
The specific command is:
shacl2code generate \
--input spdx-spec/docs/rdf/spdx-model.ttl \
--input spdx-spec/docs/rdf/jsonld-annotations.ttl \
--context-url spdx-spec/docs/rdf/spdx-context.jsonld $CONTEXT_URL \
jsonschema \
--output spdx-spec/docs/rdf/schema.json
The differences are symptomatic of the jsonld-annotations.ttl file being ignored.
The file does look in place and there are no errors or warnings in the CI output.
This is cause by the prefix in the annotations not matching the actual model prefix: https://github.com/spdx/spdx-spec/blob/260e8d97fbedc573282c9bd095fab2e3d80b4b29/serialization/jsonld/annotations.ttl#L1C1-L1C42
It looks like the annotations have been updated to use "3.0" for the version, but the ttl files in this repo are still "3.0.1"?
Looks like an inconsistency between the spec parser and the ttl file.
I ran shacl2code locally with an updated context file and context URL parameter. It passed validation. It matched the previous schema file with only a difference in the extension:
},
+ "extension": {
+ "anyOf": [
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/$defs/prop_Element_extension"
+ }
+ }
+ ]
+ },
"externalIdentifier": {
"anyOf": [
{
@@ -658,6 +668,9 @@
"prop_Element_extension": {
"$ref": "#/$defs/extension_Extension_derived"
},
+ "prop_Element_extension": {
+ "$ref": "#/$defs/extension_Extension_derived"
+ },
"prop_Element_externalIdentifier": {
"$ref": "#/$defs/ExternalIdentifier_derived"
},
l am going to upload the schema file I generated locally to spdx.org/rdf/3.0.1/spdx-json-schema.json.
I'll leave the 3.0 version as is.
We can leave this issue open to track getting things back in sync once we produce a 3.0.2 release.