Skip to content

[BUG] [Java] [native] [java8] [typescript-fetch] Query date-time parameter handling is buggy #8615

@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

In typescript-fetch and java native there have to be serializers for date-time parameters. In the dotnetcore generator the correct serialization is already done.

openapi-generator version
OpenAPI declaration file content or url
openapi: 3.0.3
info:
  title: date-test
  version: 1.0.0
paths:
  /test:
    get:
      operationId: test
      parameters:
        - name: a
          in: query
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: string
Generation Details

Generate typescript with typescript-fetch, generate java with native and java8.

Steps to reproduce
Related issues/PRs
Suggest a fix

Typescript:

In the generated method queryString in runtime.ts there has to be an additional handling of Date like

if (value instanceof Date) {
    return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
}

Java:
In the generated method valueToString there has to be used a serializer like

if (value instanceof OffsetDateTime) {
      return ((OffsetDateTime) value).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
}

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