Forum Discussion

paulyk1983's avatar
paulyk1983
New Contributor
6 years ago
Solved

Not able to reference a domain

I am a bit confused. Not sure if it is something I am doing wrong, or something wrong with SwaggerHub but I am having an issue referencing a domain.

 

Link to API: https://app.swaggerhub.com/apis/bosch/dx-developer-account-check/1.0#

Link to domain: https://app.swaggerhub.com/domains/bosch/DX-UserModel/1#/

 

I am unsure which URL I need to use to reference this domain in my API. In my domain, I have a user object within a definitions namespace. However, when I try to reference it using https://app.swaggerhub.com/domains/bosch/DX-UserModel/1#/definitions/User, I get a syntax error saying: "Could not resolve reference: Could not resolve pointer: /responses/User does not exist in document", even though I am able to access the domain using the Jump To popup.

 

I do not get this error when I remove the '#' from the URL (https://app.swaggerhub.com/domains/bosch/DX-UserModel/1/definitions/Use), but when I make a call, I am not seeing the the data in the UI responses section.

 

Which URL should I be using to reference the domain?

https://app.swaggerhub.com/domains/bosch/DX-UserModel/1#/definitions/User

or 

https://app.swaggerhub.com/domains/bosch/DX-UserModel/1/definitions/Use

 

And what else should I be doing to make this work?

 

 

 

 

 

  • Sometime, one character breaks everything. Took me a long time to figure it out as well.

     

    When referencing domains, make sure the beginning of the referenced URL is api.swaggerhub.com and not app.swaggerhub.com.

     

    So, in your case, the URL should be:

    https://api.swaggerhub.com/domains/bosch/DX-UserModel/1#/definitions/User

     

    The difference being giving the URL of the application, or giving the URL of the Domain itself. This is where our auto-complete feature comes in handy. It will automatically populate your reference options with relevant definitions, whether from the same file, or from Domains within your organization.

     

    You can find all sorts of useful keyboard shortcuts (including the auto-complete) at https://app.swaggerhub.com/help/ui/editor.

4 Replies

  • Generally speaking, the correct URL would be

    https://app.swaggerhub.com/domains/bosch/DX-UserModel/1#/definitions/User (that is, with the #). When using references, '#' is used to mark the root of the document as the starting point, and is used to separate the path to the document from the location inside the document. That's why local internal references always start with #.

     

    As for the error itself, since both your API and Domain are private, I can't take a look and see if there's some other potential issue.

    • paulyk1983's avatar
      paulyk1983
      New Contributor

      Hi Ron. Thanks for your quick response. I just now made it public so you can take a look.

      • RonRatovsky's avatar
        RonRatovsky
        Moderator

        Sometime, one character breaks everything. Took me a long time to figure it out as well.

         

        When referencing domains, make sure the beginning of the referenced URL is api.swaggerhub.com and not app.swaggerhub.com.

         

        So, in your case, the URL should be:

        https://api.swaggerhub.com/domains/bosch/DX-UserModel/1#/definitions/User

         

        The difference being giving the URL of the application, or giving the URL of the Domain itself. This is where our auto-complete feature comes in handy. It will automatically populate your reference options with relevant definitions, whether from the same file, or from Domains within your organization.

         

        You can find all sorts of useful keyboard shortcuts (including the auto-complete) at https://app.swaggerhub.com/help/ui/editor.