Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #5444
Closed
Open
Issue created Feb 26, 2020 by Administrator@rootContributor

[BUG] [JAVA | CLIENT Generator | Spring Boot] RestTemplate client incompatibility between JsonDeserializer and ThreeTenDateTimeDeserializerBase

Created by: delitahub

Description

I have a Spring boot service that needs to make a call to another Spring boot service. Tried generating a RestTemplate client with the java generator to be used within the first spring boot service. However, among the client classes that are generated the CustomInstantDeserializer can't compile due to an incompatibility between com.fasterxml.jackson.databind.JsonDeserializer and com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase.

openapi-generator version

openapi-generator-maven-plugin 4.2.3

Generated client within project that had spring boot dependencies: spring-boot-starter-parent 2.2.4.RELEASE spring-boot-starter-web 2.2.4.RELEASE org.openapitools.jackson-databind-nullable 0.2.1 org.openapitools.openapi-generator 4.2.3

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  version: 1.0.0
  title: Petstore
paths: 
  /pets:
    get:
      description: Returns all pets from the system that the user has access to
      operationId: getAllPets
      responses:
        '200':
          description: A list of pets.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Pet'
components:
  schemas:
    Pet:
      type: object
      properties:
        name:
          type: string
        petType:
          type: string
Command line used for generation

pom.zip

Steps to reproduce

Use the maven plugin to generate the RestTemplate client from the yml. This will create client classes including the CustomInstantDeserializer.java. On compilation an error will be thrown saying the following message:

[ERROR] /src/gen/java/main/com/store/pets/CustomInstantDeserializer.java:[31,8] com.store.pets.CustomInstantDeserializer is not abstract and does not override abstract method withLeniency(java.lang.Boolean) in com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase [ERROR] /target/generated-sources/openapi/src/gen/java/main/com/store/pets/CustomInstantDeserializer.java:[150,33] withDateFormat(org.threeten.bp.format.DateTimeFormatter) in com.store.pets.CustomInstantDeserializer cannot override withDateFormat(org.threeten.bp.format.DateTimeFormatter) in com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase [ERROR] return type com.fasterxml.jackson.databind.JsonDeserializer is not compatible with com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase [ERROR] /target/generated-sources/openapi/src/gen/java/main/com/store/pets/CustomInstantDeserializer.java:[149,3] method does not override or implement a method from a supertype

Related issues/PRs

Could not find.

Suggest a fix

As a workaround, one can specify a dateLibrary explicitly in the configOptions, and the code will generate and compile.

<dateLibrary>joda</dateLibrary> or <dateLibrary>java8</dateLibrary>

Assignee
Assign to
Time tracking