Open APIs

 View Only
  • 1.  Which JsonPath filtering syntax is compliant with TMF specification?

    TM Forum Member
    Posted Feb 12, 2025 09:20

    Hi, 

    in the guideline documents I've only noticed JsonPath syntax which looks like this: filter=$.field[...]. In this form, the root of the expression is a single element, while the query is always run against a collection of resources. To my knowledge it is not possible to filter by first level fields using JsonPath in such case.
    For example, it is possible to do the following using regular filters: ?field1=val1&field2=val2 but not using JsonPath. 

    Am I wrong on that? I tested this on websites with interactive JsonPath, and it seems to be this way, for example something like this: filter=$.field1[?(@ == 'val1')] does not work.

    If, however, the root of the JsonPath expression would be the collection of resources, rather than its single element, it would be possible to filter by first level fields,
    like this: $[?(@.field1=='val1' && @.field2=='val2')].

    I think such syntax would fit the use case much better, because the purpose of JsonPath is selection of nodes. Doing this: $.attachment[?(@.size == 100)] in normal JsonPath usage would result in a collection of attachment nodes, rather that document nodes. However this: $[@.attachment.size == 100] fits much better because the selection is done on the collection of documents, so the result is also a collection of documents. Plus it is possible to filter on first level fields. Basically, any query can be made using only JsonPath. 

    However, usage of JsonPath when root is a collection and not an element of the collection does not appear in the guideline documents, so is it in compliance with TMF? 

    Best regards



    ------------------------------
    Piotr Ledwoń
    Suntech S.A.
    ------------------------------


  • 2.  RE: Which JsonPath filtering syntax is compliant with TMF specification?

    TM Forum Member
    Posted Feb 13, 2025 03:52
    Edited by Yurii Yushchak Feb 13, 2025 04:07

    Hi Piotr!

    Please refer to the TMF630 REST API Design Guidelines Part 6 "JSON path extensions" and you can find an example using JSONPath when root is a collection.

    Best regards,



    ------------------------------
    Yurii Yushchak
    System Manager
    Ericsson Inc.
    ------------------------------



  • 3.  RE: Which JsonPath filtering syntax is compliant with TMF specification?

    TM Forum Member
    Posted Feb 13, 2025 07:44

    Thanks for the reply.

    You are right, I missed that part. Does this mean  that we have to support both methods, or can we support just one? When is the filtering feature considered compliant with TMF specifications?      

    Best regards



    ------------------------------
    Piotr Ledwoń
    Suntech S.A.
    ------------------------------



  • 4.  RE: Which JsonPath filtering syntax is compliant with TMF specification?

    TM Forum Member
    Posted Feb 14, 2025 05:39

    Hi Piotr,

    TM Forum does not use the term "compliance" in its standards. TM Forum uses the term "conformance" and implies that TM Forum provides a framework that you must support. You can validate your TMF API design using the Conformance Profile provided for each API in TM Forum Open API Directory. For example, how it looks like for TMF641 Service Ordering Management API:

    You can then extend your TMF APIs according to the rules described in the TMF630 REST API Design Guidelines and update your API documentation to reflect the changes.

    You can also use the Conformance Test Kit (CTK), which runs Postman tests on a working API implementation over HTTP and validate it. The CTK is also provided for each API in TM Forum Open API Directory.

    Best regards,



    ------------------------------
    Yurii Yushchak
    System Manager
    Ericsson Inc.
    ------------------------------