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.

bash

$ 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]
Options of wf api add
OptionTypeMeaning

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 Backend)

--out OUT

text

The folder its files go in (default: src/api/<name>)

--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]
Options of wf api sync
OptionTypeMeaning

[NAME]

text

One service (default: every one apis keeps)

--skip SKIP

text, repeats

Leave an operation out, by its name or METHOD /path; kept in the config, so the next sync and check leave it out too

--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]
Options of wf api check
OptionTypeMeaning

[NAME]

text

One service (default: every one apis keeps)

--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]
Options of wf api eject
OptionTypeMeaning

NAME

text

The service

--out OUT

text

The folder its files go in (default: src/api/<name>)

--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]
Options of wf api list
OptionTypeMeaning

--json

flag

Print JSON, for tools

--dir

-d DIR

path

The project's folder (default .)

Every command