Skip to content

java-jaxrs-client: Generate form request body objects #67

Description

@Sholto

Currently in the java-jaxrs-client, we use the type Form when generating request bodies for requests of type application/x-www-form-urlencoded.

formUrlEncodedImplementation: () => new context.NativeType(`${generatorOptions.useJakarta ? 'jakarta' : 'javax'}.ws.rs.core.Form`),`

This means that the request body object defined in the schema is ignored and replaced by the generic Form, even though objects are supported in the OpenAPI specification. See here.

I noticed this comment in some related code, and I imagine this is likely the root cause of this.

/* Fix form post request bodies, as we can't properly handle them using 
 https://docs.oracle.com/javaee/7/api/javax/ws/rs/BeanParam.html yet
 */

However, in my testing I have found that (at least using jakarta) this comment no longer seems valid.
I was able to use a class marked with @BeanParam with the members marked with @FormParam successfully.

I think we should investigate correctly implementing generated form request bodies for the java-jaxrs-client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions