guardrail-dev / guardrail-dev/guardrail
date Query filter is failed to parse and throw 404 error (date+ time query filter is not failing)
- Dominant language
- Scala
- Stars
- 541
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Description
We noticed that our api is failing with 404 error when the query string date field is not a full OffsetDate Sting format.
for example:
this request pass:
curl 'https://ai.twilio.com/v1/Transcripts?AfterDateCreated=2020-11-22T23:46:00Z' -u $AC:$TK
but this one fails:
curl 'https://ai.twilio.com/v1/Transcripts?AfterDateCreated=2020-11-22' -u $AC:$TK
the error we get in the internal service is:
{"message":"HTTP 404 Not Found","code":404,"user_error":false,"http_status_code":404,"params":\{"error_detail":"org.glassfish.jersey.server.ParamException$QueryParamException: HTTP 404 Not Found"}
and it comes from this generated code:
```java
private static class ValueFactories {
private static class QueryParamValueFactory extends AbstractContainerRequestValueFactory {
private final MultivaluedParameterExtractor extractor;
private final boolean decode;
QueryParamValueFactory(final MultivaluedParameterExtractor extractor, final boolean decode) {
this.extractor = extractor;
this.decode = decode;
}
@Override
public Object provide() {
try {
return this.extractor.extract(getContainerRequest().getUriInfo().getQueryParameters(decode));
} catch (final ProcessingException e) {
throw new ParamException.QueryParamException(e.getCause(), this.extractor.getName(),
this.extractor.getDefaultValueString());
}
}
}
```
sample schema:
```java
get:
x-jvm-package: transcripts
summary: Get transcripts for an account and service
operationId: getTranscripts
parameters:
- name: AfterDateCreated
in: query
description: Filter by after DateCreated
schema:
type: string
format: date-time
200:
description: List of all transcripts
content:
application/json:
schema:
$ref: "#/components/schemas/Transcripts"
400:
description: Bad request
content:
application/json:
schema:
type: string
x-jvm-type: com.twilio.rest.TwilioServiceErrorResponse
401:
description: Unauthorized
content:
application/json:
schema:
type: string
x-jvm-type: com.twilio.rest.TwilioServiceErrorResponse
404:
description: Not found
content:
application/json:
schema:
type: string
x-jvm-type: com.twilio.rest.TwilioServiceErrorResponse
500:
description: Internal server error
content:
application/json:
schema:
type: string
x-jvm-type: com.twilio.rest.TwilioServiceErrorResponse
Contributor guide
Assessment
This issue has not been assessed yet.