Open magick93 opened 1 year ago
It's hard to know what the issue is from your description. This case is well-covered by tests, so is expected to work.
Can you comment with your directory structure (using bullets) and the contents of your schemas? A whittled down repro case would be best (ie. a single property per schema, with 2 files, should be enough to repro from the info you've shared so far).
@bcherny I've the same problem with wildcardas (tried both globbing in single quote or directly a folder name).
The error I get: CLI script seems to find files properly, but then resolve them in the wrong path:
I'm in /Users/keul/projects/MYPROJECT/stac-spec
, the I run…
json2ts -i '*-spec/json-schema/*.json' -o types/
[
{
stack: 'ResolverError: Error opening file "/Users/keul/projects/item-spec/json-schema/item.json" \n' +
"ENOENT: no such file or directory, open '/Users/keul/projects/item-spec/json-schema/item.json'\n" +
' at ReadFileContext.callback (/Users/keul/projects/hedp/jsonschema-to-ts/node_modules/@bcherny/json-schema-ref-parser/cjs/resolvers/file.js:96:32)\n' +
' at FSReqCallback.readFileAfterOpen [as oncomplete] (node:fs:325:13)',
code: 'ERESOLVER',
message: 'Error opening file "/Users/keul/projects/item-spec/json-schema/item.json" \n' +
"ENOENT: no such file or directory, open '/Users/keul/projects/item-spec/json-schema/item.json'",
source: '/Users/keul/projects/item-spec/json-schema/item.json',
path: null,
toJSON: [Function: toJSON],
ioErrorCode: 'ENOENT',
name: 'ResolverError',
footprint: 'null+/Users/keul/projects/item-spec/json-schema/item.json+ERESOLVER+Error opening file "/Users/keul/projects/item-spec/json-schema/item.json" \n' +
"ENOENT: no such file or directory, open '/Users/keul/projects/item-spec/json-schema/item.json'",
toString: [Function: toString]
}
]
One of the resolved file is /Users/keul/projects/item-spec/json-schema/item.json
. The file name is OK, but is missing some intermediate subfolders.
This should be easy to reproduce as I'm trying to generate TS interfaces for the STAC spec repo.
I'm trying to generate ts for several files, using the example in the readme:
However I'm only able to get output for a single specified
.json
file. For exampleat RateType.json | json2ts > RateType.d.ts
does generate.What I've tried
The following did not generate any output.