Repository sync settings with .requestarium/sync.yaml

A repository with five collections in it raises the same questions for every new teammate: which folder is which collection, which branch do we sync with, do we push through pull requests? .requestarium/sync.yaml answers them in the repository itself. It also lets the repository set rules, such as "no typed credentials, ever".

The file

.requestarium/sync.yaml
version: 1
defaultBranch: main
pullRequests: true
layout: monorepo
collections:
  - name: Billing API
    path: collections/billing-api
    environments: true
  - name: Users API
    path: collections/users-api
secrets:
  policy: refuse
  allowedVariables:
    - baseUrl
    - region
review:
  summary: true
KeyMeaning
versionRequired, always 1
defaultBranchThe branch Open from repo links to
pullRequeststrue when the team pushes through pull requests. Shown to whoever opens the repository
layoutsingle, monorepo (each collection under collections/) or custom
collections[]Each collection's name, path, and whether its environments are synced
secrets.policymask (default) or refuse
secrets.allowedVariablesWhen present, the only environment variables that may be pushed with a value
review.summary, review.statusChange summaries in pull requests, and an optional commit status

You don't have to write it by hand: with Write sync settings to the repository ticked (the default), the first push of a newly linked collection writes it, and later pushes keep that collection's entry current.

Onboard a teammate in one step

Settings ▸ Sync ▸ Open from repo, paste the repository address, and Requestarium shows what it will do before anything changes:

Terminal
$ requestarium sync open https://github.com/acme/api
github acme/api main: 1 to link, 1 new, 1 already linked
  Billing API: linked to /collections/billing-api and pulled (12 changes)
  Users API: created, linked to /collections/users-api and pulled (7 changes)
  Orders API: already linked, left as it is

A collection the workspace already has (same id, or exactly one with that name) is linked and pulled; one it doesn't have is created. Addresses are accepted the way people paste them, including [email protected]:acme/api.git and GitLab subgroup paths. From a local clone, requestarium sync link --from-repo . reads the file from disk and the repository from origin.

In VS Code and JetBrains IDEs, Sync overview ▸ Open from repo offers the project's own sync.yaml first.

Make the repository refuse secrets

Whatever the policy, credentials from the Authorization tab are written as {{variables}} and secret environment variables as names only. The policy covers what's left, mainly headers typed by hand:

In the fileA push
no secrets, or policy: maska typed value in a credential-like header (Authorization, X-Api-Key, Cookie) is written, with a warning
policy: refuseis refused while any outgoing request has such a header
allowedVariables: [a, b]is refused when an environment carries a value for a variable that isn't listed

A refused push changes nothing and says exactly why:

Output
Orders API (github acme/api main /collections/orders-api)
  error: The repository's .requestarium/sync.yaml does not allow this push. Nothing was changed.
      request "Create order" has a typed value in the X-Api-Key header (use a {{variable}})

In the app and the IDE, the same list appears above the commit message and Push is disabled.

Editor validation

The file has a JSON Schema. With the YAML language server (VS Code's YAML extension, JetBrains IDEs, Neovim), point the file at it and typos such as layuot are underlined as you type. In CI, requestarium sync validate checks the file without a server.

When the file has errors

Pushes are refused, because the secrets policy can't be read and guessing "everything is allowed" would be wrong. Pulls still work. The errors show in the Git sync dialog with where each one is, the Sync overview marks the link as sync.yaml has errors, and Requestarium never overwrites a file it can't read. Fix it in the repository and the next comparison clears the state.