swagger-api / swagger-api/swagger-codegen

Subclass of Decodable doesn't decode in Swift 4

Open
#7,619 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Hello,
we have a Decodable class "Message" and subclasses of "Message", for example "Question". We always retrieve type Message which is then decoded, but would like to cast some "Messages" to "Questions", but have an issue since the decoding doesn't run for the subclasses.

Is there a way to decode the attributes of the subclass in the super class?

Swagger-codegen version

2.3

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 Swift model-generation templates or entry points that produce Decodable classes in Swagger-codegen 2.3, then reproduce the Message/Question inheritance case described in the issue. Determine whether generated subclass attributes are decoded when a Message is retrieved, and document or fix the behavior if the project supports it.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.