api-first-hand icon indicating copy to clipboard operation
api-first-hand copied to clipboard

Using allOf with cross_spec doesn't generate import in model

Open pocman opened this issue 8 years ago • 4 comments

Hi,

I have two models :

swagger: '2.0'
info:
  version: 1.0.0
paths:
definitions:
  entity:
    type: object
    properties:
      id:
        type: string
        format:  uuid
        example: "2ad91139-c3bc-420b-91a8-8aa9409aea07"
      created_at:
        type: string
        format: date-time
    required:
      - id
      - created_at

and

swagger: '2.0'
info:
  version: 1.0.0
paths:
definitions:
  point:
    allOf:
      - $ref: 'entity.yaml#/definitions/entity'

This generates two errors : target/scala-2.11/routes/main/model/point.yaml.scala:21: not found: type DateTime target/scala-2.11/routes/main/model/point.yaml.scala:21: not found: type UUID

As a fix, I'm adding this object to the definitions.

  import:
    description: This is only a fix for https://github.com/zalando/api-first-hand/issues/23
    type: object
    properties:
      uuid:
        type: string
        format:  uuid
      date_time:
        type: string
        format: date-time

pocman avatar Jul 28 '16 09:07 pocman

There is the same issue with polymorphism if the definitions are not in the .yaml defining the endpoints.

When using a Cat in a /path, you can have a "not found: type IPet" error. This is really blocking since, using the above workaround doesn't work :/

  import:
    type: object
    properties:
      pet:
        $ref: 'pet_definition.yaml#/definitions/Pet'

pocman avatar Aug 02 '16 12:08 pocman

Hey @slavaschmidt, does this require any additional action?

lasomethingsomething avatar Feb 07 '17 15:02 lasomethingsomething

@LappleApple yep, I think it's not in the master yet because of some other issues which are not fixed yet

slavaschmidt avatar Feb 07 '17 17:02 slavaschmidt

Thanks, @slavaschmidt :)

lasomethingsomething avatar Feb 07 '17 17:02 lasomethingsomething