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

Cannot use OpenAPI U/Is to change the greeting message in the MP quickstart #1390

Closed
tjquinno opened this issue Feb 14, 2020 · 2 comments
Closed
Assignees
Labels
1.x Issues for 1.x version branch 2.x Issues for 2.x version branch bug Something isn't working open-api P2
Projects

Comments

@tjquinno
Copy link
Member

Environment Details

  • Helidon Version: 1.x, 2.x
  • Helidon SE or Helidon MP: MP
  • JDK version: n/a
  • OS: n/a
  • Docker version (if applicable): n/a

Problem Description

In working with the openapi-ui MP extension (and this is not unique to that extension), the user cannot execute the endpoint to update the greeting correctly because there is no way to provide the new greeting input parameter.

Steps to reproduce

For example, to the 2.x quickstart MP example:

<dependency>
    <groupId>org.microprofile-ext.openapi-ext</groupId>
    <artifactId>openapi-ui</artifactId>
    <version>1.1.2</version>
    <scope>runtime</scope>
</dependency>
  • mvn package
  • java -jar target/helidon-quickstart-mp.jar
  • From a browser access http://localhost:8080/openapi-ui
  • Click on the PUT button for /greet/greeting. There is no way to enter the request body JSON for the new greeting message. Clicking Execute yields a server error because the expected request body is missing.
@tjquinno tjquinno added bug Something isn't working open-api P2 1.x Issues for 1.x version branch 2.x Issues for 2.x version branch labels Feb 14, 2020
@tjquinno tjquinno self-assigned this Feb 14, 2020
@tjquinno tjquinno added this to Needs triage in Backlog via automation Feb 14, 2020
@tjquinno tjquinno moved this from Needs triage to High priority in Backlog Feb 14, 2020
@tjquinno
Copy link
Member Author

Adding this code (with the corresponding imports) to the GreetResource#updateGreeting method resolves the problem:

@RequestBody(name = "greeting",
            required = true,
            content = @Content(mediaType = "application/json",
                    schema = @Schema(type = SchemaType.STRING)))

@tjquinno
Copy link
Member Author

Note that we could add a large number of other OpenAPI annotations to all endpoints in the MP quickstart example so the OpenAPI info is more extensive (descriptions, examples, etc.). But I like the idea of not doing so, keeping the clutter to a minimum. That said, the @RequestBody change above is a necessary bug fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x Issues for 1.x version branch 2.x Issues for 2.x version branch bug Something isn't working open-api P2
Projects
Backlog
  
Closed
Development

No branches or pull requests

1 participant