Forum Discussion

MeltingMosaic's avatar
MeltingMosaic
Occasional Contributor
9 years ago

Editor showing error, but jumping to the line doesn't seem to make sense

Hi, in my API:

https://app.swaggerhub.com/api/MeltingMosaic/BungieNetProxy/1.0.0

 

I'm seeing this error in the editor:

ptr must be a JSON Pointer

 

Clicking jump to line doesn't actually go anywhere there seems to be a problem.

 

Additionally, this API is showing up as Valid in the editor, but I cannot generate clients (or servers) for it. Nothing happens when I try.

 

Thanks!

  • Hello there!

     

    Well, this is a bit embarrassing. You've hit an edge case.

     

    The error itself is confusing and it's definitely pointing to the wrong line.

    However, fear not!

     

    I've forked your API and solved the issue(s), you can find it at https://app.swaggerhub.com/api/webron/BungieNetProxy/1.0.0.

     

    The problem was with two references, at lines 481 and 505. The reference is missing a slash after the #.

    So

    - $ref: "#parameters/BungieNetApiKey"

     

    should be

    - $ref: "#/parameters/BungieNetApiKey"

     

    Fix those two, and you're golden!

     

    We're working on some major changes to the editor that will help avoid this issues... This update is very close.

     

    On a slightly different subject - Bungie.net? :)

     

    Thanks,

    Ron

  • Hello there!

     

    Well, this is a bit embarrassing. You've hit an edge case.

     

    The error itself is confusing and it's definitely pointing to the wrong line.

    However, fear not!

     

    I've forked your API and solved the issue(s), you can find it at https://app.swaggerhub.com/api/webron/BungieNetProxy/1.0.0.

     

    The problem was with two references, at lines 481 and 505. The reference is missing a slash after the #.

    So

    - $ref: "#parameters/BungieNetApiKey"

     

    should be

    - $ref: "#/parameters/BungieNetApiKey"

     

    Fix those two, and you're golden!

     

    We're working on some major changes to the editor that will help avoid this issues... This update is very close.

     

    On a slightly different subject - Bungie.net? :)

     

    Thanks,

    Ron

    • MeltingMosaic's avatar
      MeltingMosaic
      Occasional Contributor

      Fantastic! Worked like a charm. 

       

      As for bungie.net, Bungie has a rather voluminous API for the game Destiny, and I'm working on adding Swagger definitions for the Destiny API (just for fun). The API has like 300 endpoints, so I'm just writing out the popular ones that other Destiny app developers might use, and learning Swagger at the same time.

       

      http://destinydevs.github.io/BungieNetPlatform/docs/Endpoints

      • RonRatovsky's avatar
        RonRatovsky
        Staff

        Interesting, maybe I'll check your work when it's done ;)

  • dunkc's avatar
    dunkc
    Occasional Contributor

    I seem to have a very similar error in

     

    https://app.swaggerhub.com/api/dunkc/hierarchy/1.0.0

     

    The error I'm getting infers a null reference "Unable to get property 'parameters' of undefined or null reference" but the 'jump to line' takes me to a seemingly random spot in the Swagger file.

     

    Maybe I've been staring at this too long but I can't actually see an invalid reference value either

    • In your case the issue is different - you mix YAML and JSON in your spec, which is technically valid, but it is not well indented and YAML is sensitive to that.

       

      The content directly under the `definitions`section needs to be modified. Take a look at https://app.swaggerhub.com/api/webron/hierarchy/1.0.0. Note that one you make the modifications, it will reveal other issues you'd need to fix.

      • dunkc's avatar
        dunkc
        Occasional Contributor

        Thanks for the quick response. I've been through the data definitions and indented them correctly but still have errors. When you say there's an error in the content directly under the 'definitions' section do you mean the first object i.e. the addressPhysical object? as I can't see what the problem with this is.

         

        The reason for the mix of YAML and JSON is that the data architects like to provide their input (i.e. the data defintions in JSON) whereas I prefer to define the API in YAML. It's a matter of taste, I could go through the JSON and change it to YAML, but it's a long winded job.