karlvr/openapi-generator-plus

inputPath URL gets interpreted as a relative path

Closed this issue · 3 comments

taras commented

I'm writing a blog post on how to use openapi-generator-plus to generate a TypeScript client for use in Backstage projects. I encountered a bug that I couldn't find a test for.

When I use URL https://petstore.swagger.io/v2/swagger.json as inputPath, I get the following error.

➜  petstore-client git:(main) ✗ yarn generate
yarn run v1.22.17
$ openapi-generator-plus -c config.yml
Failed to generate: Error opening file "/Users/taras/Repositories/backstage-openapi-client-scaffolding/packages/petstore-client/https:/petstore.swagger.io/v2/swagger.json"
ENOENT: no such file or directory, open '/Users/taras/Repositories/backstage-openapi-client-scaffolding/packages/petstore-client/https:/petstore.swagger.io/v2/swagger.json'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Here is the complete config that I'm using,

# OpenAPI Generator Plus generator configuration
#
# The path (relative to this configuration file) or a URL for your API specification
inputPath: https://petstore.swagger.io/v2/swagger.json

# The path (relative to this configuration file) where the generated API should be output
outputPath: src

# The name of the generator template used
generator: "@openapi-generator-plus/typescript-fetch-client-generator2"

# See https://github.com/karlvr/openapi-generator-plus-generators/tree/master/packages/typescript-fetch-client#readme for more configuration options

I copied the contents of the file to the file system and it generated successfully.

@taras thank you, yes, it's stupid that this isn't supported. This is related to #2. Let me see if we can resolve this...

@taras please give version 1.1.0 a go.

taras commented

Yep. It works. Thank you!