You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need a little help to validate the presence of a parameter in an uncase sensitive way.
At the moment my schema is this one.
Everything is working fine, but my api protocol provide that the parameters validation should be case insensitive so I should accept olso clIENTid pr clientid or CLIENTID or any way to write clientid wito lower and uppercase.
How can I do? should I use an Hook and cycle over all the parameters name and converting them in lowercase?
The RFC-3986, is kind of ambiguous as does not specifies if the key of the key=value pairs should be case sensitive or not, so it is up to each implementation to decide how to handle it.
You can use the patternProperties feature from ajv to construct a regex that covers both cases of your properties (i.e. either clientid or clientId, etc.).
Another option is to use the preValidation hook to intercept the request before validation and parse your query object to a lower (or upper) case version of it.
I need a little help to validate the presence of a parameter in an uncase sensitive way.
At the moment my schema is this one.
Everything is working fine, but my api protocol provide that the parameters validation should be case insensitive so I should accept olso clIENTid pr clientid or CLIENTID or any way to write clientid wito lower and uppercase.
How can I do? should I use an Hook and cycle over all the parameters name and converting them in lowercase?
const querySchema = { type: 'object', properties: { ClientID: { type: 'number' }, ClientTransactionID: { type: 'number' } }, required: ['ClientID', 'ClientTransactionID'] };
The text was updated successfully, but these errors were encountered: