Reputation: 208
I have been generating the service with jaxrs-spec
and currently with jaxrs-resteasy
. The switch was done because resteasy returns wrong status according to yaml and resteasy is used in wildfly. I haven't got anything but null for the filter.
This is how the specification looks like.
get:
operationId: getMessageByFilter
description: Get a specific message by filter option (messageStatus, creationDateTime, recipientAttention.subOrganization.extension, senderAttention.subOrganization.extension). This operation always excludes digitalDocument
tags:
- Message life cycle
parameters:
- in: query
name: filter
description: "The filter query parameter family is reserved to be used as the basis for any filtering of strategy. ?Filter[attribute]=value"
example: '?filter[recipientAttention.subOrganization.extension]=sdk:inkorg001:0203:inera.se'
schema:
type: object
properties:
'recipientAttention.subOrganization.extension':
type: string
'senderAttention.subOrganization.extension':
type: string
messageStatus:
$ref: "#/components/schemas/messageStatusDef"
creationDateTimeStart:
type: string
format: date-time
creationDateTimeStop:
type: string
format: date-time
style: deepObject
allowReserved: true
...
The service gets generated just fine.
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "", notes = "Get a specific message by filter option (messageStatus, creationDateTime, recipientAttention.subOrganization.extension, senderAttention.subOrganization.extension). This operation always excludes digitalDocument", response = OutputArrayData.class, authorizations = {
@io.swagger.annotations.Authorization(value = "message_auth", scopes = {
@io.swagger.annotations.AuthorizationScope(scope = "urn:sdk.api:getMessageByFilter", description = "get a message by filter")
})
}, tags={ "Message life cycle", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "OK", response = OutputArrayData.class),
@io.swagger.annotations.ApiResponse(code = 400, message = "BadRequest", response = Events.class),
@io.swagger.annotations.ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
@io.swagger.annotations.ApiResponse(code = 404, message = "Not found.", response = Void.class) })
public Response getMessageByFilter( @QueryParam("filter") GetMessageByFilterFilterParameter filter,@Context SecurityContext securityContext)
throws NotFoundException {
return service.getMessageByFilter(filter,securityContext);
}
Except that no matter what I send the filter is always null.
I have added ParamConvertProvider
that returns an ParamConverter
but there is no call the ParamConverterProvider
since I changed to resteasy
. There has never been a call to the provider with the filter class.
This is the ParamConverterProvider
. Does not get called to get a "filter" converter.
@Provider
public class SdkApiParameterConverter implements ParamConverterProvider
{
private GetByFilterParamConverter converter;
@SuppressWarnings("unchecked")
@Override
public <T> ParamConverter<T> getConverter(Class<T> aClass, Type type, Annotation[] annotations)
{
if (aClass.isAssignableFrom(GetMessageByFilterFilterParameter.class))
{
if (converter == null)
{
converter = new GetByFilterParamConverter();
}
return (ParamConverter<T>) converter;
}
return null;
}
}
We are deploying on wildfly. That's why resteasy got choosen for us.
I personally think there is something wrong with the API specification. I just can't figure this out.
For now I have solved it by getting my hands on the HttpServletRequest
object and parsing the object from the query string.
Upvotes: 1
Views: 35