swagger-api / swagger-api/swagger-codegen
[Swift4] Dictionary generated, not [AnyHashable: String]
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
A schema of type object and additionalProperties type: string generates a Swift Dictionary, I would expect a [AnyHashable: String]:
public struct Test: Codable {
public var test: Dictionary
public init(test: Dictionary) {
self.test = test
}
}
Swagger-codegen version
3.0.3
Swagger declaration file content or url
openapi: 3.0.0
paths:
/:
get:
parameters:
responses:
'200':
content:
components:
schemas:
Test:
required:
- test
type: object
properties:
test:
type: object
additionalProperties:
type: string
Command line used for generation
swagger-codegen generate -i test.yaml -l swift4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided OpenAPI YAML and swagger-codegen generate -i test.yaml -l swift4 command. Start by tracing the Swift4 generator templates or type-mapping entry point that produces public var test: Dictionary; done means the generated property and initializer use the expected [AnyHashable: String] type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100