Public HTTP API design standards and deterministic Redocly OpenAPI lint rules for Photon APIs.
Each standard in Photon API Design Standards (ADS) defines a service-agnostic contract guarantee for external developers, SDK consumers, and automated clients, co-located with its executable lint rules and test suite.
| Standard | Title | Status | Rules |
|---|---|---|---|
| ADS-0001 | Resource Identifiers and Path Parameter Naming | Approved | photon-ads/ads-0001-resource-primary-id, photon-ads/ads-0001-path-param-naming, photon-ads/ads-0001-path-param-consistency |
| ADS-0002 | Top-Level JSON Response Structure | Approved | photon-ads/ads-0002-top-level-json-object, photon-ads/ads-0002-no-single-resource-wrapper, photon-ads/ads-0002-flat-creation-secret |
- Draft: Problem space identified; conventions are not yet settled.
- Reviewing: Core direction is agreed, with open questions under review.
- Approved: Binding default for new and redesigned Photon public HTTP APIs.
- Deprecated: Superseded by a newer standard.
Proposals are developed through collaborator pull requests in this repository, and only Approved standards are published to the developer docs.
We do not accept external pull requests to this repository. Instead, GitHub Issues are open to everyone:
- Report a non-conformant Photon API: If you find any Photon API endpoint that does not follow these standards, please open an issue with the HTTP method, path, the standard or rule that is violated, and a sanitized or synthetic example request or response payload (with any credentials, tokens, or sensitive customer data removed) when available.
- Suggest improvements or new standards: Open an issue describing the problem, proposed convention, and motivating examples.
@photon-hq/api-design-standards is published to GitHub Packages alongside GitHub Releases. Configure your project's .npmrc to resolve the @photon-hq scope from GitHub Packages (authentication requires a GitHub token with read:packages scope):
@photon-hq:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}Install @photon-hq/api-design-standards alongside @redocly/cli (v2):
pnpm add -D @photon-hq/api-design-standards @redocly/cliRegister the photon-ads plugin and extend photon-ads/recommended in your redocly.yaml:
plugins:
- "@photon-hq/api-design-standards/redocly"
extends:
- recommended
- photon-ads/recommendedYou can also override individual rule severities or add declarative rule-level ignore entries under rules::
rules:
photon-ads/ads-0001-resource-primary-id:
severity: error
ignore:
- schema: LegacyProject
reason: Existing v1 schema pending deprecation
- path: /v1/legacy/items/{itemId}
method: get
reason: Existing response shape preserved for backward compatibility
photon-ads/ads-0001-path-param-naming: error
photon-ads/ads-0001-path-param-consistency: error
photon-ads/ads-0002-top-level-json-object: error
photon-ads/ads-0002-no-single-resource-wrapper:
severity: error
ignore:
- path: /v1/legacy/items/{itemId}
method: get
reason: Legacy wrapper endpoint
photon-ads/ads-0002-flat-creation-secret: errorEach ignore entry accepts path, method, schema, and an optional reason string:
path: Exact OpenAPI path template (trailing slash trimmed except/). Omittingmethodmatches all methods (and path-level parameters) on that path.method: Case-insensitive HTTP method (get,post,patch,put,delete, etc.) narrowing apathorschemamatch where operation context applies. Component schema diagnostics (undercomponents.schemas) have no HTTP method context, so suppressing them requires a schema-onlyignoreentry.schema: Component schema name undercomponents.schemas(used byphoton-ads/ads-0001-resource-primary-id).reason: Optional human-readable explanation for reviewers.
Run Redocly against your OpenAPI 3 specification:
npx redocly lint openapi.yaml --config redocly.yamlThe external developer documentation overview and each standard live under ads/:
ads/
overview.md # External developer documentation overview
0001-resource-identifiers/
index.md # Authoritative Markdown specification and rule table
rules.ts # Deterministic Redocly OpenAPI 3 rules
rules.test.ts # Unit and end-to-end Redocly CLI tests
0002-top-level-json-response/
index.md # Authoritative Markdown specification and rule table
rules.ts # Deterministic Redocly OpenAPI 3 rules
rules.test.ts # Unit and end-to-end Redocly CLI tests
Requires Node.js 22.12+ (CI runs Node 24) and pnpm:
pnpm install
pnpm checkIndividual commands:
pnpm typecheck— strict TypeScript check across source, rules, scripts, and tests.pnpm lint— Biome formatting and linting check.pnpm build— compiles the TypeScript plugin package intodist/.pnpm test— runs unit tests and end-to-endredocly lintverification.pnpm redocly:check— lints the reference OpenAPI 3.1 fixture withredocly.yaml.pnpm docs:export— builds and validatesartifacts/docs-reference.jsonfor documentation publishing.pnpm check:public— verifies tracked files contain only public-safe content.
We do not accept external pull requests. To propose a new API Design Standard or suggest a change to an existing one, open a GitHub issue describing the problem, proposed contract rules, and motivating examples. Proposals are developed through collaborator pull requests in this repository, and only Approved standards are published to the developer docs.
When implementing an approved proposal:
- Create the next sequential folder under
ads/<num>-<slug>/. - Add
index.mdwith YAML frontmatter (title,sidebarTitle,description,ads,status,updated), RFC 2119 normative guidance, concrete Good/Bad examples, and a Lint Rules table. - Implement deterministic Redocly rules in
rules.ts, register them insrc/catalog.tsandsrc/plugin.ts, and cover valid, invalid, and edge cases inrules.test.ts. - Ensure
pnpm checkpasses cleanly, includingdocs:exportparity checks and Mintlify MDX safety validation.
Apache-2.0. See LICENSE.