RepreZen / KaiZen-OpenAPI-Editor

Eclipse Editor for the Swagger-OpenAPI Description Language
Eclipse Public License 1.0
115 stars 13 forks source link

YAML References in other files throws warning #511

Open slarti-b opened 5 years ago

slarti-b commented 5 years ago

Just started using the Eclipse plugin and have one issue. We divide up the object definitions into one file and the actual API definitions into another. it seems to have an issue with enums using references in another file.

Suppose you define the following two files: bug-defs.yaml

swagger: '2.0'
info:
  title: Bug API
  description: Bug API
  license:
    name: Example License
    url: https://www.example.com
  version: '1.0'
  contact:
    name: "Example Support"
    url: "http://www.example.com"
    email: "support@example.com"
host: api.example.com
basePath: /
schemes:
  - https
produces:
  - application/json
  - application/xml
definitions:
  Foo:
    type: string
    enum: &FooValues
      - bar
      - baz
parameters:
  foo:
    name: foo
    in: path
    type: string
    enum: *FooValues
    required: true
paths: {}

bug.yaml

swagger: '2.0'
info:
  title: Bug API
  description: Bug API
  license:
    name: Example License
    url: https://www.example.com
  version: '1.0'
  contact:
    name: "Example Support"
    url: "http://www.example.com"
    email: "support@example.com"
host: api.example.com
basePath: /
schemes:
  - https
produces:
  - application/json
  - application/xml
paths:
  '/foo/{foo}':
    get:
      parameters:
        - $ref: './bug-defs.yaml#/parameters/foo'
      responses:
        '200':
          description: A Foo
          schema:
            $ref: './bug-defs.yaml#/definitions/Foo'

Then the parameter reference (- $ref: './bug-defs.yaml#/parameters/foo') shows a warning:

Invalid object reference, the referenced object is not of expected type. image

If I either

then I do not get the warning. The generated code seems to work, so why the warning?