Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback on Swift API client generator #5761

Open
wing328 opened this issue Jun 2, 2017 · 0 comments
Open

Feedback on Swift API client generator #5761

wing328 opened this issue Jun 2, 2017 · 0 comments

Comments

@wing328
Copy link
Contributor

wing328 commented Jun 2, 2017

Description

After chatting with @banjun (the creator of https://github.com/banjun/SwiftBeaker), here are some feedbacks from him for the Swift API client generator:

# strongly typed either (multiple) response cases

not good: `(_ data: [Pet]?,_ error: Error?)`
…reads as `(nil, nil)` and `(non-nil, non-nil)` are possible.
good: `Result<[Pet], Error>` or `throws`

moreover, SwiftBeaker generates response enum with exact cases for multi-response endpoints.
https://github.com/banjun/SwiftBeaker/blob/482c5bdb9b4a5d82017ce37c32f6eb3a3383e216/Examples/05.%20Responses.swift#L105


# type-checked nullabilities

https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/Animal.swift

Generated models seem to have its default empty initializers `public init() {}`.
Default initializers can be used to bypass compiler checks.
When `className` is required, it should be non-optional `String` and be initialized with init params, in Swifty code.

Just using struct generates more simple models (if we can ignore the inheritance of api data structure definition. inheritance is too OOP…)
Swagger-codegen version

Latest master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant