swagger-api / swagger-api/swagger-parser

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

Open
#1,067 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the OpenAPI 2.0 paths declaration for /v1/users/{firstparam}-{secondparam} and parser version 2.0.11-OpenAPITools.org-1. Trace the path-parameter parsing and validation that produces the reported error; done means both adjacent path parameters are accepted when they are defined at operation level.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.