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
Make sure that the property interfaceOnly
is exposed
#174
Comments
@ricardozanini
My understanding was that this extension uses the Java client generator, has something changed? / Can this extension also generate server stubs? |
We use the Java Client Generator from the OpenAPI Generator library. Theoretically we can generate server stubs too, but it's out of scope. The idea behind this issue is to implement a similar behavior in the client side, so instead of generating something like this: @Path("/weather")
@RegisterRestClient(baseUri="https://api.openweathermap.org/data/2.5", configKey="openweather_yaml")
@GeneratedClass(value="openweather.yaml", tag = "CurrentWeatherData")
@RegisterProvider(CompositeAuthenticationProvider.class)
@RegisterClientHeaders(AuthenticationPropagationHeadersFactory.class)
@ApplicationScoped
public interface CurrentWeatherDataApi {
/**
* Call current weather data for one location
*
* Access current weather data for any location on Earth including over 200,000 cities! Current weather is frequently updated based on global models and data from more than 40,000 weather stations.
*
*/
@GET
@Produces({"application/json", "text/plain"})
@GeneratedMethod ("CurrentWeatherData")
public Model200 currentWeatherData(
@GeneratedParam("q") @QueryParam("q") String q,
@GeneratedParam("id") @QueryParam("id") String id,
@GeneratedParam("lat") @QueryParam("lat") String lat,
@GeneratedParam("lon") @QueryParam("lon") String lon,
@GeneratedParam("zip") @QueryParam("zip") String zip,
@GeneratedParam("units") @QueryParam("units") String units,
@GeneratedParam("lang") @QueryParam("lang") String lang,
@GeneratedParam("mode") @QueryParam("mode") String mode
);
} We do this: @Path("/weather")
@RegisterRestClient(baseUri="https://api.openweathermap.org/data/2.5", configKey="openweather_yaml")
@GeneratedClass(value="openweather.yaml", tag = "CurrentWeatherData")
@RegisterProvider(CompositeAuthenticationProvider.class)
@RegisterClientHeaders(AuthenticationPropagationHeadersFactory.class)
@ApplicationScoped
public interface CurrentWeatherDataApi {
/**
* Call current weather data for one location
*
* Access current weather data for any location on Earth including over 200,000 cities! Current weather is frequently updated based on global models and data from more than 40,000 weather stations.
*
*/
@GET
@Produces({"application/json", "text/plain"})
@GeneratedMethod ("CurrentWeatherData")
public Response currentWeatherData(
@GeneratedParam("q") @QueryParam("q") String q,
@GeneratedParam("id") @QueryParam("id") String id,
@GeneratedParam("lat") @QueryParam("lat") String lat,
@GeneratedParam("lon") @QueryParam("lon") String lon,
@GeneratedParam("zip") @QueryParam("zip") String zip,
@GeneratedParam("units") @QueryParam("units") String units,
@GeneratedParam("lang") @QueryParam("lang") String lang,
@GeneratedParam("mode") @QueryParam("mode") String mode
);
} @KiMurray that's what you're looking for, right? |
I don't think so. We want each method in the Client API to have the return type Response. Overriding the current return type generated from the OAS.
into
Where Response is Javax.ws.rs.core.Response Thanks |
Sorry @KiMurray. It seems to be the same as @ricardozanini is saying in his previous comment. |
@KiMurray, as also pointed out by @hbelmiro, that's precisely what I proposed in my comment. Or are we failing to understand your requirement? 🤔 LOL terribly sorry, I copied and paste the wrong snip. Fixed the original comment. I thought one thing and pasted another. 🤦 |
@ricardozanini, yes! your updated comment is exactly what we need. Had me a little confused for a moment there. 😄 |
@ricardozanini this issue's requirement is not very clear.
|
The problem is that this property name can be used for a server side or client code gen, hence the confusion. But no, we won't generate server-side code. The requirement is to generate the Model with the |
See: https://openapi-generator.tech/docs/generators/jaxrs-spec/
We already use this generator underneath. The property
interfaceOnly
can be exposed by the plugin. The trick here is also to update the templates to ensure that the property is considered.Request: #128 (comment)
The text was updated successfully, but these errors were encountered: