Skip to content

docs(api-reference): align the API reference with server behavior - #1068

Merged
ysyneu merged 3 commits into
mainfrom
docs/api-reference-audit
Oct 17, 2026
Merged

ysyneu merged 3 commits into
mainfrom
docs/api-reference-audit

Conversation

@ysyneu

@ysyneu ysyneu commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Brings the public API reference in line with what the server actually does, so a caller can use each endpoint from its page alone.

Conventions pages (openapi/introduction, rate-limits, pagination, zh + en)

  • Document the Fd-App-Key header, response language (locale / lang / Accept-Language), and that operations without a payload return data: {} or omit data.
  • State the default per-account rate limits (read 50/s, 1,000/min; write 20/s, 300/min) and the Flashcat-Request-Rate-Limit-Delay header on 429.
  • Fix the error code table (MethodNotAllowed is 405; ResourceNotFound means the object does not exist; NoLicense covers plan, quota and credits) and keep it in one place instead of two.
  • Pagination: limits vary per operation; list all operations that accept search_after_ctx; on List incidents / List alerts, has_next_page stops at 1,000 items in page-number mode, so use the cursor beyond that.

All 370 operations (per-module specs + consolidated copies)

  • Rate limits, permissions, audit and plan requirements corrected against the gateway.
  • Full enum value sets with an explanation of each value.
  • Missing request/response fields added, stale ones removed, required and nullability fixed, units and defaults stated.
  • Wrong behavior descriptions corrected (whole-object replacement on several upserts, soft vs permanent deletes, inhibit rule semantics, and others).
  • Every request and 200 response example validates against its schema.
  • 403 documented on every operation; 429 documents the delay header.
  • API catalog: the five missing monitor folder operations added (370 total).

Lint gate (scripts/lint_openapi.py): five new rules — integer enums explained, required ⊆ declared properties, 403 on every operation, examples match their schema, operation description ≤ 220 chars.

Checks run

  • python3 scripts/lint_openapi.py → no violations (the new rules flag 305 missing 403s, 95 example mismatches and 12 long descriptions on the previous specs).
  • python3 scripts/api_path_redirects.py --check → pass.
  • EN/ZH structural parity, no dangling $ref, consolidated files equal the module files, 370 operations = docs.json nav = both API catalogs.
  • mint broken-links not run (does not converge locally); worth a check after merge.

- Quick start: document the Fd-App-Key header, response language
  (locale / lang / Accept-Language), that data is {} or omitted when an
  operation has no payload, and the timestamp/enum/update conventions.
  Move limits and errors to one page instead of repeating them.
- Rate limits and errors: state the default per-account limits (read
  50/s and 1,000/min, write 20/s and 300/min), the
  Flashcat-Request-Rate-Limit-Delay header on 429, and a corrected error
  code table (MethodNotAllowed is 405, ResourceNotFound means the object
  does not exist, NoLicense covers plan, quota and credits).
- Pagination: limits and defaults vary per operation; list every
  operation that accepts search_after_ctx; explain that on incident and
  alert lists has_next_page stops at 1,000 items in page-number mode and
  how to continue with the cursor.
- Point the Go SDK pages at the new error code anchor.
Review all 370 public operations against the backend implementation and
fix what a caller needs to use each endpoint from its page alone:

- Restrictions: rate limits now match the gateway (most write operations
  are 300/min and 20/s, not the read tier), permissions list every
  permission that grants the call, and audit and plan requirements are
  stated where they apply.
- Enums: declare the full value set for status, type, mode and similar
  fields and explain each value; open sets say so.
- Request and response schemas: add missing fields, remove fields the
  server no longer accepts or returns, correct required lists, mark
  fields that can be null, and state units (seconds, milliseconds,
  nanoseconds) and defaults.
- Usage notes: correct behavior that was described wrongly (whole-object
  replacement on several upserts, soft vs permanent deletes, inhibit rule
  semantics, pagination limits) and move long descriptions out of the
  page subtitle.
- Examples: every request and 200 response example validates against its
  schema; operations without a payload show no data field.
- Shared components: data is optional in the success envelope, 403 is
  documented on every operation, 429 documents the
  Flashcat-Request-Rate-Limit-Delay header, the error code table matches
  the server, and the APP Key scheme mentions the Fd-App-Key header.
- API catalog: add the five missing monitor folder operations (370 total).
- Rebuild the consolidated openapi.{en,zh}.json from the module specs.
Add five rules: integer enums must explain every value, required may only
name declared properties, every operation documents 403, request and 200
response examples must match their schema, and operation descriptions stay
within 220 characters.
@ysyneu
ysyneu merged commit f2e4a31 into main Oct 17, 2026
2 checks passed
@ysyneu
ysyneu deleted the docs/api-reference-audit branch October 17, 2026 10:18
ysyneu added a commit that referenced this pull request Oct 17, 2026
Conflicts in the OpenAPI introduction, pagination, catalog and Go SDK
pages resolve to #1068's text, which already links to rate limits and
describes pagination by behavior. The catalog total is 372: the 370
endpoints with reference pages plus gallery pin/unpin, matching the
per-module counts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant