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

Using allOf with cross_spec doesn't generate import in model #23

Open
pocman opened this issue Jul 28, 2016 · 4 comments
Open

Using allOf with cross_spec doesn't generate import in model #23

pocman opened this issue Jul 28, 2016 · 4 comments
Assignees

Comments

@pocman
Copy link
Contributor

pocman commented Jul 28, 2016

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
Copy link
Contributor Author

pocman commented Aug 2, 2016

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'

slavaschmidt added a commit that referenced this issue Nov 6, 2016
* Revert "Revert "#27, fix: WIP""

This reverts commit d8ca947.

* 19, refactor: Native json parsers, WIP

* #19, refactor: Working readables generator

* #19, refactor: Working readables in action

* #19, refactor: Working content negotiation

* #19, fix: Wrong structure in the case of absent validation

* WIP: Generated Readables and Writables

* WIP: missing anyval reads

* WIP: Feature-complete JSON reads/writes

* WIP: Tests for JSON

* Working scriped tests

* Working scriped tests

* Refactored DI in the controller

* #19, Test: Added unit test for failing parsing format

* Fixed broken date-time parser for headers and path

* #20, Test: Added test to check parsing of arrays of doulbe

* #29, Test: relaxed generated test in ragard to expected empty responses

* Test: Fixed broken test expectations

* Test: fix for travis script

* #23, fix: Missed imports in allOf

* FIX: allOf validations

* FIX: allOf validations

* FIX: Bug in type flattener leading to the situation where some essential classes got lost

* FIX: Error in enum parameter binding

* FIX: missing imports in test data generator

* FIX: missing imports in test data generator

* "#19_Parser_refactoring, FIX:"

" - #38: Wrong names of Enum members"
" - #38: Wrong type of Enum based results"

* Bumping version to 2.0 because introduced changes can potentially break existig clients

* #39, Bug: Disabling failing test until the next version
@lasomethingsomething
Copy link

Hey @slavaschmidt, does this require any additional action?

@slavaschmidt
Copy link
Collaborator

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

@lasomethingsomething
Copy link

Thanks, @slavaschmidt :)

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

No branches or pull requests

3 participants