You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#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.
java -jar openapi-generator-cli-5.0.0-beta.jar generate -i error.yaml -g swift5
swift build
Build 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)) {
Make all structs conform to Hashable. This should work since Swift can automatically synthesize the Hashable protocol in most cases, but might lead to some edge cases where Swift is not capable of synthesizing them.
Bug Report Checklist
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 toHashable
, 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
Build will fail with
Related issues/PRs
Introduced in #6773
Suggest a fix
Hashable
. This should work since Swift can automatically synthesize theHashable
protocol in most cases, but might lead to some edge cases where Swift is not capable of synthesizing them.Hashable
conformance.The text was updated successfully, but these errors were encountered: