question

Upvote
Accepted
16 1 1 3

Issue with swagger-codegen generated models

Issue:

Java domain classes generated using swagger-codegen don't extend their base classes.

Solution:

http://swagger.io/specification/ - please see "Composition and Inheritance (Polymorphism)" part.

Here's an example of required changes to thomson-reuters-world-check-one-api.v1.yaml file in order to fix NewCase model - which extends UpdateCase model - generation (please note that NewCase isn't the only model with the issue):

  #
  # Definitions for Case domain
  # ===========================
  #


  UpdateCase:
    type: object
    discriminator: updateCaseType # <---- new
    description: |
      Defines Case data that can be sent when updating a Case.
  
  # ... omitting some code here

  # ...
  # UpdateCase definition continued:

  required:
    - name
    - updateCaseType # <---- new
    - providerTypes
  properties:
  
  ...

P.S.: I'm not a Swagger expert, so there might be a reason why you have missing discriminator property, but changes above helped me to generate correct java classes.

world-checkapiworld-check-onescreeningswagger
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
3.1k 18 7 7

Hi @ruslann,

Thank you for contributing to the World-Check One Developer's Portal Q&A !!

Your feedback and experience is very helpful to all who read the Q&A forum.

I've submitted a ticket to our development team and will post any response if necessary or confirm the change to the YAML

Thanks again,

Brian

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.