API package for code generated by Swift OpenAPI Generator.
APACHE-2.0 License
This library provides common abstractions and helper functions used by the client and server code generated by Swift OpenAPI Generator.
It contains:
swift-openapi-generator
package plugin.ClientTransport
, ServerTransport
, ClientMiddleware
, and ServerMiddleware
.Many of the HTTP currency types used are defined in the Swift HTTP Types library.
Tip: Check out the example projects focused on middlewares.
Add the package dependency in your Package.swift
:
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"),
Next, in your target, add OpenAPIRuntime
to your dependencies:
.target(name: "MyTarget", dependencies: [
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
]),
The next step depends on your use case.
The generated code depends on types from this library. Check out the adoption guides in the Swift OpenAPI Generator documentation to see how the packages fit together.
Swift OpenAPI Generator generates client and server code that is designed to be used with pluggable transports and middlewares.
Implement a new transport or middleware by providing a type that adopts one of the protocols from the runtime library:
You can also publish your transport or middleware as a Swift package to allow others to use it with their generated code.
To learn more, check out the full documentation.