Open kerbymart opened 3 months ago
Hi @kerbymart Thanks for submitting this issue. We have deprecated support for XStream in version 2,3 and removed it in 2.4 due to the perceived lack of usage and Restlet level, plus the lack of activity on XStream itself (last maintenance version was in Dec. 2022).
Have you considered moving to Jackson or GSON extensions instead, if not what is preventing you from doing that? JAXB could be another alternative.
Issue Description:
In the context of using the Restlet Framework with Swagger 2 and XStream extensions, there is a challenge in accurately representing the wrapped model structure in the Swagger API documentation. The discrepancy arises due to the XStream serialization wrapping the model class, which Swagger 2 cannot directly document.
Model Class
The
User
model is defined with Swagger and XStream annotations:Endpoint Resource
The endpoint for creating a new user uses the following method signature:
Response Wrapper Class
To address the serialization wrapping, a placeholder class,
UserResponse
, is introduced for Swagger documentation:Discrepancy in JSON Output
The challenge is that XStream expects the JSON payload to include a wrapper, like this:
Expected JSON format for XStream:
However, Swagger generates documentation based on the
UserResponse
class, which may not explicitly convey this wrapping:Swagger-documented JSON format:
Problem Statement
The core issue is that Swagger 2, as used with Restlet Framework, does not natively support documenting models that are wrapped by XStream. The
UserResponse
class is used as a workaround to provide API documentation, but also does not work as intended.