Apple has released the stable 1.0 version of the Swift OpenAPI Generator 1.0, for generating Swift client and server code from an OpenAPI document, Swift developers announced on January 31.
Swift OpenAPI Generator generates the code needed to make API calls or implement API servers. The code is generated automatically at build time, so it is in sync with the OpenAPI document and does not need to be committed to a source repository. OpenAPI is an open standard for describing the behavior of HTTP services, and features an ecosystem of tools.
Swift OpenAPI Generator works with OpenAPI Specification versions 3.0 and 3.1. It supports streaming request and response bodies, backed by AsyncSequence
, enabling use cases such as large payloads without buffering and JSON event streams. It supports common content types including JSON, URL-encoded form, Base64, plain text, and raw bytes, all of which are represented as value types with type-safe properties, and offers flexible client, server, and middleware abstractions, decoupling the generated code from the HTTP client library and web framework.
With Swift OpenAPI Generator, code can be generated to make type-safe requests to an API server with any HTTP client library. The plugin also can generate code to bootstrap an HTTP server with any web framework using business logic that is decoupled from network requests.