swagger-api / swagger-api/swagger-codegen

[C#] How to mix DateTime and DateTimeOffset in a model?

Open
#5,804 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: C-Sharp General: Question
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

My model contains properties of both types DateTime and DateTimeOffset. It is crucial for me to keep it that way. But unfortunately, as far as I understand, Swagger can only either generated all of them as DateTime (default behaviour) or as DateTimeOffset (with flag specified).
Is there a way to mix those?

Swagger-codegen version

v2.2.1

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

The issue names Swagger Codegen v2.2.1 but does not identify a file, template, test, or entry point. Start by locating the C# generation handling for DateTime and DateTimeOffset and determine whether type selection can vary per model property. Done would be support for a model containing both types, with coverage demonstrating the generated results.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.