OpenAPITools / OpenAPITools/openapi-generator

[REQ] [Question] [Swift6] Generating Codable Models without CodingKeys and encode(to:) method

Open
#22,490 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

I have a spec.yaml file with an object having two date attributes, but with a different format (once "yyyy-MM-dd" and once "yyyy-MM-dd'T'HH:mm:ss"). I handle this case by writing a custom encode(to:) method.

By using the Swift6 generator, it always overwrites this method, and I have to intervene manually.

Describe the solution you'd like

I read the documentation, but I did not find a way to generate the models without the encode(to:) method. Maybe there is already a way to do it? Else, would it make sense to include such an option?

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 locating the Swift6 generator implementation, its model templates, and the related generator options or documentation. Check how CodingKeys and encode(to:) are currently produced. Done means a documented option can suppress those generated methods while preserving the existing default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, swift
Domain
devtools, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.