intellij-swagger icon indicating copy to clipboard operation
intellij-swagger copied to clipboard

Unable to $ref using array index notation

Open GaryGSC opened this issue 5 years ago • 3 comments

I have some JSON references using array index notation that are throwing inspection errors. I believe they should be valid according to RFC 6901, where #/foo/0 resolves to "bar".

Here's a minimal example that gives Can not resolve reference '#/x-values/0':

swagger: '2.0'
info:
  version: 1.0.0
  title: Example API
paths:
  /:
    get:
      responses:
        200:
          description: OK
          schema:
            type: string
            example:
              $ref: '#/x-values/0'
x-values:
  - first
  - second

Versions: WebStorm 2019.1 (build #WS-191.6183.63, from March 21, 2019) Swagger plugin v1.0.25

GaryGSC avatar Apr 02 '19 22:04 GaryGSC

Indeed, should be fixed. Thanks for reporting!

semonte avatar Apr 03 '19 09:04 semonte

I updated to v1.0.28, which isn't published on GitHub. (?)

Now I get a slightly different error message: Array doesn't contain element with index {0}

GaryGSC avatar Nov 06 '19 18:11 GaryGSC

Edit: I get some other error messages, too. They vary now.

A $ref to #/x-values/0/blah now says Property 'blah' not found when blah exists.

GaryGSC avatar Nov 06 '19 18:11 GaryGSC