swagger-api / swagger-api/swagger-codegen

Swift4: Need initializer with default value '=nil'

Open
#6,957 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Swift Enhancement: General General: Suggestion help wanted
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I am filing this issue to track the discussion which took place in another issue for swift4: #6641

The request was to have a default value '=nil' in the additional initializer for swift4-generated models.
Example:

public init(foo: String?=nil, bar: String?=nil) {
        self.foo = foo
        self.bar = bar
}
Swagger-codegen version

All

Swagger declaration file content or url

This is a feature request. See the discussion at the end of the issue listed above for context.

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

Read the discussion in issue #6641, then locate the Swift4 model-generation templates and their additional initializer. Confirm the requested default nil values in generated initializers and verify the generated Swift model output matches the example.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.