Open APIs

 View Only
  • 1.  Open API Extension patterns

    TM Forum Member
    Posted Jul 25, 2018 11:29
    Hi,
    I have a few problems with extending Open API model.
    Our data model is based on Information Framework (SID) data model with some extenstions, so that I have to add additional fields to Rest API.

    If I good understand TMF630_REST_API_Design_Guidelines_3.0_Part_2 _R17.5.1.pdf I need to add additional type which extends e.g. TMF Open API Customer.

    MyCustomer:
      title: MyCustomer
      type: object
      allOf:
        - $ref: "#/definitions/Customer"
        - properties:
          myProperties:
            type: string

    And after calling method GET /tmf-api/customerManagement/v3/customer/{id} I should return three additional fields like:
    "@type": "MyCustomer",
    "@baseType": "Customer",
    "@schemaLocation":"//server:port/resourceInventoryManagement/schema/MyCustomer.yml",

    Please correct me if I'm wrong.

    But how to create entities? Could you tell me if, it is a proper way to add a new endpoint for "MyCustomer" creation?
    e.g. POST /tmf-api/customerManagement/v3/myCustomer?

    Thank you in advance.

    ------------------------------
    Adam Augustyn
    Comarch S.A.
    ------------------------------


  • 2.  RE: Open API Extension patterns

    TM Forum Member
    Posted Jul 26, 2018 04:37
    Hi,

    My understanding is that to create an object that conforms to your new customer type you should use the same endpoint than for creating "regular" customers, but in that case you will explicitly pass the three @xxx fields in the POST request as well as any relevant property value (from the original set or the extended set of properties).
    For example:

    POST /tmf-api/customerManagement/v3/customer

    {
    "@type": "MyCustomer",
    "@baseType": "Customer",
    "@schemaLocation":"//server:port/resourceInventoryManagement/schema/MyCustomer.yml",
    "name" : "Brigitte Bardot",
    "myProperty": "blabla
    }

    A TMF implementation of the Customer API that supports the extensibility mechanism will be able to create the specific object
    using the information passed (@schemaLocation is used to check property validity and @baseType to check compliance with the Customer
    base class).

    Actually I do not know if there are implementations really supporting the extensibility mechanisms, but at least this is the intent. 

    Mariano​​​

    ------------------------------
    Mariano Belaunde
    Orange
    ------------------------------



  • 3.  RE: Open API Extension patterns

    TM Forum Member
    Posted Jul 30, 2018 06:49
    Hi Mariano,

    Thank you very much for your message.

    Best Regards,

    ------------------------------
    Adam Augustyn
    Comarch S.A.
    ------------------------------