swagger-api / swagger-api/swagger-codegen

Nested objects are creating as "Any" when I am using openapi 3.0.xx spec with latest versions of swagger codegen in swift5

Open
#11,887 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
Swagger-codegen version
Swagger declaration file content or url
. (https://gist.github.com/VivekKasthuri/321bf8c8cb77bcf03b516099ded1f184)
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

"additionalProperties": {
"description": "Map of additional attributes",
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"description": "key.",
"type": "string",
"pattern": ".$",
"minLength": 0,
"maxLength": 255
},
"value": {
"description": "value against the key.",
"type": "string",
"pattern": ".
$",
"minLength": 0,
"maxLength": 255
}
}
}

For the above definition in swift its creating Any object rather than perticular one.

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

No repository file, test, generator version, or command is named. Start by reproducing the Swift generation from the linked schema, then trace how the Swift generator handles an additionalProperties array whose items are nested objects. Done means the generated model represents the nested key/value object rather than Any, with a regression test covering this schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, swift
Domain
api, 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.