Open APIs

 View Only
  • 1.  Question about inheritance decision

    Posted Jul 28, 2023 13:09

    Hello,

    We are working with the TMF OpenAPI specification and we have some struggle when using a code generator with inheritance. Since the swagger does not specify the @type field as required, nor does specify a discriminator, we need to do some configuration to generate code using inheritance rather than combining the fields from the classes.

    Is anyone aware of the rationale behind the decision of not using discriminator in the TMF entities?



    ------------------------------
    Martin Brassard
    IBM Corporation
    ------------------------------


  • 2.  RE: Question about inheritance decision
    Best Answer

    Posted Jul 30, 2023 03:10

    Hi Martin

    In the Open APIs up to and including v4, we were using Swagger 2.x - and for various reasons (admittedly I'm not so familiar with the details) it wasn't feasible to make this part of the API definitions.

    In v5 APIs (first batch of APIs soon to be released) we have upgraded to OAS 3.x , including extensive use of oneOf, and @type is used as a discriminator for inheritance.

    Hope it helps



    ------------------------------
    Jonathan Goldberg
    Amdocs Management Limited
    Any opinions and statements made by me on this forum are purely personal, and do not necessarily reflect the position of the TM Forum or my employer.
    ------------------------------



  • 3.  RE: Question about inheritance decision

    Posted Jul 31, 2023 11:33

    Thanks @Jonathan Goldberg, it helps a lot as we were afraid doing it on existing contracts would break something unexpectedly. 

    We'll move ahead with our cusotmization while waiting for v5 release.



    ------------------------------
    Martin Brassard
    IBM Corporation
    ------------------------------



  • 4.  RE: Question about inheritance decision

    Posted Aug 01, 2023 02:10

    Please note - I forgot to mention that as a result of its use as a discriminator, @type is mandatory (i.e. a value must be populated) in all Open API entities in v5 APIs.



    ------------------------------
    Jonathan Goldberg
    Amdocs Management Limited
    Any opinions and statements made by me on this forum are purely personal, and do not necessarily reflect the position of the TM Forum or my employer.
    ------------------------------