Code generator to generate SmokeFramework-based applications from service models.
Clone this repository to your local machine.
You will point this code generator to this directory to output the generated code.
Follow the Swagger specification to create an API specification for your service.
From within your checked out copy of this repository, run this command-
swift run -c release SmokeFrameworkApplicationGenerate \ --base-file-path <the path to where you want the service to be generated> \ --base-name <a base name for your service (without the "Service" postfix)> \ --model-path <the path to the Swagger model you created> \ --generation-type [server: to generate a new service|serverUpdate: to preserve changes to existing operation handlers] [--model-override-path <optionally the path to a json file that specifies various overrides to the model>]
And example command would look like this-
swift run -c release SmokeFrameworkApplicationGenerate \ --base-file-path /Volumes/Workspace/smoke-framework-examples/PersistenceExampleService \ --base-name PersistenceExample \ --model-path /Volumes/Workspace/smoke-framework-examples/PersistenceExampleService/Swagger.yaml \ --generation-type server \ --model-override-path /Volumes/Workspace/smoke-framework-examples/PersistenceExampleService/modelOverride.json
An example service based on the command above can be found here.
The code generator will produce a Swift Package Manager repository with the following directory structure-
- Package.swift - .swiftlint - .gitignore - Sources - (base-name)Client - (base-name)Model - (base-name)Operations - (base-name)OperationsHTTP1 - (base-name)Service - Tests - LinuxMain.swift - <base-name>OperationsTests
The following three sections of the repository provides initial stubs and can be filled out as required for the service.
serverUpdate will not overwrite changes in these sections-
The following three section contain code generated code to help the service operate but should not be manually modified.
serverUpdate will overwrite changes in these sections-
This library is licensed under the Apache 2.0 License.
|Last commit: 2 days ago|
This release of SmokeFrameworkApplicationGenerate provides compatibility with Swift 5.1, Swift 5.2 and Swift 5.3 using SwiftNIO 2.x and SmokeFramework 2.x.