-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
#6773 introduced a change where Set is used instead of Arrays when the array spec has the uniqueItems flag set. Set however needs all elements to conform to Hashable, which they do not.
openapi-generator version
v5.0.0-beta a77fd44
was working in v4.3.1 003165c
OpenAPI declaration file content or url
https://gist.github.com/pgrosslicht/c519f7e011eee94ed356779a0096e256
Generation Details
swift5 generator with everything as default
Steps to reproduce
java -jar openapi-generator-cli-5.0.0-beta.jar generate -i error.yaml -g swift5
swift buildBuild will fail with
OpenAPIClient/Classes/OpenAPIs/APIs/PetsAPI.swift:20:37: error: type 'Pet' does not conform to protocol 'Hashable'
open class func createPets(pet: Set<Pet>, apiResponseQueue: DispatchQueue = OpenAPIClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {Related issues/PRs
Introduced in #6773
Suggest a fix
- Make all structs conform to
Hashable. This should work since Swift can automatically synthesize theHashableprotocol in most cases, but might lead to some edge cases where Swift is not capable of synthesizing them. - Introduce config option for the change original change in [SWIFT5] Add the ability to turn uniqueItems array into Set in swift. #6773 and the suggested
Hashableconformance.
Reactions are currently unavailable