Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swagger module should support JAXBElement #885

Closed
sakthisunda opened this issue Jul 26, 2018 · 7 comments
Closed

swagger module should support JAXBElement #885

sakthisunda opened this issue Jul 26, 2018 · 7 comments
Milestone

Comments

@sakthisunda
Copy link

sakthisunda commented Jul 26, 2018

Enunciate version 10.x - 11.x
JAX-RS web api

In all versions it produces wrong Response class unless the return value is a Simple Type.
If it is generic type like the following examples, it generates the following info (viewing from Enunciate generated swagger ui )

Response Class (Status 200)
file

Some of the non-working signatures:

    public JAXBElement \<GroupType> getGroup(@PathParam("id") final String groupId, @Context final UriInfo uriInfo) throws PresentationException
    public JAXBElement \<VXExtensionType> getExtension(@Context final UriInfo uriInfo) 
    public Response \<ContainerType> getResourceClasses(final @Context HttpServletRequest request ..)
    public JAXBElement \<MetadataType> getCXMetadata(@Context final UriInfo uriInfo, @PathParam("id") final String id) {

Question:

  1. Will these work only if I provde @returnWrapped annotation ?
  2. Any future version that this will be supported without updating the code without @returnWrapped ?

NOTE: All the referred classes are available in classpath. When I use @returnWrapped with full path of the Class, they generate correct documentation. I tried atleast for one of them.

@stoicflame stoicflame added this to the 2.12.0 milestone Jul 26, 2018
@stoicflame
Copy link
Owner

I can look into adding support for JAXBElement to the swagger module.

@stoicflame stoicflame changed the title Enunciate swagger module generates swagger.json with wrong Response Class : file swagger module should support JAXBElement Jul 26, 2018
@sakthisunda
Copy link
Author

sakthisunda commented Jul 27, 2018

Will this fix/enhancement also be available in enunciate-openapi module generated openapi.yaml ?

@stoicflame
Copy link
Owner

Started digging into this, but I need some more context so I can correctly implement an enhancement.

Is JAXBElement intended to be used for both XML and JSON endpoints?

If intended to be used in JSON endpoints, how is the result expected to be the unwrapped value? Do you have some kind of custom Jackson mapping logic for JAXBElement? Jackson, by default, doesn't "unwrap" the value out of the JAXBElement when it serializes the data.

@stoicflame
Copy link
Owner

Moving to release 2.13, pending response with more information.

@stoicflame stoicflame modified the milestones: 2.12.0, 2.13.0 Aug 10, 2019
@sakthisunda
Copy link
Author

Started digging into this, but I need some more context so I can correctly implement an enhancement.

Is JAXBElement intended to be used for both XML and JSON endpoints?

If intended to be used in JSON endpoints, how is the result expected to be the unwrapped value? Do you have some kind of custom Jackson mapping logic for JAXBElement? Jackson, by default, doesn't "unwrap" the value out of the JAXBElement when it serializes the data.

For now, it is intended for only xml end point. I mean accept-type : application/xml

@stoicflame
Copy link
Owner

Fix to be included in 2.13.

@stoicflame
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants