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

Support absolute paths to generators in the forge command #171

Open
ms14981 opened this issue Feb 15, 2023 · 2 comments
Open

Support absolute paths to generators in the forge command #171

ms14981 opened this issue Feb 15, 2023 · 2 comments
Labels
bug Something isn't working high-priority

Comments

@ms14981
Copy link
Contributor

ms14981 commented Feb 15, 2023

Tried to run the following command (on Git Bash):

openapi-forge forge <schema> C:\dev\open-api-forge\openapi-forge-java-initial

It gives the error:

<path>\openapi-forge\src\common\generatorResolver.js:36
    throw new Error(
          ^

Error: Generator URL C:devopen-api-forgeopenapi-forge-java-initial does not end with ".git", check that the URL points to a valid generator

There are a couple of things to consider here:

  • Will it be ambiguous whether a given argument is a relative path, an absolute path or a URL?
  • Does the schema argument support absolute paths? If not, should it?
  • Do the other commands support absolute paths? If not, should they?
@gkocak-scottlogic
Copy link
Contributor

Absolute paths works fine on unix environments.

node src/index.js forge <schema> /home/X/repos/openapi-forge-java-initial/ -o ...

runs without issues.

About the windows side of things, my guess is fs.existsSync on windows native directories in git-bash doesn't get validated correctly maybe. For the git error part, the path is still validated as an URL which triggers that as a git repo automatically to be fetched with git.

@ms14981
Copy link
Contributor Author

ms14981 commented Feb 15, 2023

Testing the schema argument, looks like that doesn't work with absolute paths either:

openapi-forge forge C:/dev/open-api-forge/openapi-forge-java-initial/features/schema.json  https://github.com/ScottLogic/openapi-forge-typescript.git

We get this error (from node-fetch?): "Only absolute URLs are supported"

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

3 participants