Is there any library in NodeJS which can search in JsonSchema at given path

Viewed 14

I have following section from JsonSchema.

{
    "required":[
       "name",
       "photoUrls"
    ],
    "type":"object",
    "properties":{
       "id":{
          "type":"integer",
          "format":"int64"
       },
       "category":{
          "type":"object",
          "properties":{
             "id":{
                "type":"integer",
                "format":"int64"
             },
             "name":{
                "type":"string"
             }
          },
          "xml":{
             "name":"Category"
          }
       },
       "name":{
          "type":"string",
          "example":"doggie"
       },
       "photoUrls":{
          "type":"array",
          "xml":{
             "wrapped":true
          },
          "items":{
             "type":"string",
             "xml":{
                "name":"photoUrl"
             }
          }
       },
       "tags":{
          "type":"array",
          "xml":{
             "wrapped":true
          },
          "items":{
             "type":"object",
             "properties":{
                "id":{
                   "type":"integer",
                   "format":"int64"
                },
                "name":{
                   "type":"string"
                }
             },
             "xml":{
                "name":"Tag"
             }
          }
       },
       "status":{
          "type":"string",
          "description":"pet status in the store",
          "enum":[
             "available",
             "pending",
             "sold"
          ]
       }
    },
    "xml":{
       "name":"Pet"
    },
    "$$ref":"#/components/schemas/Pet"
 }

I need to search whether is there any data exists at a given path like category.id or tags[0].id.

I can see jsonpath module works on simple json but does not work when json schema is provided to it. I tried searching some function in swagger-client but could not found any.

So I'm looking for a library for performing this functionality. Please help me. Thanks in advance :)

0 Answers
Related