Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML References in other files throws warning #511

Open
slarti-b opened this issue Jul 15, 2019 · 0 comments
Open

YAML References in other files throws warning #511

slarti-b opened this issue Jul 15, 2019 · 0 comments

Comments

@slarti-b
Copy link

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: "[email protected]"
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: "[email protected]"
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

  • Repeat the definitions of the enum values in the foo parameter in bug-defs instead of using a YAML-reference (FooValues) OR
  • Move the definitions and parameters blocks into bug.yaml (but leave the YAML-reference as-is)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant