The openapi-typescript-validator works very well for single-file openapi-specs. Thanks for the cool tool! 👍
But: When I split the openapi-spec into multiple files as described in the openapi 3.0 spec with "$ref: my2ndFile.yaml" I receive an ENOENT error. This is becasue the generator is searching in the cwd of the node-process, which is "project_root/validator" and not relatively to the interface-file, that I hand over to generate-function of the openapi-typescript-validator.
As far as I understood the code, the root cause is, "DEFAULT_OPTIONS.cwd" of json-schema-to-typescript package is pointing to process.cwd(). It could have been overwritten when calling compile, but options are not set.
The openapi-typescript-validator works very well for single-file openapi-specs. Thanks for the cool tool! 👍
But: When I split the openapi-spec into multiple files as described in the openapi 3.0 spec with "$ref: my2ndFile.yaml" I receive an ENOENT error. This is becasue the generator is searching in the cwd of the node-process, which is "project_root/validator" and not relatively to the interface-file, that I hand over to generate-function of the openapi-typescript-validator.
As far as I understood the code, the root cause is, "DEFAULT_OPTIONS.cwd" of json-schema-to-typescript package is pointing to process.cwd(). It could have been overwritten when calling compile, but options are not set.
https://github.com/Q42/openapi-typescript-validator/blob/571cd8caffba08a0f84d7f8a220602b4a9a20497/src/generate/generate-models.ts#L14
The file structure in my project is as follows:
├── project_root │ ├── validator │ │ ├── generator.js │ ├── openApiSpec │ │ ├── interface.yaml │ │ ├── my2ndFile.yaml