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

Question: Generating Schema #22

Open
goneall opened this issue Aug 23, 2024 · 4 comments · May be fixed by #24
Open

Question: Generating Schema #22

goneall opened this issue Aug 23, 2024 · 4 comments · May be fixed by #24

Comments

@goneall
Copy link

goneall commented Aug 23, 2024

I attempted to use the shal2code to generate a JSON Schema with the latest SPDX 3.0.1 model.

The output did not include any namespaces - is this an expected argument to shacl2code?

The URI's also don't look right - they look like they are missing the /'s.

The schema processor I'm using in Java also complained about missing def's for the classes. e.g.:

WARNING: No match for #/$defs/https_spdxorgrdf301termsCoreElement

Attached is the input and the output.

The command I used was:

 C:\Users\gary\git\shacl2code>shacl2code generate -i c:\Users\gary\Documents\Development\Temp2\spec-parser-output\
spdx-model.json-ld jsonschema -o c:\Users\gary\Documents\Development\Temp2\spec-parser-output\spdx-schema.json

spdx-model.json-ld.txt
spdx-schema.json.txt

@goneall
Copy link
Author

goneall commented Aug 23, 2024

It looks like my input file wasn't proper SHACL - I'll confirm and close if this resolves the issue.

Never mind - looks reasonably valid

@goneall
Copy link
Author

goneall commented Aug 29, 2024

I did a comparison against the schema file generated from the model repo, and it looks like it is just missing the @context references which is where the namespaces are defined.

I'll do some digging in the code to see if there is a parameter or something I missed.

@goneall
Copy link
Author

goneall commented Aug 29, 2024

Found the code requiring the context:

generate_parser.add_argument(

@goneall goneall linked a pull request Aug 29, 2024 that will close this issue
@JPEWdev
Copy link
Owner

JPEWdev commented Aug 29, 2024

Correct. --context can be used to reference a published context URL, --context-url can be used to reference a local context file as if it were at the specified URL (useful for locally developing before the context is published)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants