ebowman/api-first-hand

Using allOf with cross_spec doesn't generate import in model

pocman opened this issue · 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

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'

Hey @slavaschmidt, does this require any additional action?

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