-
Notifications
You must be signed in to change notification settings - Fork 135
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
Add an Microprofile OpenAPI example #112
Conversation
@jamezp I'm working on a SmallRye based OpenAPI example, and I've made some progresses. I plan to make the example based on the current Here is the Which must be used in an integrated environment such as Quarkus or WildFly. For example, here is the usage of it in Quakrus: The reason to use it in a container is because the container help to setup the Apis generated by the smallrye framework. For example, in And here is the handler in Quarkus: For WildFly, it contains the So I added the layer in the <layer>microprofile-openapi</layer> However the plugin reports this error: [ERROR] Failed to execute goal org.wildfly.plugins:wildfly-jar-maven-plugin:8.1.0.Final:package (default) on project products-runner: Provisioning failed: Failed to locate layer [model=standalone name=microprofile-openapi] in the the installation feature-pack layout -> [Help 1] I'm not sure how to configure this properly. Could you please provide some help on this? Thanks! |
@liweinan I wonder if we should create a resteasy-microprofile-example. The reason this doesn't work is we're using the Anyway, you need change the feature pack to |
@jamezp Yes sir! And thanks for the help :D |
@jamezp I have finished working on the example, could you please help to review it? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general we should not name this "smallrye-openapi". SmallRye as an Eclipse MicroProfile OpenAPI implementation. However, here we're using the MicroProfile OpenAPI.
I also question whether or not we should be using the bootable JAR here. If we just use the API's, we could run on WildFly or in other containers. This part doesn't require a change before we can merge this, but it's something we should think about IMO.
smallrye-openapi/src/main/java/dev/resteasy/examples/openapi/Product.java
Outdated
Show resolved
Hide resolved
smallrye-openapi/src/main/java/dev/resteasy/examples/openapi/ProductApplication.java
Outdated
Show resolved
Hide resolved
smallrye-openapi/src/main/java/dev/resteasy/examples/openapi/ProductResource.java
Outdated
Show resolved
Hide resolved
smallrye-openapi/src/main/java/dev/resteasy/examples/openapi/ProductApplication.java
Outdated
Show resolved
Hide resolved
smallrye-openapi/src/test/java/dev/resteasy/examples/openapi/OpenApiTestIT.java
Outdated
Show resolved
Hide resolved
@jamezp Thanks for reviewing! I'll modify the PR according to it. |
@jamezp I reconfigured the example to use $ mvn wildfly:run
...
22:21:17,030 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of "smallrye-openapi-example.war" (runtime-name: "smallrye-openapi-example.war")
22:21:18,171 INFO [org.wildfly.extension.microprofile.openapi.smallrye] (MSC service thread 1-8) WFLYMPOAI0004: Registered MicroProfile OpenAPI endpoint '/openapi' for host 'default-host'
22:21:18,392 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 7) RESTEASY002225: Deploying jakarta.ws.rs.core.Application: class dev.resteasy.examples.openapi.ProductApplication
22:21:18,444 INFO [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 7) HV000001: Hibernate Validator 8.0.0.Final
22:21:18,473 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 7) WFLYUT0021: Registered web context: '/smallrye-openapi-example' for server 'default-server'
22:21:18,507 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0010: Deployed "smallrye-openapi-example.war" (runtime-name : "smallrye-openapi-example.war") And then I can access the service with: ➤ curl http://127.0.0.1:8080/openapi 22:22:00
---
openapi: 3.0.3
info:
title: ProductApplication
version: 1.0.0
servers:
- url: /smallrye-openapi-example
paths:
/products:
get:
responses:
default:
description: return a list of products However, the It seems the project is not deployed: I guess it's the plugin configuration problem, so the testing doesn't deploy the project. However I don't know how to configure it properly, could you please provide some help on this? Thanks! |
After reading this doc: I understand how to configure the plugin for testing. The core part is to add this line: <goal>deploy</goal> |
@jamezp I have finished modifying the example. Could you please help to review it again? Thanks! (If it's okay I'll do squash and force push) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to remove the "smallrye" name as that is an implementation detail. This could just be named "openapi" or "microprofile-openapi", but it shouldn't be named "smallrye-openapi" IMO.
a046fbb
to
df3719e
Compare
@jamezp Thanks for review! I have finished modifications and squash the commits. |
No description provided.