TM Forum Community

 View Only
  • 1.  TMF760 - Object field Information

    TM Forum Member
    Posted 10 days ago
    Edited by Chetan Patel 10 days ago

    Hi Team,

    @Bostjan Keber @Jonathan Goldberg

     We are getting characteristic object without "value" field so does it correct or mistake in swagger? Why each object have @type  is mandatory?

    Regards

    Chetan Hirpara


    #General

    ------------------------------
    Chetan Patel
    Tech Mahindra Limited
    ------------------------------



  • 2.  RE: TMF760 - Object field Information

    TM Forum Member
    Posted 9 days ago

    Hi Chetan,

    TMF760 is a version 5 Open API and uses Swagger / Open API 3.0 meaning the schemas may use inheritance (allof keyword).

    Characteristic class is abstract and extended with subclasses of a specific type, e.g. string characteristic, number characteristic, etc. See diagram below:

    Also, have a look at the Swagger definition:
    Characteristic:
          allOf:
            - $ref: '#/components/schemas/Extensible'
            - type: object
              description: Describes a given characteristic of an object or entity through a name/value pair.
              properties:
                id:
                  type: string
                  description: Unique identifier of the characteristic
                name:
                  type: string
                  description: Name of the characteristic
                valueType:
                  type: string
                  description: Data type of the value of the characteristic
                characteristicRelationship:
                  type: array
                  items:
                    $ref: '#/components/schemas/CharacteristicRelationship'
          discriminator:
            propertyName: '@type'
            mapping:
              Characteristic: '#/components/schemas/Characteristic'
              StringCharacteristic: '#/components/schemas/StringCharacteristic'
              StringArrayCharacteristic: '#/components/schemas/StringArrayCharacteristic'
              ObjectCharacteristic: '#/components/schemas/ObjectCharacteristic'
              ObjectArrayCharacteristic: '#/components/schemas/ObjectArrayCharacteristic'
              NumberCharacteristic: '#/components/schemas/NumberCharacteristic'
              NumberArrayCharacteristic: '#/components/schemas/NumberArrayCharacteristic'
              IntegerCharacteristic: '#/components/schemas/IntegerCharacteristic'
              IntegerArrayCharacteristic: '#/components/schemas/IntegerArrayCharacteristic'
              FloatCharacteristic: '#/components/schemas/FloatCharacteristic'
              FloatArrayCharacteristic: '#/components/schemas/FloatArrayCharacteristic'
    @type attribute is used as a discriminator to determine the characteristic type.
    The actual value is stored in the value attribute of each subclass, e.g. StringCharacteristic.value.
        StringCharacteristic:
          allOf:
            - $ref: '#/components/schemas/Characteristic'
            - type: object
              description: A characteristic which value is a String.
              properties:
                value:
                  type: string
                  description: Value of the characteristic

    Hope it helps.

    Bostjan



    ------------------------------
    Bostjan Keber
    Marand, software ltd
    ------------------------------



  • 3.  RE: TMF760 - Object field Information

    TM Forum Member
    Posted 9 days ago
    Edited by Chetan Patel 9 days ago

    @Bostjan Keber 

    Thanks a lot, Its really helpful to understand.

    Swagger version openapi: 3.0.1 is too much lengthy, its taking too much time to load objects on GUI. Even sometime its not displaying actual object fields.

    ------------------------------
    Chetan Patel
    Tech Mahindra Limited
    ------------------------------