|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for taking the time. Issues and pull requests are welcome at |
| 4 | +<https://github.com/devrobotlabs/visionapi-react>. |
| 5 | + |
| 6 | +If your question is about the **API itself** — a preset, a credit cost, a limit, an error |
| 7 | +code — <https://support.visionapi.io> reaches the team faster than an issue here does. This |
| 8 | +repository is the React client; the service it talks to is documented at |
| 9 | +<https://docs.visionapi.io>. |
| 10 | + |
| 11 | +## Getting set up |
| 12 | + |
| 13 | +```bash |
| 14 | +git clone https://github.com/devrobotlabs/visionapi-react.git |
| 15 | +cd visionapi-react |
| 16 | +npm install |
| 17 | +``` |
| 18 | + |
| 19 | +## Before you open a pull request |
| 20 | + |
| 21 | +Run what CI runs: |
| 22 | + |
| 23 | +```bash |
| 24 | +npm run typecheck |
| 25 | +npm test |
| 26 | +``` |
| 27 | + |
| 28 | +The test suite stubs the transport, so it needs **no API key and makes no network calls**. |
| 29 | +A test that reaches the real API will not be merged — it makes the suite slow, flaky, and |
| 30 | +impossible to run on a fork. |
| 31 | + |
| 32 | +This package never talks to the API directly. If a change makes it hold an API key in the browser, it is the wrong change — see the README's proxy examples for the shape that is correct. |
| 33 | + |
| 34 | +## One contract, nine libraries |
| 35 | + |
| 36 | +This is one of nine clients — Node, Python, Go, Ruby, PHP, Java, Swift, React and Vue — that |
| 37 | +deliberately expose the same surface, named the way each language names things. A change to |
| 38 | +behaviour rather than to style is usually a change all nine need, so say so in the pull |
| 39 | +request and we will sort out the rest of the set. |
| 40 | + |
| 41 | +Three rules the libraries exist to get right, and which any change has to preserve: |
| 42 | + |
| 43 | +- **Every scalar is wrapped** in `{value, confidence}`, and a line-item array is a *bare* |
| 44 | + array whose cells are wrapped individually — not a wrapped array of plain values. |
| 45 | +- **Absent is not missing.** A preset response contains every field of the preset, with the |
| 46 | + ones the document did not carry as `value: null`. Do not drop them. |
| 47 | +- **Retries cannot double-charge.** Every billable POST carries a generated |
| 48 | + `Idempotency-Key`; 429 honours the server's `Retry-After`, and 402 and input errors are |
| 49 | + never retried because they cannot succeed. |
| 50 | + |
| 51 | +## Style |
| 52 | + |
| 53 | +Match the surrounding code. The linters listed above are the arbiter for everything they |
| 54 | +cover; for everything else, the existing files are. |
| 55 | + |
| 56 | +## Reporting a security issue |
| 57 | + |
| 58 | +Please do not open a public issue — see [SECURITY.md](./SECURITY.md). |
0 commit comments