Skip to content

Java strings not escaped properly in mvc source code generation. #3455

@tpoll

Description

@tpoll

Example:

Take an endpoint like

  @GET("/required-string-param")
  @Schema(description = "test\"ttttt")
  public String requiredStringParam(@QueryParam @NonNull String value) {
    return value;
  }

Jooby apt generation creates a file that includes the line

java.util.Map.entry("Schema.description", "test"ttttt"),

This produces and invalid java file since we have a dangling ".

It seems like

this line needs to be updated to ensure that escaped characters our output in the string. e.g. we need to transform the string to be "\\\"". There's a bunch more cases that would need to be handled too (see https://docs.oracle.com/javase/specs/jls/se22/html/jls-3.html#jls-3.10.7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions