How do I refer domain responses, parameters and pathitems from a API?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do I refer domain responses, parameters and pathitems from a API?
Hi,
I am starting using domains in swaggerHub and I know yet how reference domains definitions (models) works, but I don't know how reference domain responses, parameters and pathitems and I don't find documentation for that cases. I am trying it using the domain example provided from SwaggerHub uncommenting the domain responses, parameters and pathitems examples
### Domains, a place to put your reusable components
### Examples...
info:
description: This is a sample Domain
version: '1.0.0'
title: Sample Domain
definitions:
ErrorModel:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
responses:
GeneralError:
description: General Error
schema:
$ref: '#/definitions/ErrorModel'
parameters:
skipParam:
name: skip
in: query
description: number of items to skip
type: integer
pathitems:
EntityOperations:
get:
description: Returns a pet based on ID
summary: Find pet by ID
responses:
default:
$ref: '#/responses/GeneralError'
Can anyone give a code example for everyone? Maybe autocompletion don't work for this cases. Any help?
Thanks a lot
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Domain components (schemas, parameters, etc.) are accesed via the $ref tag.
Type the $ref: in the correct place and then hit control-space
this will show you and auto-complete box for all the components that are available to put in that place, including all those in doamins.
Example:
paths:
/allbooks:
get:
description: Get all books
operationId: book-get-all
tags:
- Book
parameters:
- $ref: 'https://swaggerhub.mwhiggins.com/v1/domains/Global-Domains/global-components/1.0.0#/components/parameters/x-version'
- $ref: 'https://swaggerhub.mwhiggins.com/v1/domains/Global-Domains/global-components/1.0.0#/components/parameters/page'
- $ref: 'https://swaggerhub.mwhiggins.com/v1/domains/Global-Domains/global-components/1.0.0#/components/parameters/limit'
responses:
'200':
$ref: 'https://swaggerhub.mwhiggins.com/v1/domains/SmartBear_Org/book-components/1.0.0#/components/responses/allbooks'
'400':
$ref: '#/components/responses/BadRequest'
Micheál Higgins
Senior Solutions Architect
m: micheal.higgins@smartbear.com
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Micheál,
thanks for your quick response
I tried to make what it indicates but the editor shows me error messages in the cases of domain responses, parameters and pathitems, while for the model it works without errors.
And, for example, the editor documentation can't show "skipParam" well. But I have seen that despite the errors, the documentation that the API generates (external link) shows me correctly
Is there a way to make the editor not show the errors? Or can these errors cause a problem even though the generated documentation is fine? Maybe is a permissions problem (I am organization, API and domain owner)?
Thanks again
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If so please ask them to get a 30 minute call with me scheduled.
If not, then send me a zoom/Webex/teams invite for Monday at 16:00 Irish time.
--
Micheál Higgins
Senior Solutions Architect
SmartBear Software
Sent from my iPad
We hope you found this email of interest; however, click here if you wish to unsubscribe<> or manage your email preferences. Privacy Policy.<>
Disclaimer
The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.
Micheál Higgins
Senior Solutions Architect
m: micheal.higgins@smartbear.com
