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 not generated properly for @Consumes(MediaType.MULTIPART_FORM_DATA) #1215

Open
prateekhyland opened this issue Oct 10, 2024 · 3 comments
Labels
Milestone

Comments

@prateekhyland
Copy link

When an endpoint is exposed as @consumes(MediaType.MULTIPART_FORM_DATA), swagger is not generated properly. Also under Datatypes JSON, the class is not getting generated that was passed as parameter in the endpoint.

@stoicflame stoicflame added this to the 2.19.0 milestone Oct 10, 2024
@stoicflame
Copy link
Owner

Please provide details about what you're observing and what you're expecting from the Swagger docs.

As for the JSON data type, what indicators does Enunciate have to know that the parameter to the endpoint is to be interpreted as a JSON object?

@prateekhyland
Copy link
Author

I have an endpoint that is :

@path("documents")
@post
@consumes(MediaType.MULTIPART_FORM_DATA)
DocumentStoreInformationType createDocument(@QueryParam("verify") @DefaultValue("false") boolean verify,
CreateDocumentInputType properties)

another endpoint is :

@path("lookup-entry")
@post
@OverRide
LookupEntryReferenceType createLookupEntry(CreateLookupEntryInputType properties)

For the second one I am getting docs generated as given in the image attached.. But not getting similar one for CreateDocumentInputType
ss

@stoicflame
Copy link
Owner

For the second one I am getting docs generated as given in the image attached.. But not getting similar one for CreateDocumentInputType

Yes the createLookupEntry method "consumes" application/json, so Enunciate knows that CreateLookupEntryInputType is supposed to be serialized as JSON. The createDocument method consumes multipart/form-data, so Enunciate only knows that CreateDocumentInputType is supposed to be serialized as a string value and there's no way of knowing whether that string value should be a json string, yaml string, xml string, or something else entirely.

Am I missing something?

Also, I still need details about the reported problem of "swagger is not generated properly."

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

No branches or pull requests

2 participants