openapi-generator: [BUG] Validation error: "There are duplicate parameter values"

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What’s the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What’s the actual output vs expected output?
Validating spec (bundle.oas3.yaml)
Errors:
        -attribute paths.'/anPath'(get).parameters.There are duplicate parameter values

[error] Spec has 1 errors.
Description

A wrong validation error when using external $ref

openapi-generator version

4.0.0-SNAPSHOT

OpenAPI declaration file content or url

reproducers.zip

Steps to reproduce

openapi-generator-cli validate -i bundle.oas3.yaml

Related issues/PRs

https://github.com/swagger-api/swagger-parser/issues/1063

Suggest a fix

https://github.com/swagger-api/swagger-parser/pull/1065

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 5
  • Comments: 15 (5 by maintainers)

Most upvoted comments

I’m still seeing this issue.

I have the following snippet which is generated as a bundle:

      parameters:
        - schema:
            type: string
          in: query
          name: portfolioId
          description: Unique identifier of the portfolio to filter by.
        - schema:
            type: string
          in: query
          name: reference
          description: Reference to filter by.
        - schema:
            type: string
            format: date
          in: query
          name: startDate
          description: Filter for deposits created on or after this date.
        - schema:
            type: string
            format: date
          in: query
          name: endDate
          description: Filter for deposits created on or before this date.
        - schema:
            type: string
          in: query
          name: status
          description: Deposit status to filter by.
        - $ref: '#/paths/~1models/get/parameters/2'
        - $ref: '#/paths/~1models/get/parameters/3'

Results in… -attribute paths.'/deposits'(get).parameters.There are duplicate parameter values

This is using the latest stable (5.1.0)

I have prepared PR https://github.com/OpenAPITools/openapi-generator/pull/2775 to update Swagger-Parser

I’ve confirmed that the validate function is no longer returning erroneous There are duplicate parameter values messages after https://github.com/OpenAPITools/openapi-generator/pull/2775. So https://github.com/swagger-api/swagger-parser/issues/1063 has now been fixed in openapi-generator. 🎉 I think this issue can be closed. Thanks for your help @jmini!

I have updated Swagger-Parser. Can you check the latest 4.0.0-SNAPSHOT version of OpenAPI Generator?