Skip to content
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

Relative paths are treated differently in different commands #195

Open
ms14981 opened this issue Mar 31, 2023 · 1 comment
Open

Relative paths are treated differently in different commands #195

ms14981 opened this issue Mar 31, 2023 · 1 comment
Labels
bug Something isn't working high-priority

Comments

@ms14981
Copy link
Contributor

ms14981 commented Mar 31, 2023

Assuming a file path blah/forge/openapi-forge-javascript/package.json and blah/forge/openapi-forge/package.json with the following commands run from the blah/forge/openapi-forge directory.

$ ./src/index.js generator-options ../openapi-forge-javascript
$ ./src/index.js test-generators --generators openapi-forge-javascript

We are running the commands from the same location. The generator is installed in the same directory. But the generator-options command requires ../ whereas test-generators doesn't! See also #186

To complicate matters, if openapi-forge is installed globally, then the relative path is interpreted as relative to the location that the openapi-forge global package is installed, which would only work if the generator is also installed globally:

$ openapi-forge test-generators --generators openapi-forge-javascript
Starting tests for generator openapi-forge-javascript
cd: no such file or directory: C:/Users/<username>/AppData/Roaming/npm/node_modules/openapi-forge-javascript

TODO:

  1. Change the test-generators command to be consistent with the generator-options command.
  2. Fix relative paths for global call of openapi-forge.
  3. Update the documentation!
@ms14981 ms14981 mentioned this issue Mar 31, 2023
@ColinEberhardt ColinEberhardt added the bug Something isn't working label Apr 11, 2023
@ColinEberhardt ColinEberhardt mentioned this issue May 5, 2023
2 tasks
@ColinEberhardt
Copy link
Collaborator

One thing to note here, the test-generators command operates a little differently from the forge command.

With the test-generators command you specify which generators you would like to test, however, these are not installed via the 'resolver', instead they are expected to be available locally, and in the same folder as the forge.

This was originally done in order to simplify the relationship between the two. Previously generators had a dependency on openapi-forge which meant that they installed them (in an npm_modules) sub-folder, which resulted in a confused situation, whereby there was both a 'global' openapi-forge (which runs the test-generators command), and local copies for each generator.

Of course, the current situation, where the two commands perform differently isn't ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high-priority
Projects
None yet
Development

No branches or pull requests

2 participants