Open APIs

 View Only
  • 1.  @ReferredType

    Posted Nov 17, 2019 15:26
    Dear Members,

    I came across the following description and JSON when I was going through the TMF629 Specification Document. Though I understand the @type (denotes sub-class) and @basetype (denotes super-class), I seem to be not getting the @referredtype even after going through the API Guidelines part 2 (section 5).  Please help me to understand the EntityRef pattern as I'm beginning to parse various components of the API. 

    The @referredType can be used within reference entities (like for instance an AccountRef object) to explicitly denote the actual entity type of the referred class. Notice that in reference entities the @type, when used, denotes the class type of the reference itself, such as BillingAccountRef or SettlementAccountRef, and not the class type of the referred object. However since reference classes are rarely sub-classed, @type is generally not useful in reference objects.

    "account": [
    {
    "@referredType": "BillingAccount",
    "description": "This account ...",
    "href": "https://host:port/tmf-api/accountManagement/v4/account/8251",
    "id": "8251",
    "name": "Travel Account"
    }
    ],
     ​​
    What would be the values for @type, @basetype, and @schemalocation for "account" object in this instance?

    Thank you,
    Madhan
    ​​​​

    ------------------------------
    Madhan Ram
    Enterprise Architect
    ------------------------------


  • 2.  RE: @ReferredType

    TM Forum Member
    Posted Nov 18, 2019 02:56
    Hi Madhan

    Please consult the Design Guidelines at https://projects.tmforum.org/wiki/display/PUB/TMF630+API+Design+Guidelines+3.0+R17.5.1 . Part 2 gives some coverage of this topic.

    In the example that you quote, presumably the account attribute is defined as AccountRef in the containing spec - and it is actually pointing to the BillingAccount subclass. It is rare that someone would want to extend a Ref class, hence the other @ attributes are not shown as populated in this example.​​​

    For examples where @ attributes are populated, take a look at TMF633 Service Catalog, you will see there (for example) for a service specification that is actually an RFS something that looks like this:
        "id": "7655",
        "href": "https://mycsp.com:8080/tmf-api/serviceCatalogManagement/v4/serviceSpecification/7655",
        "name": "Firewall Service",
         ...
        "@type": "ResourceFacingServiceSpecification",
        "@schemaLocation": "https://mycsp.com:8080/tmf-api/schema/Service/ResourceFacingServiceSpecification.schema.json",
        "@baseType": "ServiceSpecification"

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