|
| 1 | +# Contributing Guide |
| 2 | + |
| 3 | +Thanks for helping improve the **Umami API Docs**! Every contribution that cleans up and completes the OpenAPI spec is welcome. This project aims to provide a clean, community-maintained API reference. |
| 4 | + |
| 5 | +> **Scope:** Please change **only the API spec** (the `openapi/` files). Do **not** modify badges, workflows, website configs, or unrelated files. |
| 6 | +
|
| 7 | +--- |
| 8 | + |
| 9 | +## What to work on |
| 10 | + |
| 11 | +- **Complete missing or incomplete endpoints.** |
| 12 | +- **Add or improve operation/field descriptions.** |
| 13 | + Many places are intentionally left with a placeholder like `description: TBD`. Replace these with clear, complete English descriptions. Avoid empty values and placeholders such as `null`, or `-`. |
| 14 | + |
| 15 | + See the **“Endpoints not complete”** section in the root `README.md` — it links directly to the lines that need work. |
| 16 | +- **Extend responses** where applicable, especially **`400`** and **`405`** use cases (validation errors, method not allowed), with schemas and examples. |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Local setup & validation |
| 21 | + |
| 22 | +1. Install dependencies: |
| 23 | + ```bash |
| 24 | + npm install |
| 25 | + ``` |
| 26 | +2. Lint the spec before committing: |
| 27 | + ```bash |
| 28 | + npm run test |
| 29 | + ``` |
| 30 | + This runs Redocly lint. The PR will also run this check automatically as a fallback; PRs with lint errors cannot be merged. |
| 31 | + |
| 32 | +> Tip: Keep runs fast by focusing on the files you changed and committing incrementally. |
| 33 | +
|
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## Descriptions (how to write and where to add) |
| 38 | + |
| 39 | +- **Replace placeholders:** Search for `description: x` and replace them with meaningful text. Do not leave `description:` empty and do not use `null` or `TBD`. |
| 40 | +- **Level of detail:** One or two short sentences are usually enough. Explain *what* the operation/field is for and any constraints that are not obvious from the schema. |
| 41 | +- **Tone & language:** English, concise, and consistent with the rest of the document. |
| 42 | +- **Where to add:** |
| 43 | + - **Operations:** Under each HTTP method (e.g., `paths./resource.get.description`). |
| 44 | + - **Parameters:** Each parameter (`name`, `in`, `required`) should have a `description` explaining format, examples, and semantics. |
| 45 | + - **Schemas & properties:** Add `description` to component schemas and their properties where helpful. |
| 46 | +- **Validation:** The linter requires descriptions to be strings. Empty or `null` values (e.g., `description:` with nothing after it) will fail the lint check. |
| 47 | + |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## Style & structure guidelines |
| 52 | + |
| 53 | +Please follow these conventions to keep the spec consistent: |
| 54 | + |
| 55 | +- **Descriptions:** Must be non-empty, short, and precise. Avoid “TBD” or `null`. |
| 56 | +- **Operation IDs:** Use lowerCamelCase and make them unique per operation (e.g., `getWebsiteById`, `listEvents`). |
| 57 | +- **Tags:** Prefer existing tags; only add new ones if absolutely necessary. |
| 58 | +- **Parameters:** Document `in`, `name`, `required`, and a clear `description`. Provide `schema` with `type/format` and examples. |
| 59 | +- **Request bodies:** Include `content: application/json` with a proper `schema` and a minimal `example`. |
| 60 | +- **Responses:** Always include `content` with `schema` and at least one example. |
| 61 | + - **200 / 201:** Add realistic examples. |
| 62 | + - **400 (Bad Request):** Use this for validation errors or bad input. |
| 63 | + - **405 (Method Not Allowed):** Add when an HTTP verb is unsupported. |
| 64 | +- **Schemas:** Reuse components in `components/schemas` where possible. Prefer `object` with explicit `properties`, `required`, and types. |
| 65 | +- **Examples:** Favor small but realistic, redacted data. Avoid secrets or PII. |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +## How to contribute (workflow) |
| 70 | + |
| 71 | +1. **Create a branch** from `main` (e.g., `feat/complete-sessions-properties`). |
| 72 | +2. Make focused changes **only in `openapi/`**. |
| 73 | +3. Run: |
| 74 | + ```bash |
| 75 | + npm run test |
| 76 | + ``` |
| 77 | + Fix any linting errors. |
| 78 | +4. **Commit** with a clear message (e.g., `docs(api): add 400/405 and examples for /websites/{id}/active`). |
| 79 | +5. **Open a Pull Request**: |
| 80 | + - Title: short & descriptive. |
| 81 | + - Description: list what you completed (endpoints, responses, examples). |
| 82 | + - Link to the items from **“Endpoints not complete”** you addressed. |
| 83 | +6. The PR will: |
| 84 | + - Run the lint job and annotate problems inline. |
| 85 | + - Post a compact lint report comment if issues are found. |
| 86 | + - **Block merging** until the lint check passes. |
| 87 | + |
| 88 | +--- |
| 89 | + |
| 90 | +## Review checklist (before you submit) |
| 91 | + |
| 92 | +- [ ] Only `openapi/` files changed. |
| 93 | +- [ ] All operations/parameters/schemas have non-empty `description` where applicable (placeholders like `description: x` replaced). |
| 94 | +- [ ] `200/201` responses include `schema` **and** example(s). |
| 95 | +- [ ] Added/validated **`400`** and **`405`** where relevant. |
| 96 | +- [ ] No unused components/schemas. |
| 97 | +- [ ] `npm run test` passes locally. |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## Questions |
| 102 | + |
| 103 | +If you’re unsure about structure, examples, or where to add 400/405, open a draft PR or start a discussion. We’d rather help early than request large reworks later. Thanks for contributing! |
0 commit comments