Skip to content

[BUG] OpenApi 2 client generator - error parsing when refparameters not separated by slash #1067

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

Open
karismann opened this issue Mar 30, 2019 · 3 comments

Comments

@karismann
Copy link

karismann commented Mar 30, 2019

Description

In an openAPI 2.0 declaration, if you have two ref parameters not separated by "/" , the client generator send the error :

-attribute paths.'/v1/users/{firstparam}-{secondparam}'. Declared path parameter firstparam}-{secondparam needs to be defined as a path parameter in path or operation level

swagger parser version

2.0.11-OpenAPITools.org-1

OpenAPI declaration file content or url
"paths" : {
    "/v1/users/{firstparam}-{secondparam}" : {
      "get" : {
        "description" : "",
        "operationId" : "xxx",
        "produces" : [ "application/json" ],
        "parameters" : [ {
          "name" : "firstparam",
          "in" : "path",
          "required" : true,
          "type" : "string"
        }, {
          "name" : "secondparam",
          "in" : "path",
          "required" : true,
          "type" : "string"
        } ],

the OpenAPI declaration file has no error in swagger editor

@karismann karismann changed the title [BUG] OpenApi 2 client generator refparameters not separated by slash [BUG] OpenApi 2 client generator - error parsing when refparameters not separated by slash Mar 30, 2019
@macjohnny
Copy link

@karismann shouldn't the path be /v1/users/{firstparam}-{secondparam}?

@karismann
Copy link
Author

@karismann shouldn't the path be /v1/users/{firstparam}-{secondparam}?

you're right, that's a bad copy-paste, i fix my description, but the problem is still here ;-)

@mthebridge
Copy link

mthebridge commented Jun 5, 2019

I have also hit this with an OpenAPI v3 spec (using OpenAPI-tools-2.0.8-2), and it seems to be a regression caused by #928 - the check there that path parameters are defined assumes that the path parametrs form the whole of a URl segment.

For completeness: I was slightly unsure if this behaviour was meant to be valid according to the OpenAPI specification as the current spec is unclear - but OAI/OpenAPI-Specification#1950 suggests that this is valid, and so the parser ought to accept it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants