Skip to content

[BUG] [Java] [Native] Keep timezone for OffsetDateTime in responses #8611

@Reinhard-PTV

Description

@Reinhard-PTV

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The JSON object mapper used for deserialization of java OffsetDateTimes does not keep the timezone as returned by the service.

openapi-generator version

5.0.0

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  title: keep-timezone
  version: 1.0.0
paths:
  /test:
    get:
      operationId: test
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response'
components:
  schemas:
    Response:
      type: object
      properties:
        date:
          nullable: true
          type: string
          format: date-time
      
Generation Details

Generate java client with native library.

Steps to reproduce
Related issues/PRs
Suggest a fix

Adding mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE) to the object mapper configuration fixes the bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions