Fix lint findings from the CLI with apiome lint --fix
apiome lint --fix brings the deterministic lint fixes to the command line: run it, read the
diff, apply.
- Preview first:
apiome lint --project P --version V --fix --dry-runprints the plan and a unified diff of the document before and after the ready fixes, and writes nothing.--fix-format patchoroverlayprints the change as one JSON Patch or an Overlay 1.0 document instead, and-owrites it to a file. - Apply as a new revision: without
--dry-run, the ready fixes are applied as a new revision and its id, score and grade are printed. The revision you planned on is never changed. - Choose the fixes:
--only rule,rulefixes only the named rules (an unknown rule id is refused) and--allow-renamesincludes rename fixes. A breaking fix is never applied, whatever the flags. - Exit codes for CI:
0when nothing is left to fix,3when breaking or conflicting fixes remain for a person (never on a dry run),2for a refused request and1for an error.--jsonprints the plan.
Fixing a local file in place, keeping its YAML comments and key order, follows the local-file
lint of apiome lint <file>.
See Fix from the CLI.
