mulesoft-labs / raml-jaxrs-codegen

Tools to enable RAML-first development in JAX-RS projects
Other
40 stars 43 forks source link

RAML Responses with repeating headers generate broken code #41

Open talios opened 9 years ago

talios commented 9 years ago

When using a RAML description of a response such as:

get:
  responses:
    200:
      description:
        The list of all customer agreements.
      headers:
        link-template:
          displayName: Link Templates
          repeat: true

raml-jaxrs-codegen correctly generates a with* method taking a List, however:

public static ...Response withhaljsonOK(List<String> linkTemplate, StreamingOutput entity) {
  Response.ResponseBuilder responseBuilder = Response.status(200)
    .header("Content-Type", "application/hal+json")
    .header("link-template", linkTemplate);

the code generator only generates a single call to header() for the link-template header specified as repeating. This means that List#toString is called yielding output such as:

< HTTP/1.1 200 OK
< Content-Length: 428
< Content-Type: application/hal+json
< link-template: []
* Server Jetty(6.1.x) is not blacklisted

rather than the multi-valued header ( or repeated header ) as expected.

petrochenko-pavel-a commented 9 years ago

Hi, Thanks for your input. Actually the project moved to https://github.com/mulesoft/raml-for-jax-rs

We are using JIRA for better tracking these issues. Let's continue this thread here: https://www.mulesoft.org/jira/browse/RAML4JAXRS-28

Feel free of opening future issues here: https://www.mulesoft.org/jira/browse/RAML4JAXRS Note: You will also be able to create issues here (on Github), and we will replicate these on the JIRA project.