cancel
Showing results for 
Search instead for 
Did you mean: 

Referencing Domain document from OpenAPI 3.0 document

SOLVED
New Contributor

Referencing Domain document from OpenAPI 3.0 document

Hi - I have a domain document at 

https://app.swaggerhub.com/domains/UPennISC/pennant_domain/1.0.0

With a 'definitions:' section and a 'commonResponesStatusStructure' structure.

 

I'm trying to reference it in my OpenAPI 3.0 document like this:

responses:
   '200':
     description: Response from the web service.
     content:
         application/json:
           schema:
             $ref:                    'https://app.swaggerhub.com/domains/UPennISC/pennant_domain/1.0.0#/definitions/commonResponesStatusSt...'

 

I get "Could not resolve reference: Could not resolve pointer: /definitions/commonResponesStatusStructure does not exist in document"

What am I doing wrong? This works fine for me in a 2.0 api document but I'm not sure how to make it work in 3.0.  I was told this should work.  Feel like I'm just missing one thing. I've tried to google my way to a solution and I can't find one.  Thanks - Tim

 

Here's a paste of the domain document (indenting was lost when pasted.)The domain document is valid.

 


info:
description: Reusuable pieces for other Pennant Web Services.
version: "1.0.0"
title: Pennant Domain

definitions:

# fields

# general return values, typcially included in responses
returnCode:
type: integer
format: int32
title: returnCode
description: Return information regarding web service call. 0 = Success, <> 0= Specific error code.
returnMessage:
type: string
title: returnMessage
description: Return message text.


# structures
commonResponesStatusStructure:
title: commonResponesStatusStructure
description: Common response 'status' structure.
required:
- returnCode
properties:
returnCode:
$ref: '#/definitions/returnCode'
returnMessage:
$ref: '#/definitions/returnMessage'

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

Re: Referencing Domain document from OpenAPI 3.0 document

Hi Tim,

 

You can refer to a domain structure  using the following syntax:

$ref: 'https://api.swaggerhub.com/domains/{ownerId}/{domainName}/{domainVersion}#/{componentType}/{componentName}'

Please see this documentation for details: https://app.swaggerhub.com/help/domains/referencing-domain

 

so, in your case, you should use   'https://api.swaggerhub.com/domains/UPennISC/pennant_domain/1.0.0#/definitions/commonResponesStatusSt...'

instead of

  'https://app.swaggerhub.com/domains/UPennISC/pennant_domain/1.0.0#/definitions/commonResponesStatusSt...'

 


Anastasia
Customer Care Team


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

2 REPLIES 2
Moderator

Re: Referencing Domain document from OpenAPI 3.0 document

Hi Tim,

 

You can refer to a domain structure  using the following syntax:

$ref: 'https://api.swaggerhub.com/domains/{ownerId}/{domainName}/{domainVersion}#/{componentType}/{componentName}'

Please see this documentation for details: https://app.swaggerhub.com/help/domains/referencing-domain

 

so, in your case, you should use   'https://api.swaggerhub.com/domains/UPennISC/pennant_domain/1.0.0#/definitions/commonResponesStatusSt...'

instead of

  'https://app.swaggerhub.com/domains/UPennISC/pennant_domain/1.0.0#/definitions/commonResponesStatusSt...'

 


Anastasia
Customer Care Team


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

New Contributor

Re: Referencing Domain document from OpenAPI 3.0 document

Ah - thank you.  I feel really stupid for missing that!

New Here?
Join us and watch the welcome video:
Top Kudoed Authors