question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicate identifier for parameters with the same name but different location/in

See original GitHub issue

I am using an OpenAPI v3 spec generated by NSwag where the Parameters Object of one of the Operations has two parameters with the same name, but with different Locations (“in”: “query” vs. “in”: “path”)

According to the spec, this should be valid: “A unique parameter is defined by a combination of a name and location.”

When I generate code for this spec, the code has a typescript error “error TS2300: Duplicate identifier”.

...
    "/MyPath/{myParam}": {
      "get": {
        ...,
        "parameters": [
          {
            "name": "myParam",
            "in": "query",
            "schema": {
              "type": "string",
              "nullable": true
            },
            "x-position": 1
          },
          {
            "name": "myParam",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "x-position": 2
          }
        ],
...

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
ferdikoomencommented, Dec 16, 2020

Good point @jesperkristensen will schedule this for the next release

0reactions
akinneecommented, Sep 22, 2022

Seeing a similar issue here:

"impersonationUserId": {
      "name": "User-Id",
      "in": "header",
      "type": "string",
      "format": "uuid",
      "required": false,
      "description": "",
      "x-example": "User123"
    },

and:

"userId": {
      "name": "userId",
      "in": "path",
      "type": "string",
      "format": "uuid",
      "required": true,
      "description": "",
      "x-example": "User123"
    },

Both are output as userId on the options object because they have a similar “name” property. But one is in the header and one is in the path.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate identifier when declaring types with same name in ...
I have a simple TypeScript 'snippets' project, and I've run into an issue where multiple .ts files will have the same type names...
Read more >
Customizing the Duplication Identifier - Oracle Help Center
The duplicate's name must incorporate the name of the original, but you can replace (copy) with another duplicate identifier and change its location...
Read more >
How to find duplicates in Excel: identify, highlight, count, filter
The tutorial explains how to search for duplicates in Excel. You will learn a few formulas to identify duplicate values or find duplicate...
Read more >
Change page, section, figure, etc identifier avoiding duplicates
The anchor name page.<n> is used for several purposes; since you have several “page 1”, the only way seems to add the option ......
Read more >
Documentation - TypeScript 2.0
strictNullChecks switches to a new strict null checking mode. ... type) at any given location for a local variable or parameter that is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found