I have a request body that should be validated against specific schema.
There will be one optional property returnValues
which is boolean should be validated if present in the params
inside payload.
Schema:
{
"title":"RPCRequest",
"type":"object",
"properties":{
"params":{
"description":"rpc method parameters",
"type":"object",
"additionalProperties":true
}
},
"required":[
"params"
],
"additionalProperties":false
}
Although I mentioned "additionalProperties": true
, I'm still getting that additional Property is not allowed error.
RPC Parameters Validation Errors: [returnValues: Additional property returnValues is not allowed]
Code:
gojsonschema.Validate(schema, gojsonschema.NewGoLoader(params))
type GetChartRequest struct {
ID string
Name string
Deployment string
Namespace string
Repository string
Version string
Cluster string
InstallOrder *uint64 `json:"installOrder"`
Provider string
ReturnValues bool `json:"returnValues"`
}