3

I am using com.networknt:json-schema-validator lib to validate the incoming json request body in my spring boot server against the pre loaded schema and its working fine. Now I also want to validate the request query parameter against the corresponding open api specs.

I was researching and found that com.networknt:json-schema-validator does not handle OpenAPI-specific query parameter parsing (i.e., style and explode handling). It only validates data once it's in JSON format but OpenAPI query parameters are not inherently JSON.

Can you please suggest some other library for this purpose or something else can be done to validate these query param using existing library itself?

Example apen api spec:

 "name" : "query-param-1",
  "in" : "query",
  "required" : true,
   style: form
   explode: false
  "schema" : {
    "minItems" : 2,
    "uniqueItems" : true,
    "type" : "array",
    "items" : {
      "anyOf" : [ {
        "type" : "string",
        "enum" : [ "AM", "SMF_SEL", "UEC_SMF", "UEC_SMSF", "SMS_SUB", "SM", "TRACE", "SMS_MNG", "LCS_PRIVACY", "LCS_MO", "UEC_AMF", "V2X" ]
      }, {
        "type" : "string"
      } ]
    }
  }
}

Sample query params:

query-param-1=AM,SMF_SEL,UEC_SMF

OR

query-param-1=AM&query-param-1=SMF_SEL&query-param-1=UEC_SMF

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.