Ask a Question

Using path parameters in domains

smatteoda
New Contributor

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?

5 REPLIES 5
mhiggins
Staff

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

smatteoda
New Contributor

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... 



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

smatteoda
New Contributor

Well, it seems to work, despite of the UI complaining about it...

 

smatteoda_0-1660312963922.png

 

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

cancel
Showing results for 
Search instead for 
Did you mean: