[WS] Validate JSON Schema (PoC)


This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/ws-validate-json-schema.html

“Validate JSON Schema” ? ---- this expression sounds strange to me. Is it a correct English expression?


Do we want to validate a JSON Schema? In most case, no. We do not want to validate a schema.

Rather we want to validate a JSON instance document based on a predefined (proven) schema.

The keyword should be named correctly. Otherwise, people would get confused what the keyword does.

For example, a proper expression can be found in https://www.baeldung.com/rest-assured-json-schema

we’ll take a look at how we can validate a JSON response based on a predefined JSON schema .

1 Like

Same mistake for XML validation (POC)

the provided example is not working it keeps failing

groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords.validateJsonSchema() is applicable for argument types: (java.lang.String, java.lang.String) values: ....

Hi @amalajmi,

Please specify the script you are using and the full stack trace in console log

In the doc

I found a sample coce

boolean successful = WS.validateJsonSchema(jsonObject,jsonPass)

The keyword is named as “WS.validateJsonSchema” !?.

Well, in my opinion, this naming is wrong.

1 Like

@kazurayam well … of-course, why am I not surprised?
If the naming in the code are misleading, why should be the documentation right?
cc @Russ_Thomas from the community side, he knows why …
cc @vu.tran : regarding our recent private discussions …

Yes. This.

@duyluong Like I said in the link above, you need to fix this so that the intent of the API is abundantly clear.

validateJsonBy(schema, response)
validateJson(response, schema)

Either of those two make sense in English. validateJsonScema means your intent is to validate the schema itself which is clearly NOT what is intended.

2 Likes