$ref in parameters is not properly detected, and flagged as error
See original GitHub issueQ | A |
---|---|
Bug or feature request? | Bug |
Which Swagger/OpenAPI version? | 3.0 |
Which Swagger-Editor version? | 3.1.20 and 3.2.0 |
How did you install Swagger-Editor? | git clone + npm start |
Which broswer & version? | Chrome 63 |
Which operating system? | MacOS |
Demonstration API definition
openapi: 3.0.0
info:
title: DNSimple API
version: 2.0.0
contact:
name: DNSimple Support
email: support@dnsimple.com
url: 'https://dnsimple.com/contact'
description: >-
[DNSimple](https://dnsimple.com) provides DNS hosting and domain registration that is simple and friendly.
termsOfService: 'https://dnsimple.com/terms'
externalDocs:
url: 'https://developer.dnsimple.com'
servers:
- url: 'https://api.dnsimple.com/v2'
description: DNSimple Production API
variables: {}
paths:
'/{account}/domains':
summary: Operations on domain collections.
parameters:
- $ref: '#/components/parameters/Account'
get:
description: List domains in the account.
parameters:
- $ref: '#/components/parameters/Account'
operationId: listDomains
tags:
- domains
responses:
'200':
description: >-
Depending on how you are authenticated you will see all the accounts
you have access to or the account you used to authenticate.
components:
parameters:
Account:
name: account
in: path
required: true
description: The account id
schema:
type: integer
Domain:
name: domain
in: path
required: true
description: The domain name or id
schema:
type: string
Configuration (browser query string, constructor, config.yaml)
all default, no query string
Expected Behavior
There should be no validation error for the {account}
parameter.
Current Behavior

Semantic error at paths./{account}/domains
Declared path parameter "account" needs to be defined as a path parameter at either the path or operation level
Context
According to the specs, an item in the parameters
collection can be either a Parameter Object or Reference object.
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#fixed-fields-7
However, if we use the Parameter Object itself, it works:
parameters:
- name: account
in: path
required: true
description: The account id
schema:
type: integer
If we use a reference, it doesn’t:
parameters:
- $ref: '#/components/parameters/Account'
and instead a validation error is shown.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
ref and out parameters in C# and cannot be marked as variant
ref means "the callee may read or write the aliased variable, and it must be known to be assigned before the call. out...
Read more >Error Explanations for The W3C Markup Validation Service
An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling...
Read more >Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >GetParameter - AWS Systems Manager
Get information about a single parameter by specifying the parameter name. ... This flag is ignored for String and StringList parameter types. Type:...
Read more >SyntaxError: Malformed formal parameter - JavaScript | MDN
Admittedly the wording in the error message is slightly strange. "Formal parameter" is a fancy way of saying "function argument".
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @shockey! I confirm it works great now.
TNX for your reply! 👍 Apologies: I didn’t look at the releases yet, just looked here.