Skip to content

inputPath URL gets interpreted as a relative path #34

@taras

Description

@taras

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions