forked from loafle/openapi-generator-original
Allow specification of configkey for microprofile clients (#10693)
This commit is contained in:
parent
ae39d782e0
commit
6bbafdfa30
@ -5,3 +5,4 @@ inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: microprofile-rest-client
|
||||
configKey: petstore
|
||||
|
@ -56,6 +56,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
public static final String USE_PLAY_WS = "usePlayWS";
|
||||
public static final String PLAY_VERSION = "playVersion";
|
||||
public static final String ASYNC_NATIVE = "asyncNative";
|
||||
public static final String CONFIGKEY = "configKey";
|
||||
public static final String PARCELABLE_MODEL = "parcelableModel";
|
||||
public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException";
|
||||
public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode";
|
||||
@ -102,6 +103,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
protected boolean usePlayWS = false;
|
||||
protected String playVersion = PLAY_26;
|
||||
protected String microprofileFramework = MICROPROFILE_DEFAULT;
|
||||
protected String configKey = null;
|
||||
|
||||
protected boolean asyncNative = false;
|
||||
protected boolean parcelableModel = false;
|
||||
@ -281,6 +283,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
additionalProperties.put(MICROPROFILE_FRAMEWORK, microprofileFramework);
|
||||
|
||||
if (additionalProperties.containsKey(CONFIGKEY)) {
|
||||
this.setConfigKey(additionalProperties.get(CONFIGKEY).toString());
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(ASYNC_NATIVE)) {
|
||||
this.setAsyncNative(convertPropertyToBooleanAndWriteBack(ASYNC_NATIVE));
|
||||
}
|
||||
@ -964,6 +970,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
this.microprofileFramework = microprofileFramework;
|
||||
}
|
||||
|
||||
public void setConfigKey(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public void setParcelableModel(boolean parcelableModel) {
|
||||
this.parcelableModel = parcelableModel;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
|
||||
*/
|
||||
{{/appName}}
|
||||
|
||||
@RegisterRestClient
|
||||
@RegisterRestClient{{#configKey}}(configKey="{{configKey}}"){{/configKey}}
|
||||
@RegisterProvider(ApiExceptionMapper.class)
|
||||
@Path("{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}{{commonPath}}")
|
||||
public interface {{classname}} {
|
||||
|
@ -36,7 +36,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
|
||||
*
|
||||
*/
|
||||
|
||||
@RegisterRestClient
|
||||
@RegisterRestClient(configKey="petstore")
|
||||
@RegisterProvider(ApiExceptionMapper.class)
|
||||
@Path("/pet")
|
||||
public interface PetApi {
|
||||
|
@ -34,7 +34,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
|
||||
*
|
||||
*/
|
||||
|
||||
@RegisterRestClient
|
||||
@RegisterRestClient(configKey="petstore")
|
||||
@RegisterProvider(ApiExceptionMapper.class)
|
||||
@Path("/store")
|
||||
public interface StoreApi {
|
||||
|
@ -34,7 +34,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
|
||||
*
|
||||
*/
|
||||
|
||||
@RegisterRestClient
|
||||
@RegisterRestClient(configKey="petstore")
|
||||
@RegisterProvider(ApiExceptionMapper.class)
|
||||
@Path("/user")
|
||||
public interface UserApi {
|
||||
|
Loading…
x
Reference in New Issue
Block a user