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

Fails to generate for Signal K, cannot generate referenced type. #173

Open
kmpm opened this issue Dec 3, 2023 · 1 comment
Open

Fails to generate for Signal K, cannot generate referenced type. #173

kmpm opened this issue Dec 3, 2023 · 1 comment

Comments

@kmpm
Copy link

kmpm commented Dec 3, 2023

Signal K has a JSON schema at https://github.com/SignalK/specification/tree/master/schemas which go-jsonschema fails to generate code for.

# when located in the `schemas` folder of the signal k specification
go-jsonschema -p signalk -o signalk.go -v signalk.json
go-jsonschema: Loading signalk.json
go-jsonschema: Failed: could not generate type for field "resources": cannot generate referenced type: value must point to definition within file: 'groups/resources.json#'

I'll gladly help out any way I can but I'll gladly get some pointers on where to start looking.

@kmpm kmpm changed the title Fails to generate for Signal K, cannot generate referenced typ. Fails to generate for Signal K, cannot generate referenced type. Dec 5, 2023
@omissis
Copy link
Owner

omissis commented Dec 5, 2023

hi @kmpm, thanks for reporting this. I tried building from main and running the tool, and I was able to reproduce the problem. There are two things causing this that might require some work: the first one being go-jsonschema is not able to handle #-terminated urls in refs, and the second one is that it does not handle the way array items are specified in one of the files. As a quick fix, you can remove all the # from the end of urls, and patch definitions.json#definitions/waypoint.feature.geometry.coordinates 's items to a supported format.
Two pics are worth two thousands words:
hashes
items

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

No branches or pull requests

2 participants