-
Notifications
You must be signed in to change notification settings - Fork 1.1k
lb4 openapi generator returns ResolverError when main spec contains schemas in subfolders #6963
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
Comments
@manchuwook, i believe you need to run it at the root of the LoopBack application. |
I have been running it from the root of the loopback app. I first started by trying to refer to the schema by absolute path, then relative to the project, then copied the schema into a folder called "model" None of these worked as intended. |
What's your node.js version and the |
Sure! lb4 --version
node --version
npm view @loopback/cli
|
Tested this with 2.19.0 - still have the same issue:
The file is present as S:\dev\project\api-design\models\character.schema.v1.json Note that I can get around this by bundling my API, but it creates a bunch of unnecessary/duplicated classes and muddies everything. |
I'm ending up building a yaml or json file using openapi-generator-cli and then generating controllers/models from that intermediary file instead. |
This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the |
Steps to reproduce
Created a default template OpenAPI spec using subfolders via Stoplight Studio
Current Behavior
command in models folder:
lb4 openapi --path ./models/openapi-spec.v1.json
Returns error:
Generation is aborted: ResolverError: Error opening file "c:\path\to\spec\models\subfolder-model.schema.v1.json"
ENOENT: no such file or directory, open 'c:\path\to\spec\models\subfolder-model.schema.v1.json'
Expected Behavior
I expect it to properly resolve relative links to the spec (not the src/root folder)
Link to reproduction sandbox
https://github.com/manchuwook/loopback-bug-subfolder for OpenAPI spec
The text was updated successfully, but these errors were encountered: