Skip to content

Commit

Permalink
Merge pull request swagger-api#3 from Saritasa/feature/super.encode
Browse files Browse the repository at this point in the history
Call super.encode
  • Loading branch information
plankton4 authored Jun 5, 2024
2 parents e5530e5 + 0b80015 commit 22f5cb4
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,16 @@ open class {{classname}}: {{#parent}}{{{parent}}}{{/parent}}{{^parent}}Codable{{
// Encodable protocol methods

public {{#parent}}override {{/parent}}func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
{{#vars}}
try container.encode{{^required}}IfPresent{{/required}}({{{name}}}, forKey: "{{{baseName}}}"{{#isDate}}, dateFormat: CodableHelper.DateFormat.date{{/isDate}})
{{/vars}}
{{#additionalPropertiesType}}
try container.encodeMap(additionalProperties)
{{/additionalPropertiesType}}
{{#parent}}
try super.encode(to: encoder)
{{/parent}}
}

// Decodable protocol methods
Expand Down

0 comments on commit 22f5cb4

Please # to comment.