Closed jamiehannaford closed 6 years ago
I think that's because your schemas do not have a valid $id
(I generate a Go API from ~20 files in my project). If the $id
s differ names you should not have conflicts with #
, but maybe I got it wrong.
Oh derp. You're completely right, thanks for the heads up!
You're welcome, I've had exactly the same problem in the past 😄
In the end setting my $id
s to "$id": "http://example.com/mytype.json"
was all I needed to change. Cross-references like "$ref": "mytype.json"
also work that way.
When you specify multiple input JSON files, only one generated file ever gets outputted. This is because root schemas have the same name of
#
which causes keys to be overriden here.So one workaround is to treat the generated structs per file and iterate over them for output. Let me know if there's a better way to fix this.