Adding AddonModule to SchemaGeneratorConfigBuilder not working
ad3luc opened this issue · comments
Hi, I'm having this problem:
pom.xml
<dependency>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-module-jackson</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-module-javax-validation</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.github.imifou</groupId>
<artifactId>jsonschema-module-addon</artifactId>
<version>1.2.0</version>
</dependency>
When I start the application Spring boot:
AddonModule addonModule = new AddonModule();
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(objectMapper, OptionPreset.PLAIN_JSON)
.with(addonModule);
I get this error:
Caused by: java.lang.AbstractMethodError: Receiver class com.github.imifou.jsonschema.module.addon.AddonModule$$Lambda$1347/0x0000000840a8ec40 does not define or inherit an implementation of the resolved method 'abstract java.lang.Object apply(com.github.victools.jsonschema.generator.TypeScope)' of interface com.github.victools.jsonschema.generator.ConfigFunction.
at com.github.victools.jsonschema.generator.SchemaGeneratorTypeConfigPart.lambda$getFirstDefinedValue$0(SchemaGeneratorTypeConfigPart.java:43)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1631)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
at com.github.victools.jsonschema.generator.SchemaGeneratorTypeConfigPart.getFirstDefinedValue(SchemaGeneratorTypeConfigPart.java:45)
at com.github.victools.jsonschema.generator.SchemaGeneratorTypeConfigPart.resolveTitle(SchemaGeneratorTypeConfigPart.java:99)
at com.github.victools.jsonschema.generator.impl.SchemaGeneratorConfigImpl.resolveTitle(SchemaGeneratorConfigImpl.java:214)
at com.github.victools.jsonschema.generator.impl.AttributeCollector.collectFieldAttributes(AttributeCollector.java:64)
at com.github.victools.jsonschema.generator.impl.SchemaGenerationContextImpl.populateField(SchemaGenerationContextImpl.java:416)
at com.github.victools.jsonschema.generator.impl.SchemaGenerationContextImpl.lambda$populateFields$3(SchemaGenerationContextImpl.java:373)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
at com.github.victools.jsonschema.generator.impl.SchemaGenerationContextImpl.populateFields(SchemaGenerationContextImpl.java:373)
at com.github.victools.jsonschema.generator.impl.SchemaGenerationContextImpl.collectObjectProperties(SchemaGenerationContextImpl.java:328)
at com.github.victools.jsonschema.generator.impl.SchemaGenerationContextImpl.generateObjectDefinition(SchemaGenerationContextImpl.java:299)
at com.github.victools.jsonschema.generator.impl.SchemaGenerationContextImpl.traverseGenericType(SchemaGenerationContextImpl.java:252)
at com.github.victools.jsonschema.generator.impl.SchemaGenerationContextImpl.traverseGenericType(SchemaGenerationContextImpl.java:195)
at com.github.victools.jsonschema.generator.impl.SchemaGenerationContextImpl.parseType(SchemaGenerationContextImpl.java:86)
at com.github.victools.jsonschema.generator.SchemaGenerator.generateSchema(SchemaGenerator.java:68)
Seems that the error is on the
<version.generator>3.2.0</version.generator>
upgrading the library to everything works
<version.generator>4.0.0</version.generator>
Maybe we can try to write a test that could cover this type of error
Hi @ad3luc ,
Thank you, for your contribution, I have already identified this problem due to the latest version of jsonschema-generator.
I will make the fix as soon as possible.
I confirm that upgrading to recent 4.1.0 works as well
Hello guys. I have the same problem.
I try update jsonschema-generator to 4.1.0 but I steel have this error:
Caused by: java.lang.AbstractMethodError: Receiver class com.github.imifou.jsonschema.module.addon.AddonModule$$Lambda$1218/0x0000000800e12040 does not define or inherit an implementation of the resolved method abstract apply(Lcom/github/victools/jsonschema/generator/TypeScope;)Ljava/lang/Object; of interface com.github.victools.jsonschema.generator.ConfigFunction. at com.github.victools.jsonschema.generator.SchemaGeneratorTypeConfigPart.lambda$getFirstDefinedValue$0(SchemaGeneratorTypeConfigPart.java:43) ~[jsonschema-generator-4.1.0.jar:na]
@Pylypchuk, in order to make it work you should bump generator-version in the addon's pom then rebuild the addon.
@Pylypchuk, in order to make it work you should bump generator-version in the addon's pom then rebuild the addon.
Thanks @SamPanza
@imIfOu Any ETA on this ? I badly need to use this addon module with the latest version of json schema generator and cannot use it until this issue is resolved.
Sorry, for the late, I fix this issue in the latest version 1.21