You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go-jsonschema: Failed: could not generate type for field "abilities": could not generate type for field "ability": could not follow $ref "/schema/v2/named_api_resource.json" to file "/schema/v2/named_api_resource.json": error resolving symlinks in : lstat /schema: no such file or directory
Possible Reason
And I think the reason is /schema/v2/named_api_resource.json was resolved as the absolute path to my file system:
Prerequisite
I have a bundle of json schema files on local file system as below:
In
schema/v2/pokemon/$id/index.json
, There is a$ref
to/schema/v2/pokemon/$id/index.json
:What did you expect to happen?
I want
/schema/v2/named_api_resource.json
can be correctly resolved to/path/to/base/dir/schema/v2/named_api_resource.json
.These schemas are downloaded from internet and I prefer not to modify these schemas.
What happened?
I tried to generate these schemas using command below:
go-jsonschema -p schema ./schema/v2/pokemon/\$id/index.json ./schema/v2/named_api_resource.json
And of course it failed, with follow message:
Possible Reason
And I think the reason is
/schema/v2/named_api_resource.json
was resolved as the absolute path to my file system:go-jsonschema/pkg/generator/generate.go
Lines 187 to 206 in fda3a01
Question
Is there any way to specify a root directory for reference resolution? If not, may I contribute to this feature?
The text was updated successfully, but these errors were encountered: