OpenAPITools / OpenAPITools/openapi-generator

[BUG] [CSHARP-NETCORE] format: date is not serialised into OpenAPI full-date format, includes unexpected timestamp.

Open
#11,463 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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?
Description

When generating the client from csharp-netcore template and the parameter is of type: string, format: date it should serialize into the full-date format (https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) : YYYY-MM-DD

At present the template serializes as: YYYY-MM-DDTHH:mm:ss.zzz (date with timestamp)

openapi-generator version

5.3.1 csharp-netcore template

OpenAPI declaration file content or URL

A minimal example of the section of OpenAPI that would generate this:


 - in: query
    name: start
    required: false
    schema:
      type: string
      example: "2018-09-17"
      format: date
Related issues/PRs

Similar issue in a different library https://github.com/RicoSuter/NSwag/issues/1211

Suggest a fix
  • Serialize type: string, format: date into the correct API standard defined by full-date

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by generating a client with the csharp-netcore template from the minimal OpenAPI declaration in the issue, then trace serialization for an optional query parameter with type string and format date. Look for the template's date handling and any related generator tests. Done means the generated client sends the value as YYYY-MM-DD without a timestamp.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.