zalando / intellij-swagger

A plugin to help you easily edit Swagger and OpenAPI specification files inside IntelliJ IDEA
https://plugins.jetbrains.com/plugin/8347
MIT License
1.17k stars 74 forks source link

Unable to $ref using array index notation #256

Open GaryGSC opened 5 years ago

GaryGSC commented 5 years ago

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

semonte commented 5 years ago

Indeed, should be fixed. Thanks for reporting!

GaryGSC commented 4 years ago

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 commented 4 years ago

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.