SwagGen icon indicating copy to clipboard operation
SwagGen copied to clipboard

Unable to reference types inside generated API client using module's namespace #template

Open Kastet opened this issue 5 years ago • 1 comments

If using Cocoapods (not sure if true for other DMs), public struct {{ options.name }} will be matching your generated API client Swift module name which breaks types lookup. For example, if your codebase or another module has a type User and your generated API client has User, then referencing User from generated API client via {{ options.name }}.User won't work.

Apparently, it's a limitation of Swift compiler - https://bugs.swift.org/browse/SR-1386

Suggest moving away from public struct {{ options.name }} by splitting it up into public struct Config that holds coding options and Server and public struct Operation to namespace operations.

What do you think @yonaskolb ?

Kastet avatar Apr 18 '19 01:04 Kastet

@yonaskolb have you had a chance to review this suggestion? Do you see a way to work around this problem without making braking changes?

Kastet avatar Apr 24 '19 00:04 Kastet