You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update and polish for README and DocC landing page (#479)
### Motivation
Ahead of 1.0, we want to give the README and DocC landing page a
refresh.
### Modifications
Updates to the README and DocC landing page.
### Result
Updates to the README and DocC landing page.
### Test Plan
Review.
@@ -8,60 +8,170 @@ Generate Swift client and server code from an OpenAPI document.
8
8
9
9
## Overview
10
10
11
-
[OpenAPI][openapi] is an open specification for documenting HTTP APIs.
11
+
[OpenAPI][openapi] is a specification for documenting HTTP services. An OpenAPI document is written in either YAML or JSON, and can be read by tools to help automate workflows, such as generating the necessary code to send and receive HTTP requests.
12
12
13
13
Swift OpenAPI Generator is a Swift package plugin that can generate the ceremony code required to make API calls, or implement API servers.
14
14
15
-
## Repository organization
15
+
The code is generated at build-time, so it's always in sync with the OpenAPI document and doesn't need to be committed to your source repository.
16
16
17
-
The Swift OpenAPI Generator project is split across multiple repositories to enable extensibility and minimize dependencies in your project.
17
+
## Features
18
+
19
+
- Works with OpenAPI Specification versions 3.0 and 3.1.
20
+
- Streaming request and response bodies enabling use cases such as JSON event streams, and large payloads without buffering.
21
+
- Support for JSON, multipart, URL-encoded form, base64, plain text, and raw bytes, represented as value types with type-safe properties.
22
+
- Client, server, and middleware abstractions, decoupling the generated code from the HTTP client library and web framework.
23
+
24
+
To see these features in action, check out the list of [example projects][examples-generator].
25
+
26
+
## Usage
27
+
28
+
Swift OpenAPI Generator can be used to generate API clients and server stubs.
29
+
30
+
Below you can see some example code, or you can follow one of the [step-by-step tutorials][tutorials-generator].
31
+
32
+
### Using a generated API client
33
+
34
+
The generated `Client` type provides a method for each HTTP operation defined in the OpenAPI document[^example-openapi-yaml] and can be used with any HTTP library that provides an implementation of `ClientTransport`.
**swift-openapi-generator** ([source][repo-generator], [docs][docs-generator]) provides the plugin.
48
+
### Using generated API server stubs
20
49
21
-
**swift-openapi-runtime** ([source][repo-runtime], [docs][docs-runtime]) provides a library with common types and abstractions used by the generated code.
50
+
To implement a server, define a type that conforms to the generated `APIProtocol`, providing a method for each HTTP operation defined in the OpenAPI document[^example-openapi-yaml].
22
51
23
-
> See the generator in action in [Meet Swift OpenAPI Generator](https://developer.apple.com/wwdc23/10171) from WWDC23.
52
+
The server can be used with any web framework that provides an implementation of `ServerTransport`, which allows you to register your API handlers with the HTTP server.
24
53
25
-
Choose one of the transports listed below, or create your own by adopting the `ClientTransport` or `ServerTransport` protocol:
0 commit comments