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

Generated MP app SimpleGreetResource#getMessage method claims to produce JSON but returns String #8536

Closed
tjquinno opened this issue Mar 22, 2024 · 0 comments · Fixed by #8629
Assignees
Labels
4.x Version 4.x archetypes bug Something isn't working MP P2

Comments

@tjquinno
Copy link
Member

Environment Details

  • Helidon Version: 4.x
  • Helidon SE or Helidon MP MP
  • JDK version:
  • OS:
  • Docker version (if applicable):

Problem Description

Using helidon init for a custom MP app, the generated SimpleGreetResource class contains the getMessage method (the one that accepts a name to greet):

    @Path("/{name}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Counted(name = PERSONALIZED_GETS_COUNTER_NAME,
             absolute = true,
             description = PERSONALIZED_GETS_COUNTER_DESCRIPTION)
    @Timed(name = GETS_TIMER_NAME,
           description = GETS_TIMER_DESCRIPTION,
           unit = MetricUnits.SECONDS,
           absolute = true)
    public String getMessage(@PathParam("name") String name) {
        return String.format("Hello %s", name);
    }

The method's annotations say it returns JSON but it actually returns a String (that is not JSON - just the greeting message).

Steps to reproduce

Generate an MP custom app.
Build and run.
curl http://localhost:8080/simple-greet/Anyone

The response content is Hello Anyone, not JSON as claimed by the @Produces annotation and as indicated in the response Content-Type header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x archetypes bug Something isn't working MP P2
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants