apple / swift-openapi-generator

Generate Swift client and server code from an OpenAPI document.
https://swiftpackageindex.com/apple/swift-openapi-generator/documentation
Apache License 2.0
1.43k stars 116 forks source link

Introduce an "init" subcommand for bootstrapping a package #448

Open czechboy0 opened 11 months ago

czechboy0 commented 11 months ago

Introduce an "init" subcommand for bootstrapping a package.

At the very least, should bootstrap (decision: client vs server, asked by the CLI):

For example: swift-openapi-generator init-package --mode client would create a new package, with a simple OpenAPI doc, and the generator configured etc. This package would work out of the box with swift run. Just need two variants: client and server.

simonjbeaumont commented 11 months ago

Just need two variants: client and server.

No types?

czechboy0 commented 11 months ago

I think splitting types is a more advanced use case where we don't know what to generate for the executable (would there even be an executable?). Client and server are easy, basically our Hello World examples, just with a customizable name etc. But Types might need more thought. But ofc we can include it if we identify a common enough pattern to make it worth it.

simonjbeaumont commented 11 months ago

I was thinking it would generate a library target, without an executable.

Which begs the question: what should we generate for client? I assumed we would generate a library target with package access modifier and an executable, but potentially you thought just an executable?