Using path parameters in domains
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using path parameters in domains
Hi, trying to use a path parameter in a Domain like:
States:
get:
tags:
- meta
summary: Get states by country
security:
- ApiKeyAuth: [ ]
operationId: getStatesByCountry
description: |
Get states by country
parameters:
- $ref: '#/components/parameters/IsoCodePathParam'
parameters:
IsoCodePathParam:
in: path
name: isoCode
required: true
description: Country ISO code
schema:
type: string
example: ES
Offers an error: Path parameter "isoCode" must have the corresponding {isoCode} segment in the "pathitems" path
Since in Domains, I can only have PathItems, like "States", and not paths.... how do I specify the segment?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Question 1: so is the API:
paths:
/some/new/path/{isoCode}
$ref: '........#/components/pathitems/States'
Question 2: is the parameter component defined as a domain reference or a local anchor ?
Micheál Higgins
Senior Solutions Architect
m: micheal.higgins@smartbear.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The parameter is defined in the domain as local anchor - $ref: '#/components/parameters/IsoCodePathParam' where States is defined.
The API would later be
paths:
/some/new/path/{isoCode}
$ref: '........#/components/pathitems/States'
But, I have not defined the API yet, just the domain... and it´s in the domain file I get the error.
I´m attaching my file for reference...
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I loaded you domain to my SwaggerHub organization.
Other than not being able to resolve your 401 refs i do not see any errors.
https://app.swaggerhub.com/domains/mhiggins-sa/Community-test/1.0.0
Micheál Higgins
Senior Solutions Architect
m: micheal.higgins@smartbear.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, it seems to work, despite of the UI complaining about it...
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
as i am not replicate the problem, i will leave it up to you to decide if you want to open a Support Ticket.
Micheál Higgins
Senior Solutions Architect
m: micheal.higgins@smartbear.com
