Open APIs

 View Only
  • 1.  TMF Standard returning Multiple Errors (TMF622)

    TM Forum Member
    Posted Sep 29, 2020 16:25
    Hi Team,

    I want to know if TMF Standard supports returning multiple error codes/message in form of array in the Synchronous Response.

    I am using TMF622 for handling Product Order, there are set of Business Validation that I need to perform before placing the Order. My requirement is perform all the validates in one go and return all errors encounters back to the user in 1 single response. So, that User can fix/correct all issue together and repost a error free request. Does TMF Standard support this feature of sending back multiple errors in form on array/occurrence. I have been to the standard guideline of TMF630 & also read through TMF622 but I did not find anything mentioned for this. Can you please assist.

    Example :

    400 Bad Request

    {

          "code": "ERR001",

          "reason": "Missing mandatory field",

          "message": "Please provide and Authorisation header"

          "code1": "<Code1>",

          "reason1": "<reason1>",

          "message1": "<message1>"

        ......

    }

    ------------------------------
    Princy Rodrigues
    BT Group plc
    ------------------------------


  • 2.  RE: TMF Standard returning Multiple Errors (TMF622)

    TM Forum Member
    Posted Sep 30, 2020 02:23
    Hi Princy

    Currently the general Error structure is returned as a payload ​for all non-success HTTP statuses (as you can see from the Open API swagger files). But this is a single structure, not an array.
    Specifically for orders, we have started to introduce a new pattern, whereby the order structure itself will include a list of errors. This will probably answer your use case.
    It is being done initially for Service Order (TMF641), presumably it will eventually reach Product and Resource Order as well. If you want to align your current implementation with the pattern, suggest you reach out to @Kamal Maghsoudlou to find out details of the change.
    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: TMF Standard returning Multiple Errors (TMF622)

    TM Forum Member
    Posted 10 days ago
    Edited by Petr Kolotushkin 10 days ago
    Hi @Jonathan Goldberg, @Kamal Maghsoudlou,

    I've faced the trouble, similar to @Princy Rodrigues​​​. Not exactly with TMF622, but with the whole TMF630 API guideline.
    As you mentioned above, the standard non-success HTTP reply returns only a single {errorMessage} object.

    I understood the idea about the ServiceOrder, and it's list of errors caused an order status change.

    But how can I return a list of errors, appearing on the entity creation as well?
    For example, we are trying to create a Customer (POST /customer). And the operator has made several mistakes on UI at once:
     - The Name contains a digit
     - The birthdate is a 2022 (to young to be a Customer)
     - A value in the characteristic "Region" is not supported (e.g. we don't have an office there).

    The easiest way for me - is to return such an error:

    400 Bad Request

    {
    errors: [
      {

          "code": "ERR001",

          "reason": "Error in Name",

          "message": "The Customer name must not contain digits or special symbols"
      },
      {

          "code": "ERR002",

          "reason": "Error in date of birth",

          "message": "The specified date of birth must be earlier 2010"

      },
      {

          "code": "ERR003",

          "reason": "Characteristic error",

          "message": "The characteristic "Region" is not supported"

      }
    ​]
    }

    But this is against the rules?

    I don't want to successfully create the Customer (201 Created) in the error status and return the errors list in a nested collection.

    ------------------------------
    Petr Kolotushkin
    Netcracker Technology
    ------------------------------



  • 4.  RE: TMF Standard returning Multiple Errors (TMF622)

    TM Forum Member
    Posted 7 days ago
    Edited by Vance Shipley 7 days ago
    You may use polymorphism to extend the Error object.

    {
        "@type": "MyError",
        "@baseType": "Error",
        "@schemaLocation": "/<my-path>/MyError.schema.json",
        ...
    }​

    Incidentally, I proposed (AP-2628) introducing IETF RFC7807 compliant error response body (application/problem+json) as done by 3GPP and ETSI. As RFC7807 encourages extensions we would add our Extensible attributes (above) and have both a TMF specific and industry standard error format.

    ------------------------------
    Vance Shipley
    SigScale
    ------------------------------


  • 5.  RE: TMF Standard returning Multiple Errors (TMF622)

    TM Forum Member
    Posted 7 days ago

    Hi Vance,
    Yes, I was thinking about this option.
    But also wanted to clarify, if the community already has any cases with the errors array. 

    As a possible scenario, we consider to use, is to separate the validation errors in a specific error code. For this code, we may extend the standard error by the array of additional  validation codes.
    E.g.:

    400 Bad Request

    {
    "code": "ValidationError",
    "reason": "Input validation error",
    "message": "There are validation errors, check the details below",
    "@type": "ValidationError",
    "details": [
      {

          "code": "ERR001",

          "reason": "Error in Name",

          "message": "The Customer name must not contain digits or special symbols"
      },
      {

          "code": "ERR002",

          "reason": "Error in date of birth",

          "message": "The specified date of birth must be earlier 2010"

      },
      {

          "code": "ERR003",

          "reason": "Characteristic error",

          "message": "The characteristic "Region" is not supported"

      }
    ​]
    }

    In all other cases - to use the standard response from TMF630 (code, reason, message).



    ------------------------------
    Petr Kolotushkin
    Netcracker Technology
    ------------------------------