{
  "name": "reforger-workshop-api",
  "description": "Cached proxy over the Arma Reforger Workshop for generating server-config mods arrays. Data is cached for 30 minutes.",
  "endpoints": {
    "GET /": "Debug UI: browse the workshop, inspect mods, and build config mods arrays.",
    "GET /api": "This usage document.",
    "GET /api/mods?search=&page=&sort=": "Search/list mods. Search matches names and mod-id substrings. 16 results per page. Each row's \"gameVersion\" is the per-mod value read from that mod's detail route (the same value GET /api/mods/{modId} reports), null when that read failed; one failed read never fails the page. Popularity fields: \"subscribers\", \"rating\" (0 to 1) and \"ratingCount\" (there is no downloads or likedPercent).",
    "GET /api/mods/{modId}": "Full mod detail: versions, dependencies, screenshots, logo, and a ready configEntry.",
    "GET /api/mods/{modId}/config?pin=false&deps=true": "Config-ready mods array for one mod, dependencies resolved transitively. pin=true adds version fields. Addons the server could not download (blocked, private, unpublished or deleted) are left out of the array and named in a warning; the ids are also listed in \"blocked\". 410 when the requested mod itself is blocked or removed, 404 when it never existed.",
    "POST /api/config": "Body {\"ids\": [\"...\"], \"pin\": false, \"deps\": true}. Merged, deduplicated mods array for many mods. Blocked/private/unpublished/deleted addons are omitted from \"mods\", named in \"warnings\" and listed in \"blocked\". Responses may include a non-empty \"unresolved\" array of mod ids when the per-request fetch budget is hit; POST those ids again to continue where the previous request stopped (the debug UI does this automatically).",
    "POST /api/validate": "Body {\"ids\": [\"...\"]} or {\"mods\": [{\"modId\": \"...\"}]} (a server-config mods array pasted as-is). Checks a mod list for addons that would stop a dedicated server from starting — the addon itself is undownloadable (blocked or private), or something in its dependency tree is (blocked, private, unpublished or deleted). Unlisted addons still download by id, so they appear in \"notes\" and never affect the outcome. Returns a per-mod status (ok / blocked / tree-blocked / not-found / invalid-id), a \"verdict\" of will-start / will-not-start / incomplete, and \"complete\": true only when nothing is left in \"unchecked\". \"willServerStart\" is true ONLY for a complete check with zero problems of any status (invalid ids included) — an incomplete or partly failed run is never green. Like /api/config, ids left over when the fetch budget runs out come back in \"unchecked\" (and are counted in summary.unchecked, so checked + unchecked covers every submitted id); POST those again to continue. EXTENDED MODE (additive, all optional): send a \"version\" on a mods[] entry, and/or \"scenarioId\", \"platforms\": [\"PLATFORM_PC\",…] and \"gameVersion\" — the same one-fetch-per-mod loop then also returns per-result \"pin\" (ok / not-found / invalid-format / not-checked; not-found and invalid-format are problems), a \"scenario\" block (vanilla / found / not-found / retired / not-checked — \"not-found\" only ever on a complete run) with the \"providerModId\" that publishes it, a \"packSize\" block (deduplicated dependency-tree bytes, per-mod breakdown, and a console budget check when XBL/PSN are in \"platforms\"), and a \"diagnostics\" array using live.* rule ids. Continuation merge rules: a scenario \"found\" in any round wins (drop scenarioId from later rounds once found), pack-size totals are summed by the client across rounds (each round's perMod is disjoint), and packSize.complete is false while anything is unchecked. A body without any of those inputs keeps the same shape as before. Up to 500 entries per request (a dependency-resolved pack is often 100-140). DEPENDENCY-TREE COVERAGE: an unpinned entry inside the clean dependency tree of a mod already checked in the same request is judged from that tree without its own fetch, and its result carries \"coveredBy\" (the vouching mod); a blocked node in a dirty tree is reported blocked the same way, and every other entry is fetched as before. While a modded scenarioId is still unclaimed every entry is fetched. Base-game GUIDs (58D0FB3206B6F859, 5614BBCCBB55ED1C) are invalid-id without a fetch, with a message saying so.",
    "POST /api/mods/resolve": "The mods-list editor behind \"Add mod\" / \"Remove mod\". Body {\"mods\": [current config entries], \"add\": [\"id\"], \"remove\": [\"id\"], \"pin\": false, \"orphansOf\": [\"id\"]}. Returns the new \"mods\" array: existing entries preserved byte-for-byte and in order, each requested mod appended with the dependencies it brings that are not listed yet. A mod that could not boot (blocked/private/unpublished/deleted, or such an addon in its tree, or not found, or a base-game GUID) is refused into \"rejected\" and never added. Removal removes only what was named; dependencies only the removed mods needed are SUGGESTED in \"orphaned\" (send them in \"remove\" to drop them), and a removed entry another kept mod still needs is flagged in \"stillRequired\" (the game downloads dependencies itself; this covers the ids in \"remove\" and in \"orphansOf\"). Also: \"added\" (reason requested|dependency, requiredBy), \"removed\" (reason requested|duplicate), \"alreadyPresent\", \"notPresent\", \"scenarios\" published by the added mods, \"orphanCheck\" complete|incomplete|not-needed, \"orphanCursor\", \"unresolved\" (fetch budget hit: POST the returned mods again with add=unresolved) and \"complete\". ORPHAN CHECK ACROSS ROUNDS: when the fetch budget runs out first, \"orphanCheck\" is \"incomplete\" and \"orphanCursor\" is an object (otherwise null); POST the returned \"mods\" again with \"orphansOf\" set to every removed id (the \"requested\" entries of \"removed\" plus any \"orphansOf\" already sent) and \"orphanCursor\" set to the returned cursor, unchanged, and repeat until \"orphanCheck\" is \"complete\". Each round resumes where the last stopped. Without \"orphanCursor\" (or with null) a round starts from the top, as before; a malformed cursor is a 400.",
    "POST /api/scenarios": "Body {\"mods\": [config entries]} (or {\"ids\": [...]}). Every scenario this mods list makes available: \"vanilla\" (the live catalog, header class known) and \"modded\" (scenarioId, name, gameMode, playerCount, providerModId/providerName; headerClassKnown false). Every listed mod is fetched because a dependency can publish the scenario; past the fetch budget the rest come back in \"unchecked\" for a continuation round.",
    "GET /api/scenarios/form?scenarioId=&headerClass=&gameVersion=": "The missionHeader fields that apply to one scenario, ready to render as a form: each with key, JSON \"path\", type, default (the game's usual value, not the scenario's own), range, enum + enumKind (flags|values) + enumValues, since, description and note, plus \"label\" and \"help\" (the customer-facing text; description and note are engineering text not meant for customers), \"editable\" (false for keys the scenario sets: show them read-only or hide them), \"enumLabels\" (customer names keyed like enumValues, null without an enum) and \"enumAdvanced\" (valid but advanced value names, [] when none, null without an enum). enumValues never offers values the form must hide (the rank INVALID), and range.max is lowered to the highest value still offered (starting rank: 18); validation still accepts the hidden values. Vanilla scenarios use their known header class; a modded one defaults to generic (every scenario reads it) unless \"headerClass\" (generic|campaign|scenarioFramework) is passed. Keys newer than gameVersion are left out; keys of other classes are listed by name in \"otherClassKeys\" (the game ignores them for this scenario). Cacheable.",
    "POST /api/preflight": "The whole start gate in one call. Body as POST /api/config/validate ({\"config\": \"<raw text>\" | {…}, \"gameVersion\", \"readOnlyPaths\", \"skipRules\"}, plus optional \"platforms\"). Runs the offline engine AND the live workshop checks on the config's own mods and scenario, and returns one \"verdict\" (will-start | will-not-start | incomplete), \"willServerStart\", \"blockers\" (every error-severity diagnostic, engine and live.*), \"warnings\", \"notes\", the full engine envelope under \"config\", the live /api/validate result under \"live\" (null when nothing needed checking), and \"continuation\": null, or a ready POST /api/validate body for mods the fetch budget did not reach. Merge rule: any red round is red; green needs every round green. Entries inside the clean dependency tree of an already-checked mod are judged from that tree (see \"coveredBy\"), so a dependency-resolved pack checks in one round.",
    "GET /api/catalog": "Everything needed to build a config UI without embedding these rules: latestGameVersion, gameVersions[], the 33-entry vanilla scenario catalog (31 live + 2 retired with replacedBy, each with a headerClass), the missionHeader key tables per header class (+ legacy/nonexistent keys and the named enums), the config-level legacy-key migration map, official-only/internal/fabricated key lists, per-field limits derived from the ground-truth 1.8.0.10 DSConfigSchema, documented defaults, console pack-size budgets, and the rule table (id → default severity + description). In \"limits\", an integer field carries BOTH \"type\": \"integer\" and \"integer\": true — the two are aliases, kept so either spelling works. Cacheable for 30 minutes.",
    "POST /api/config/validate": "Body {\"config\": \"<raw file text>\" | {…}, \"gameVersion\": \"1.8.0.10\", \"readOnlyPaths\": [\"/bindPort\"], \"skipRules\": [\"xfield.fast-validation-off\"]}. Validates a whole server config: JSON sanitizing (BOM, smart quotes, comments, trailing commas, single quotes, duplicate keys), legacy-key migration, key-case repair, the ground-truth JSON Schema, the strict lint layer, ~40 cross-field rules and version gating. Prefer sending the raw TEXT: only the string form can diagnose and repair broken JSON. Returns \"diagnostics\" (stable \"rule\" id + RFC 6901 \"path\" + severity + optional \"fix\" ops), \"summary\", \"schemaValid\", \"verdict\"/\"willServerStart\" (green only when errors are zero AND nothing needs a live check), and \"liveCheck\": a ready-to-POST body for /api/validate. IMPORTANT: a \"json.*\" repair warning (BOM, comment, smart/single quotes, trailing or missing comma, bad escape, raw control character) means the SUBMITTED bytes are not valid JSON; \"json.duplicate-key\" is different: the file is valid JSON, but the game uses the FIRST value of a repeated key and ignores the later one. Either way the verdict describes the document the game would read, so upload the \"configText\" from /api/config/fix rather than the original file. Repair warnings carry data.occurrences plus data.line and data.column (1-based, column in UTF-16 code units, CRLF is one line break, after a leading BOM is stripped) of the first occurrence; json.duplicate-key carries the line and column of the later copy. No diagnostic echoes a string value from the config (passwords carry a pattern): schema.pattern gives data.actualLength instead of data.actual, and a string schema.enum or schema.oneof gives data.actualType. Makes zero upstream requests.",
    "POST /api/config/fix": "Same body as /api/config/validate. Applies every fix the validator emitted (except those under \"readOnlyPaths\" or from \"skipRules\"), re-validates, and returns the validate response plus \"fixed\", \"config\" (repaired object), \"configText\" (2-space, canonical key order: the exact bytes to upload) and \"changes\" (rule, path, op, from, to, message; a \"from\" or \"to\" value that is or contains /game/password, /game/passwordAdmin or /rcon/password, including a key that migrates into one, is replaced by {\"redacted\": true, \"type\", \"length\"}). Note the difference in what the two options guard: \"readOnlyPaths\" protects a VALUE (nothing under those paths is set, removed or renamed away, by any rule), while \"skipRules\" only mutes a RULE (another rule's fix may still touch the same key; e.g. skipping key.fabricated does not stop schema.additional-prop removing \"playerBanList\"; use readOnlyPaths to preserve it). Repairs the reference does not license (the wiki template's maxPlayers/port 0 placeholders, an RCON password, a partial platform set) are deliberately NOT invented and stay as errors.",
    "POST /api/config/generate": "NOT the same as POST /api/config (which only builds a mods array). Body {\"name\", \"scenarioId\"} required, plus optional maxPlayers, password, passwordAdmin, admins[], crossPlatform, bindAddress, publicAddress, ports{game,a2s,rcon}, rcon{password,permission}, mods[], gameProperties, missionHeader, persistence, operating, gameVersion. Emits a complete config.json (explicit a2s block, explicit rcon.permission, fastValidation true, crossPlatform alone, boolean disableThirdPerson on pre-1.8 targets), self-checks it through the validator and returns \"config\" + \"configText\" with the same diagnostics/verdict fields. Dependencies are NOT resolved here — the wizard flow is POST /api/config (dependencies) → POST /api/config/generate → POST /api/validate (live checks)."
  },
  "diagnostics": {
    "ruleNamespaces": {
      "json.*": "file-level syntax and sanitizing",
      "key.*": "unknown, miscapitalized, official-only, internal or fabricated keys",
      "legacy.*": "renamed/removed keys and type migrations",
      "schema.*": "the server's own JSON Schema verdict",
      "lint.*": "formats stricter than the schema floor",
      "xfield.*": "cross-field rules (a server that boots but does not work)",
      "version.*": "target-version gating",
      "live.*": "workshop checks from POST /api/validate"
    },
    "severities": "error | warning | info — defaults per rule id are served by GET /api/catalog.",
    "composition": "Final green = /api/config/validate errors == 0 AND /api/validate willServerStart === true for the returned liveCheck body (merged across continuation rounds)."
  },
  "source": "Data from reforger.armaplatform.com (Bohemia Interactive). Unofficial, cached 30 min."
}