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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Spec source from inputSpec is ignored #163

Closed
pfeileon opened this issue Dec 9, 2020 · 7 comments
Closed

[BUG] Spec source from inputSpec is ignored #163

pfeileon opened this issue Dec 9, 2020 · 7 comments
Assignees
Labels
bug Something isn't working released

Comments

@pfeileon
Copy link

pfeileon commented Dec 9, 2020

馃悰 Bug Report:

Describe the bug

Property inputSpec is ignored, which makes using remote specs impossible. According to the json schema this should be supported:

"inputSpec": {
          "type": "string",
          "description": "location of the OpenAPI spec, as URL or file (required if not loaded via config using -c)"
        },

https://github.com/OpenAPITools/openapi-generator-cli/blob/master/apps/generator-cli/src/config.schema.json

Expected behavior

Defining an HTTP URL to a remote spec via inputSpec should be possible.

Additional context

The method generate in generator.service.ts ignores the inputSpec property and only considers glob.

@pfeileon pfeileon added the bug Something isn't working label Dec 9, 2020
@kay-schecker
Copy link
Contributor

Thanks @pfeileon I鈥榣l have a look these days.

@pfeileon
Copy link
Author

pfeileon commented Dec 11, 2020

It seems to work with a local spec file (content is actually ignored) and a working URL:

"glob": "spec-file.json",
"inputSpec": "http://path.to/spec"

The CLI then downloads the spec from the URL and uses the value of "glob" as #{name}.

If this is intended, there is no bug, but the documentation is incomplete.

Only remaining problem is that if the URL doesn't work, the CLI breaks.

@ChristopherL-STCU
Copy link

Thanks for the research @pfeileon. Unfortunately I was not able to get that to work for me using 5.0.0-beta3, I imagine I do not have something quite right in my configuration. I'm not quite sure if inputSpec was supposed to include an actual file or only the directory. I tried both ways and could not get either to work.

"glob": "test.yaml"
"inputSpec": "https://example.com/specs/test.yaml"

@pfeileon
Copy link
Author

pfeileon commented Dec 17, 2020

It works with an endpoint which includes the spec's content in its response body.

@github-actions
Copy link

馃帀 This issue has been resolved in version 2.1.14 馃帀

The release is available on:

Your semantic-release bot 馃摝馃殌

@gabormagyar
Copy link

@kay-schecker config.schema.json still includes glob as a required property, so I still can't create a globless generator config unless I remove the schema or ignore the warning

@jmroon
Copy link

jmroon commented Oct 28, 2021

Same issue here. I just have to ignore the schema warning. Can we just update the schema to make glob OR inputSpec required?

"generator": {
      "type": "object",
      "required": [
        "output",
        "generatorName"
      ],
      "oneOf": [
        {
          "required": [
            "glob"
          ]
        },
        {
          "required": [
            "inputSpec"
          ]
        }
      ],

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

No branches or pull requests

5 participants