You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Имеется общий интерфейс (There is a common interface):
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "componentType", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = ComponentTableRecommendations.class, name = "columnRecommendations"),
@JsonSubTypes.Type(value = ComponentFormRecommendations.class, name = "fillRecommendations"),
@JsonSubTypes.Type(value = ComponentName.class, name = "name"),
@JsonSubTypes.Type(value = ComponentHeading.class, name = "heading"),
@JsonSubTypes.Type(value = ComponentHeading.class, name = "subtitle"),
@JsonSubTypes.Type(value = ComponentField.class, name = "field"),
@JsonSubTypes.Type(value = ComponentUneditable.class, name = "uneditable"),
@JsonSubTypes.Type(value = ComponentTable.class, name = "table"),
@JsonSubTypes.Type(value = ComponentSharedRecommendation.class, name = "relatedBlockFields"),
@JsonSubTypes.Type(value = ComponentDirectoryField.class, name = "directory"),
@JsonSubTypes.Type(value = ComponentDirectoryListField.class, name = "directoryList"),
@JsonSubTypes.Type(value = ComponentDate.class, name = "date"),
@JsonSubTypes.Type(value = ComponentYearPeriod.class, name = "yearPeriod"),
@JsonSubTypes.Type(value = ComponentSeparator.class, name = "separator"),
@JsonSubTypes.Type(value = ComponentSelectedText.class, name = "selectedText"),
@JsonSubTypes.Type(value = ComponentTextEditor.class, name = "textEditor"),
@JsonSubTypes.Type(value = ComponentSubHeading.class, name = "subHeading"),
@JsonSubTypes.Type(value = ComponentIntegerFlatTable.class, name = "componentIntegerFlatTable"),
@JsonSubTypes.Type(value = ComponentStringFlatTable.class, name = "componentStringFlatTable"),
@JsonSubTypes.Type(value = ComponentCheckbox.class, name = "checkbox"),
@JsonSubTypes.Type(value = ComponentOptionalText.class, name = "optionalText"),
@JsonSubTypes.Type(value = ComponentId.class, name = "id"),
@JsonSubTypes.Type(value = ComponentDescription.class, name = "description"),
@JsonSubTypes.Type(
value = ComponentTitledDropdownContainer.class,
name = "titledDropdownContainer"),
// специфичные компоненты
@JsonSubTypes.Type(value = ComponentRoadCard.class, name = "roadCard"),
@JsonSubTypes.Type(value = ComponentRevisionDocuments.class, name = "revisionDocuments"),
@JsonSubTypes.Type(value = ComponentMajorProjectCost.class, name = "majorProjectCost"),
@JsonSubTypes.Type(value = ComponentAuditRequisities.class, name = "auditRequisities"),
@JsonSubTypes.Type(value = ComponentTypeNameValue.class, name = "typeNameValue"),
@JsonSubTypes.Type(value = ComponentDesignProject.class, name = "designProject"),
@JsonSubTypes.Type(
value = ComponentRevisionDocumentsByTypes.class,
name = "revisionDocumentsByTypes")
})
public interface IComponent extends Serializable, Cloneable {
@JsonIgnore
String getComponentType();
....
Пример дочернего класса (Child class example): @DaTa @SuperBuilder @NoArgsConstructor(access = AccessLevel.PROTECTED) // FOR JSON
@JsonTypeName("checkbox")
public class ComponentCheckbox extends AbstractComponent {
/** Описание /
private String description;
/* Значение */
private boolean value;
@Override
public String getComponentType() {
return ComponentEnum.CHECKBOX.getFullName();
}
...
При генерации плагином создаются интерфейсы, например (When generated by the plugin, interfaces are created, for example):
/** OneOfSummaryReportPartitionComponentsItems */
public interface OneOfSummaryReportPartitionComponentsItems {}
При использовании сгенерированного клиента падают ошибки вида (When using the generated client, errors like):
"Unable to invoke no-args constructor for interface ru.eiisrih.integration.slp.report.client.model.OneOfSummaryReportPartitionComponentsItems. Registering an InstanceCreator with Gson for this type may fix this problem."
Как решить данную проблему? (How to solve this problem?)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Приветствую! (Hello!)
io.swagger.codegen.v3 swagger-codegen-maven-plugin 3.0.29 generate [${inputSpec}](http://localhost:8082/slp-report/api-docs) ru.eiisrih.integration.slp.report.client.model ru.eiisrih.integration.slp.report.client.api ${basedir}/target/generated-sources java false true false true true trueЯ использую следующий плагин (I am using the following plugin):
Имеется общий интерфейс (There is a common interface):
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "componentType", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = ComponentTableRecommendations.class, name = "columnRecommendations"),
@JsonSubTypes.Type(value = ComponentFormRecommendations.class, name = "fillRecommendations"),
@JsonSubTypes.Type(value = ComponentName.class, name = "name"),
@JsonSubTypes.Type(value = ComponentHeading.class, name = "heading"),
@JsonSubTypes.Type(value = ComponentHeading.class, name = "subtitle"),
@JsonSubTypes.Type(value = ComponentField.class, name = "field"),
@JsonSubTypes.Type(value = ComponentUneditable.class, name = "uneditable"),
@JsonSubTypes.Type(value = ComponentTable.class, name = "table"),
@JsonSubTypes.Type(value = ComponentSharedRecommendation.class, name = "relatedBlockFields"),
@JsonSubTypes.Type(value = ComponentDirectoryField.class, name = "directory"),
@JsonSubTypes.Type(value = ComponentDirectoryListField.class, name = "directoryList"),
@JsonSubTypes.Type(value = ComponentDate.class, name = "date"),
@JsonSubTypes.Type(value = ComponentYearPeriod.class, name = "yearPeriod"),
@JsonSubTypes.Type(value = ComponentSeparator.class, name = "separator"),
@JsonSubTypes.Type(value = ComponentSelectedText.class, name = "selectedText"),
@JsonSubTypes.Type(value = ComponentTextEditor.class, name = "textEditor"),
@JsonSubTypes.Type(value = ComponentSubHeading.class, name = "subHeading"),
@JsonSubTypes.Type(value = ComponentIntegerFlatTable.class, name = "componentIntegerFlatTable"),
@JsonSubTypes.Type(value = ComponentStringFlatTable.class, name = "componentStringFlatTable"),
@JsonSubTypes.Type(value = ComponentCheckbox.class, name = "checkbox"),
@JsonSubTypes.Type(value = ComponentOptionalText.class, name = "optionalText"),
@JsonSubTypes.Type(value = ComponentId.class, name = "id"),
@JsonSubTypes.Type(value = ComponentDescription.class, name = "description"),
@JsonSubTypes.Type(
value = ComponentTitledDropdownContainer.class,
name = "titledDropdownContainer"),
// специфичные компоненты
@JsonSubTypes.Type(value = ComponentRoadCard.class, name = "roadCard"),
@JsonSubTypes.Type(value = ComponentRevisionDocuments.class, name = "revisionDocuments"),
@JsonSubTypes.Type(value = ComponentMajorProjectCost.class, name = "majorProjectCost"),
@JsonSubTypes.Type(value = ComponentAuditRequisities.class, name = "auditRequisities"),
@JsonSubTypes.Type(value = ComponentTypeNameValue.class, name = "typeNameValue"),
@JsonSubTypes.Type(value = ComponentDesignProject.class, name = "designProject"),
@JsonSubTypes.Type(
value = ComponentRevisionDocumentsByTypes.class,
name = "revisionDocumentsByTypes")
})
public interface IComponent extends Serializable, Cloneable {
....
Пример дочернего класса (Child class example):
@DaTa
@SuperBuilder
@NoArgsConstructor(access = AccessLevel.PROTECTED) // FOR JSON
@JsonTypeName("checkbox")
public class ComponentCheckbox extends AbstractComponent {
/** Описание /
private String description;
/* Значение */
private boolean value;
...
При генерации плагином создаются интерфейсы, например (When generated by the plugin, interfaces are created, for example):
/** OneOfSummaryReportPartitionComponentsItems */
public interface OneOfSummaryReportPartitionComponentsItems {}
При использовании сгенерированного клиента падают ошибки вида (When using the generated client, errors like):
"Unable to invoke no-args constructor for interface ru.eiisrih.integration.slp.report.client.model.OneOfSummaryReportPartitionComponentsItems. Registering an InstanceCreator with Gson for this type may fix this problem."
Как решить данную проблему? (How to solve this problem?)
Beta Was this translation helpful? Give feedback.
All reactions