SwagGen
SwagGen copied to clipboard
Unable to reference types inside generated API client using module's namespace #template
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 ?
@yonaskolb have you had a chance to review this suggestion? Do you see a way to work around this problem without making braking changes?