Something went wrong. Try again.
Zig bindings for all 506 operations of the Forgejo API, generated from its own description, and zfj, a command line built on them.
Something went wrong. Try again.
Contributing to zfj #
Changes are welcome as pull requests on the Tangled mirror, https://tangled.org/jcollie.dev/zfj, where problems can be reported too.
Getting set up #
Everything a build needs comes from the Nix flake:
$ nix develop
$ zig build test
The tools in the devshell — Zig 0.17, reuse, zon2nix — are the versions
the checks below are run with.
What a change needs #
zig build testpasses. It compiles all 506 generated operations, which is the broadest check there is, and runs the tests insrc/andsrc/cli/.zig fmt --exclude zig-pkg --check .andreuse lintpass. Every new file carries an SPDX header, or an entry inREUSE.tomlwhen it cannot.nix build .#zfjstill builds without the network. A change tobuild.zig.zonregeneratesbuild.zig.zon.nixwithnix develop -c zon2nix --17 --nix=build.zig.zon.nix build.zig.zon.- A change to the command-line tool that a user can see is covered by the
NixOS test in
tests/nixos/, which driveszfjagainst a real Forgejo:nix build -L .#checks.x86_64-linux.forgejo. It needs KVM. - The README says what the project does now, and changes with it.
Where things are #
api/swagger.v1.jsonis Forgejo's API description, vendored from a release;zig build update-specreplaces it. Nothing generated is checked in: the build runssrc/generate.zigover it on every build.src/cli/is the command-line tool. Its plumbing commands come from reflecting over the generated bindings, so an operation needs no code of its own to be one. Shell completion is answered bysrc/cli/completion.zigfrom the same option structs and notes the commands parse with, so a new command or option is completed with no work of its own; a top-level word goes inentriesinmain.zig, beside its line indispatch.src/cli/completions/holds each shell's completion script.GLOSSARY.mdholds the project's vocabulary, anddocs/adr/the decisions that would surprise a reader. Use the glossary's words, and add to it when a new one settles.
Fixes that belong elsewhere #
The generator is a fork of openapi2zig. A wrong type, a missing field or a
broken request in the bindings is usually the generator's, and is fixed there
— in github:jcollie/openapi2zig, branch zig-0.17 — rather than worked
around here; build.zig.zon then moves to the fixed commit.