Reference
wf api
A service's contract as files, from its OpenAPI spec: add one, sync it, check it is current, turn `api … from` into files, list them
wf api <add|sync|check|eject|list>
Writes a service's contract as files from its OpenAPI spec (3.0 or 3.1, JSON or YAML), and keeps them current.
$ wf api add openapi.json --name Backend
$ wf api sync
$ wf api sync Backend --skip uploadXml
$ wf api check
$ wf api eject Backend
$ wf api list --json
Every generated file opens with a // Code generated by … comment that names wf api sync and its spec and says DO NOT EDIT, and sync never overwrites or removes a file in generated/ without it. The output is the printer's, so it is the same for the same spec, and a change to the spec is the smallest diff. wf check warns (N07) when a spec has changed since its files were written. The compiler never fetches: download the spec first (curl -o openapi.json …). See Data and APIs.
wf api add
Keep a service read from SPEC: record it in `apis`, write its `service.wf` once, and its `generated/` files
wf api add SPEC [options]
| Option | Type | Meaning |
|---|---|---|
SPEC | text | The OpenAPI spec, JSON or YAML, a file in the project |
--name NAME | text | The service's name, as the program calls it (default |
--out OUT | text | The folder its files go in (default: |
--dir -d DIR | path | The project's folder (default |
wf api sync
Rewrite each service's `generated/` from its spec
wf api sync [NAME] [options]
| Option | Type | Meaning |
|---|---|---|
[NAME] | text | One service (default: every one |
--skip SKIP | text, repeats | Leave an operation out, by its name or |
--dir -d DIR | path | The project's folder (default |
wf api check
Fail when `sync` would change anything: for CI
wf api check [NAME] [options]
| Option | Type | Meaning |
|---|---|---|
[NAME] | text | One service (default: every one |
--dir -d DIR | path | The project's folder (default |
wf api eject
Turn `api NAME from "openapi.json"` into a kept service's files
wf api eject NAME [options]
| Option | Type | Meaning |
|---|---|---|
NAME | text | The service |
--out OUT | text | The folder its files go in (default: |
--dir -d DIR | path | The project's folder (default |
wf api list
Every service read from a spec: its spec, its folder, its groups and their endpoints
wf api list [options]
| Option | Type | Meaning |
|---|---|---|
--json | flag | Print JSON, for tools |
--dir -d DIR | path | The project's folder (default |