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.

Parameter name/key validation too strict (takes global parameters into account in local path inappropriately)

See original GitHub issue
Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 2.0
Which Swagger-Editor version? editor.swagger.io
How did you install Swagger-Editor? Using public version
Which browser & version? Chrome
Which operating system? Windows

Demonstration API definition

Taken from default “pet store” example, modified as follows… example problem yaml.txt

...
parameters:
  testParameter:
    name: mytest
    in: query
    required: true
    type: string
paths:
  /pet:
    post:
      tags:
      - "pet"
      summary: "Add a new pet to the store"
      description: ""
      operationId: "addPet"
      consumes:
      - "application/json"
      - "application/xml"
      produces:
      - "application/xml"
      - "application/json"
      parameters:
      - name: mytest
        in: query
        type: string
        required: true
...

Expected Behavior

Should not have any error because technically the parameter name/key (combo of name and in are unique to the specific path entry (/pet | post). The “conflicting” parameter is in the global parameter object named testParameter, however it does not even have to be referenced in any of the path methods for this faulty error message to come up.

Current Behavior

It complains about having duplicate parameter names for the mytest:in key with the error message:

Semantic error at paths./pet.post.parameters.0
Sibling parameters, whether inherited or direct, must have unique name + in values

It appears to have a global context for parameters and combines the parameter definitions from the global parameters field with the parameters field of individual path method definitions. This is in conflict with the specification that states:

Parameters

An object to hold parameters that can be used across operations. This property does not define global parameters for all operations.

It should only take into account parameters that are defined and/or referenced in each specific path/method definition.

Context

This bug is relatively new as I have been using the public editor for nearly 12 months with my schema that has global parameters with the same names as locally defined parameters and have never had this error message before now.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
shockeycommented, Jan 8, 2019

fixed, will ship on Friday!

thx @hsgreen @maiconmichelon @G-Rath @mminns for pointing out the flaw in this validator 🤜 🤛

1reaction
G-Rathcommented, Nov 27, 2018

@shockey I’m getting this as well when trying to use the bitbucket swagger definitions (found here - WARNING: It’s a large file!).

I’m using the Swagger editor found here.

Since I have no experience with Swagger, I’m not sure how to resolve this, but it seems to fit the pattern of this bug 😕

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve the "Parameter validation failed" error in AWS ...
When I create or update my AWS CloudFormation stack, I get the following error: "Parameter validation failed: parameter value 'abc' for ...
Read more >
Configure charts using globals - GitLab Docs
These global settings are used across several charts, while all other settings are scoped within their chart. See the Helm documentation on globals...
Read more >
HAProxy version 2.4.15 - Configuration Manual - GitHub Pages
This global directive loads and executes a Lua file into each started thread. Any global variable has a thread-local visibility so that each ......
Read more >
W3C XML Schema Definition Language (XSD) 1.1 Part 1
[Definition:] Validation is the process of determining whether an XML document, an element information item, or an attribute information item ...
Read more >
Global parameters - Azure Data Factory | Microsoft Learn
If a pipeline is referencing another resource such as a dataset or data flow, you can pass down the global parameter value via...
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