swagger-api / swagger-api/swagger-codegen-generators

[swift 5] Default value for optional in init parameters, like done for Swift 4 generator

Open
#709 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

Hi.

Like done for Swift 4 generator it would be helpful if Swift model objects had a default nil value for optional parameters.
This fix has already be done for issue #467 for Swift 4 generator and merged into master, but the Swift 5 generator works differently.

Could I send a pull request for this change in the template?

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 comparing the Swift 5 generator template with the Swift 4 change from issue #467. Trace how Swift 5 model initializer parameters are rendered, then verify that optional parameters receive a default nil value without changing required parameters. Done means the generated Swift model code matches the requested optional-parameter behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.