Почему Allinterceptors не решаются в Apiclient.mustache при использовании openapi-генератор-Maven-Plugin?JAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Почему Allinterceptors не решаются в Apiclient.mustache при использовании openapi-генератор-Maven-Plugin?

Сообщение Anonymous »

Вопрос: < /strong>
Я пытаюсь настроить класс Apiclient, сгенерированный генератором OpenAPI, чтобы включить пользовательский перехватчик. Я хочу обновить метод inithttpclient, чтобы он включал мой класс перехвата.

Код: Выделить всё

private void initHttpClient() {
List interceptors = new ArrayList();
interceptors.add(new derrick.com.app.interceptor.TestLoggingInterceptor());
initHttpClient(interceptors);
}
фактический вывод: [/b]

Код: Выделить всё

private void initHttpClient() {
List interceptors = new ArrayList();
interceptors.add(new ()); // The interceptor package and class name is missing
initHttpClient(interceptors);
}
Конфигурация плагина в pom.xml:

Код: Выделить всё

org.openapitools
openapi-generator-maven-plugin
6.6.0

${project.build.directory}/generated-sources/openapi
za.co.nedbank.groupplatform.generated.model
false
false

true
true
true
java8
true
gson
true




generate-groupcore-clients

generate


${project.basedir}/src/main/resources/swagger/Test_Swagger_v1_1235.yaml
java
okhttp-gson
derrick.com.app.generated.groupcore.client.api
derrick.com.app.generated.groupcore.client
Client
${project.basedir}/src/main/resources/openapi-templates

derrick.com.app.interceptor.TestLoggingInterceptor


true





class:

Код: Выделить всё

package derrick.com.app.interceptor;

import lombok.extern.slf4j.Slf4j;
import okhttp3.Interceptor;
import okhttp3.Response;
import java.io.IOException;

@Slf4j
public class TestLoggingInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
log.info("Intercepting request: {}", chain.request().url());
Response response = chain.proceed(chain.request());
log.info("Received response for {}: {}", chain.request().url(), response.code());
return response;
}
}
apiclient.mustache Шаблон Шаблон Спрыг: Шаблон копируется, но ниже - просто фрагмент
private void initHttpClient() {
List interceptors = new ArrayList();
{{#allInterceptors}}
interceptors.add(new {{.}}());
{{/allInterceptors}}
{{^allInterceptors}}
{{#allInterceptor}}
interceptors.add(new {{{allInterceptor}}}());
{{/allInterceptor}}
{{/allInterceptors}}
initHttpClient(interceptors);
}
< /code>
Проблема: < /strong>
Несмотря на указание Allinterceptors в дополнительных продуктах, сгенерированный код неправильно разрешает имя и упаковку класса. Вместо этого он выводит new (). < /P>
Вопрос: < /strong>
Почему Allinterceptors не разрешаются в шаблоне усов?
Есть ли определенный способ прохождения и доступа к пользовательским дополнительным продуктам в шаблоне?>

Подробнее здесь: https://stackoverflow.com/questions/797 ... penapi-gen
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «JAVA»