Open APIs

 View Only
  • 1.  Extending the schema

    TM Forum Member
    Posted May 19, 2023 08:34

    I have a basic query, if i need to extend my structure with custom attributes, should i use "schema location" or i can directly attach a substructure.
    Also do i need to define a @type with schema location always?
    For example do i have to use "Schemalocation" array name in JSON structure or can use a name as "AccountExtension"

    • "id": "string",
    • "relatedParty": [
      ],
    • "accountType": "string",
    • "description": "string",
    • "LastName": null,
    • "state": "string",
    • "@schemaLocation": {



    ------------------------------
    Ashish Sharma
    Bharti Airtel Ltd
    ------------------------------


  • 2.  RE: Extending the schema

    TM Forum Member
    Posted May 21, 2023 06:10

                Hi Ashish
    I refer you to Part 2 of the Open API design guidelines TMF630 (https://projects.tmforum.org/wiki/display/PUB/TMF630+REST+API+Design+Guidelines+v4.2.0)
    Let's suppose that (as in your example) you are extending the Account entity and schema to create an AccountExtension class.
    In your payloads for AccountExtension
    * @type would the string "AccountExtension"
    * @baseType would be the string "Account"
    * @schemaLocation would be a URL that logically describes your extension, for instance it could point to a yaml or json schema file with property definitions for "Customattribute1" and "Customattribute2" together with an allOf for the base Account schema.
    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: Extending the schema

    Posted Mar 04, 2024 13:08

    What type of reference can I put in allOf. Local path, url...?



    ------------------------------
    Adnan Crnovrsanin
    Swiss Federal Office of Information Technology, Systems and Telecommunication
    ------------------------------



  • 4.  RE: Extending the schema

    TM Forum Member
    Posted yesterday

    Sorry for delay in answering this

    Since the Open API data model is not an officially published asset, you will not be able to refer directly to the raw schemas that are used in the Open API project.

    Presumably you could reference the #definitions section in a published API swagger 2.x file (or the equivalent OAS 3 section in v5 API publications) for the relevant API.

    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.
    ------------------------------