@radicaltools/mcp 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +41 -23
  2. package/dist/{chunk-OGN3UW2D.js → chunk-2SZDTOYJ.js} +727 -89
  3. package/dist/{elkLayout-S62RLGTO.js → elkLayout-VYJDCCIT.js} +1 -1
  4. package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
  5. package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
  6. package/dist/hub-catalogue/concern/concern-api-evolution.radical +1174 -0
  7. package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
  8. package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
  9. package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
  10. package/dist/hub-catalogue/concern/concern-architecture-style.radical +1268 -0
  11. package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
  12. package/dist/hub-catalogue/concern/concern-authentication.radical +895 -0
  13. package/dist/hub-catalogue/concern/concern-authorization.radical +1686 -0
  14. package/dist/hub-catalogue/concern/concern-availability.radical +1028 -0
  15. package/dist/hub-catalogue/concern/concern-backend-stack.radical +1037 -0
  16. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +1560 -0
  17. package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
  18. package/dist/hub-catalogue/concern/concern-capacity.radical +915 -0
  19. package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
  20. package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
  21. package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
  22. package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
  23. package/dist/hub-catalogue/concern/concern-communication-style.radical +1508 -0
  24. package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
  25. package/dist/hub-catalogue/concern/concern-data-consistency.radical +1112 -0
  26. package/dist/hub-catalogue/concern/concern-data-store.radical +1282 -0
  27. package/dist/hub-catalogue/concern/concern-decomposition.radical +1318 -0
  28. package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
  29. package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
  30. package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
  31. package/dist/hub-catalogue/concern/concern-deployment.radical +1203 -0
  32. package/dist/hub-catalogue/concern/concern-encryption.radical +1318 -0
  33. package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
  34. package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
  35. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +1647 -0
  36. package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
  37. package/dist/hub-catalogue/concern/concern-infrastructure.radical +2183 -0
  38. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +1116 -0
  39. package/dist/hub-catalogue/concern/concern-messaging.radical +973 -0
  40. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +867 -0
  41. package/dist/hub-catalogue/concern/concern-observability.radical +997 -0
  42. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
  43. package/dist/hub-catalogue/concern/concern-personal-data.radical +1949 -0
  44. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
  45. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +1445 -0
  46. package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
  47. package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
  48. package/dist/hub-catalogue/concern/concern-secrets.radical +1284 -0
  49. package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
  50. package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
  51. package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
  52. package/dist/hub-catalogue/concern/concern-supply-chain.radical +1386 -0
  53. package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
  54. package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
  55. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +1440 -0
  56. package/dist/hub-catalogue/concern/concern-test-strategy.radical +1212 -0
  57. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
  58. package/dist/index.js +10321 -3964
  59. package/package.json +1 -1
  60. package/dist/hub-catalogue/adr/adr-api-versioning.radical +0 -53
  61. package/dist/hub-catalogue/adr/adr-auth-strategy.radical +0 -53
  62. package/dist/hub-catalogue/adr/adr-caching-strategy.radical +0 -59
  63. package/dist/hub-catalogue/adr/adr-data-consistency-model.radical +0 -40
  64. package/dist/hub-catalogue/adr/adr-data-store.radical +0 -47
  65. package/dist/hub-catalogue/adr/adr-deployment-strategy.radical +0 -53
  66. package/dist/hub-catalogue/adr/adr-event-schema-evolution.radical +0 -53
  67. package/dist/hub-catalogue/adr/adr-integration-style.radical +0 -50
  68. package/dist/hub-catalogue/adr/adr-ledger-reconciliation-strategy.radical +0 -38
  69. package/dist/hub-catalogue/adr/adr-llm-provider-strategy.radical +0 -40
  70. package/dist/hub-catalogue/adr/adr-marketplace-payments-model.radical +0 -39
  71. package/dist/hub-catalogue/adr/adr-multi-region.radical +0 -60
  72. package/dist/hub-catalogue/adr/adr-multi-tenancy-strategy.radical +0 -41
  73. package/dist/hub-catalogue/adr/adr-observability.radical +0 -59
  74. package/dist/hub-catalogue/adr/adr-realtime-transport.radical +0 -38
  75. package/dist/hub-catalogue/adr/adr-tech-stack.radical +0 -45
  76. package/dist/hub-catalogue/adr/adr-zero-trust-network.radical +0 -40
  77. package/dist/hub-catalogue/blueprint/bp-ai-assistant-platform.radical +0 -1641
  78. package/dist/hub-catalogue/blueprint/bp-analytical-data-platform.radical +0 -1428
  79. package/dist/hub-catalogue/blueprint/bp-ecommerce-platform.radical +0 -1989
  80. package/dist/hub-catalogue/blueprint/bp-fintech-ledger-platform.radical +0 -1701
  81. package/dist/hub-catalogue/blueprint/bp-marketplace-platform.radical +0 -1792
  82. package/dist/hub-catalogue/blueprint/bp-realtime-collaboration.radical +0 -1421
  83. package/dist/hub-catalogue/blueprint/bp-saas-b2b-platform.radical +0 -1713
  84. package/dist/hub-catalogue/fitness-function/ff-accessibility-scan.radical +0 -34
  85. package/dist/hub-catalogue/fitness-function/ff-ai-eval-gate.radical +0 -52
  86. package/dist/hub-catalogue/fitness-function/ff-api-contract.radical +0 -36
  87. package/dist/hub-catalogue/fitness-function/ff-capacity-load-test.radical +0 -67
  88. package/dist/hub-catalogue/fitness-function/ff-carbon-footprint-guard.radical +0 -62
  89. package/dist/hub-catalogue/fitness-function/ff-change-failure-rate.radical +0 -45
  90. package/dist/hub-catalogue/fitness-function/ff-chaos-resilience-test.radical +0 -53
  91. package/dist/hub-catalogue/fitness-function/ff-cost-efficiency-guard.radical +0 -64
  92. package/dist/hub-catalogue/fitness-function/ff-coupling-guard.radical +0 -45
  93. package/dist/hub-catalogue/fitness-function/ff-data-integrity-check.radical +0 -51
  94. package/dist/hub-catalogue/fitness-function/ff-data-residency.radical +0 -43
  95. package/dist/hub-catalogue/fitness-function/ff-dependency-rules.radical +0 -37
  96. package/dist/hub-catalogue/fitness-function/ff-deploy-frequency.radical +0 -46
  97. package/dist/hub-catalogue/fitness-function/ff-dr-drill-success.radical +0 -52
  98. package/dist/hub-catalogue/fitness-function/ff-duplication-guard.radical +0 -53
  99. package/dist/hub-catalogue/fitness-function/ff-error-budget.radical +0 -59
  100. package/dist/hub-catalogue/fitness-function/ff-fail-safe-verification.radical +0 -34
  101. package/dist/hub-catalogue/fitness-function/ff-infra-drift.radical +0 -34
  102. package/dist/hub-catalogue/fitness-function/ff-latency-slo.radical +0 -59
  103. package/dist/hub-catalogue/fitness-function/ff-lead-time.radical +0 -44
  104. package/dist/hub-catalogue/fitness-function/ff-ledger-balance-integrity.radical +0 -45
  105. package/dist/hub-catalogue/fitness-function/ff-license-compliance.radical +0 -43
  106. package/dist/hub-catalogue/fitness-function/ff-mttr.radical +0 -45
  107. package/dist/hub-catalogue/fitness-function/ff-noisy-neighbor-guard.radical +0 -66
  108. package/dist/hub-catalogue/fitness-function/ff-sast-scan.radical +0 -35
  109. package/dist/hub-catalogue/fitness-function/ff-scale-out-verification.radical +0 -66
  110. package/dist/hub-catalogue/fitness-function/ff-security-scan.radical +0 -45
  111. package/dist/hub-catalogue/fitness-function/ff-startup-shutdown-check.radical +0 -66
  112. package/dist/hub-catalogue/fitness-function/ff-sync-convergence-test.radical +0 -45
  113. package/dist/hub-catalogue/fitness-function/ff-test-coverage.radical +0 -43
  114. package/dist/hub-catalogue/fitness-function/ff-web-vitals.radical +0 -57
  115. package/dist/hub-catalogue/pattern/pattern-anti-corruption-layer.radical +0 -88
  116. package/dist/hub-catalogue/pattern/pattern-api-gateway.radical +0 -168
  117. package/dist/hub-catalogue/pattern/pattern-bff.radical +0 -179
  118. package/dist/hub-catalogue/pattern/pattern-bulkhead.radical +0 -114
  119. package/dist/hub-catalogue/pattern/pattern-circuit-breaker.radical +0 -219
  120. package/dist/hub-catalogue/pattern/pattern-cqrs.radical +0 -195
  121. package/dist/hub-catalogue/pattern/pattern-crdt-sync.radical +0 -200
  122. package/dist/hub-catalogue/pattern/pattern-event-driven.radical +0 -210
  123. package/dist/hub-catalogue/pattern/pattern-event-sourced-ledger.radical +0 -211
  124. package/dist/hub-catalogue/pattern/pattern-hexagonal.radical +0 -196
  125. package/dist/hub-catalogue/pattern/pattern-microservices.radical +0 -262
  126. package/dist/hub-catalogue/pattern/pattern-rag-pipeline.radical +0 -213
  127. package/dist/hub-catalogue/pattern/pattern-rate-limiter.radical +0 -114
  128. package/dist/hub-catalogue/pattern/pattern-saga.radical +0 -208
  129. package/dist/hub-catalogue/pattern/pattern-sidecar.radical +0 -123
  130. package/dist/hub-catalogue/pattern/pattern-strangler-fig.radical +0 -227
  131. package/dist/hub-catalogue/pattern/pattern-transactional-outbox.radical +0 -209
  132. package/dist/hub-catalogue/requirement/req-accessibility.radical +0 -48
  133. package/dist/hub-catalogue/requirement/req-ai-autonomous-resolution.radical +0 -51
  134. package/dist/hub-catalogue/requirement/req-ai-groundedness.radical +0 -45
  135. package/dist/hub-catalogue/requirement/req-ai-human-handoff.radical +0 -46
  136. package/dist/hub-catalogue/requirement/req-alerting.radical +0 -52
  137. package/dist/hub-catalogue/requirement/req-api-response-time.radical +0 -51
  138. package/dist/hub-catalogue/requirement/req-api-standard.radical +0 -45
  139. package/dist/hub-catalogue/requirement/req-audit-logging.radical +0 -43
  140. package/dist/hub-catalogue/requirement/req-auth-response-time.radical +0 -45
  141. package/dist/hub-catalogue/requirement/req-auth.radical +0 -43
  142. package/dist/hub-catalogue/requirement/req-autoscaling.radical +0 -62
  143. package/dist/hub-catalogue/requirement/req-availability.radical +0 -50
  144. package/dist/hub-catalogue/requirement/req-backward-compatibility.radical +0 -46
  145. package/dist/hub-catalogue/requirement/req-batch-job-completion.radical +0 -50
  146. package/dist/hub-catalogue/requirement/req-carbon-efficiency.radical +0 -64
  147. package/dist/hub-catalogue/requirement/req-centralised-logging.radical +0 -45
  148. package/dist/hub-catalogue/requirement/req-ci-pipeline-time.radical +0 -43
  149. package/dist/hub-catalogue/requirement/req-code-complexity.radical +0 -43
  150. package/dist/hub-catalogue/requirement/req-config-propagation.radical +0 -45
  151. package/dist/hub-catalogue/requirement/req-data-integrity.radical +0 -35
  152. package/dist/hub-catalogue/requirement/req-data-retention.radical +0 -44
  153. package/dist/hub-catalogue/requirement/req-db-query-response.radical +0 -44
  154. package/dist/hub-catalogue/requirement/req-disaster-recovery.radical +0 -59
  155. package/dist/hub-catalogue/requirement/req-distributed-tracing.radical +0 -45
  156. package/dist/hub-catalogue/requirement/req-encryption.radical +0 -49
  157. package/dist/hub-catalogue/requirement/req-error-rate.radical +0 -45
  158. package/dist/hub-catalogue/requirement/req-error-recovery.radical +0 -34
  159. package/dist/hub-catalogue/requirement/req-event-schema-compatibility.radical +0 -37
  160. package/dist/hub-catalogue/requirement/req-fail-safe-default.radical +0 -55
  161. package/dist/hub-catalogue/requirement/req-fast-startup-graceful-shutdown.radical +0 -69
  162. package/dist/hub-catalogue/requirement/req-gdpr-erasure.radical +0 -44
  163. package/dist/hub-catalogue/requirement/req-graceful-degradation.radical +0 -39
  164. package/dist/hub-catalogue/requirement/req-health-checks.radical +0 -43
  165. package/dist/hub-catalogue/requirement/req-iac.radical +0 -36
  166. package/dist/hub-catalogue/requirement/req-idempotency.radical +0 -47
  167. package/dist/hub-catalogue/requirement/req-input-validation.radical +0 -37
  168. package/dist/hub-catalogue/requirement/req-least-privilege.radical +0 -47
  169. package/dist/hub-catalogue/requirement/req-ledger-immutability.radical +0 -38
  170. package/dist/hub-catalogue/requirement/req-mfa.radical +0 -36
  171. package/dist/hub-catalogue/requirement/req-ml-extraction-accuracy.radical +0 -42
  172. package/dist/hub-catalogue/requirement/req-onboarding-time.radical +0 -42
  173. package/dist/hub-catalogue/requirement/req-page-load-time.radical +0 -59
  174. package/dist/hub-catalogue/requirement/req-payout-latency.radical +0 -46
  175. package/dist/hub-catalogue/requirement/req-presence-latency.radical +0 -46
  176. package/dist/hub-catalogue/requirement/req-rate-limiting.radical +0 -45
  177. package/dist/hub-catalogue/requirement/req-report-generation.radical +0 -44
  178. package/dist/hub-catalogue/requirement/req-resource-efficiency.radical +0 -64
  179. package/dist/hub-catalogue/requirement/req-resource-headroom.radical +0 -53
  180. package/dist/hub-catalogue/requirement/req-resource-isolation.radical +0 -37
  181. package/dist/hub-catalogue/requirement/req-search-response-time.radical +0 -44
  182. package/dist/hub-catalogue/requirement/req-secrets-management.radical +0 -45
  183. package/dist/hub-catalogue/requirement/req-task-success-rate.radical +0 -42
  184. package/dist/hub-catalogue/requirement/req-test-coverage.radical +0 -42
  185. package/dist/hub-catalogue/requirement/req-throughput.radical +0 -55
  186. package/dist/hub-catalogue/requirement/req-vulnerability-scanning.radical +0 -52
  187. package/dist/hub-catalogue/requirement/req-zero-downtime-deploy.radical +0 -39
@@ -0,0 +1,1210 @@
1
+ {
2
+ "hub": {
3
+ "id": "concern-api-style-guide",
4
+ "category": "concern",
5
+ "name": "API style guide",
6
+ "description": "Which published HTTP API guideline the element's APIs follow, how conformance is checked, whether the OpenAPI document comes before the code or from it, and how a deviation is recorded. The lead pack of the API Guidelines group: the Resource design, Errors, Collections and Idempotency and concurrency packs decide the details the chosen guide suggests, and API evolution decides the description format and versions.",
7
+ "tags": [
8
+ "api",
9
+ "style-guide",
10
+ "openapi",
11
+ "spectral",
12
+ "linting",
13
+ "api-governance"
14
+ ],
15
+ "requiredMetamodel": "c4-ddd-governance-builtin",
16
+ "concern": {
17
+ "id": "api-style-guide",
18
+ "trigger": "LIST RELATIONS WHERE source.type != \"person\" AND target.external != true AND (target.type = \"container\" OR target.type = \"component\")",
19
+ "applyTo": "target",
20
+ "why": "other systems or other parts call these elements, so which API guideline their interfaces follow, and how that is checked, has to be decided.",
21
+ "group": "api"
22
+ },
23
+ "sources": [
24
+ {
25
+ "title": "Microsoft Azure REST API Guidelines (microsoft/api-guidelines, azure/Guidelines.md)",
26
+ "url": "https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md"
27
+ },
28
+ {
29
+ "title": "Microsoft REST API Guidelines repository: the general guide deprecated, the Azure and Microsoft Graph guidelines current",
30
+ "url": "https://github.com/microsoft/api-guidelines"
31
+ },
32
+ {
33
+ "title": "Zalando RESTful API and Event Guidelines",
34
+ "url": "https://opensource.zalando.com/restful-api-guidelines/"
35
+ },
36
+ {
37
+ "title": "Google API Improvement Proposals (AIPs)",
38
+ "url": "https://google.aip.dev/"
39
+ },
40
+ {
41
+ "title": "OpenAPI Specification 3.1.1",
42
+ "url": "https://spec.openapis.org/oas/v3.1.1.html"
43
+ },
44
+ {
45
+ "title": "Spectral documentation (rulesets, extends, overrides, CLI)",
46
+ "url": "https://github.com/stoplightio/spectral/tree/develop/docs"
47
+ },
48
+ {
49
+ "title": "Zally, the API linter for the Zalando guidelines",
50
+ "url": "https://github.com/zalando/zally"
51
+ },
52
+ {
53
+ "title": "Spectral ruleset for the Zalando RESTful API Guidelines (@baloise/spectral-rules)",
54
+ "url": "https://github.com/baloise-incubator/spectral-ruleset"
55
+ },
56
+ {
57
+ "title": "Azure API Style Guide and its Spectral ruleset (archived September 2026)",
58
+ "url": "https://github.com/Azure/azure-api-style-guide"
59
+ },
60
+ {
61
+ "title": "Google API Linter (protocol buffers)",
62
+ "url": "https://linter.aip.dev/"
63
+ },
64
+ {
65
+ "title": "RFC 9110, HTTP Semantics",
66
+ "url": "https://www.rfc-editor.org/rfc/rfc9110"
67
+ }
68
+ ],
69
+ "templateParams": [
70
+ {
71
+ "key": "GUIDE",
72
+ "title": "Guide",
73
+ "label": "Which published API guideline do the element's HTTP APIs follow?",
74
+ "hint": "One guide settles hundreds of small questions at once: field names, paths, lists, errors, updates. The other API Guidelines packs (Resource design, Errors, Collections, Idempotency and concurrency) decide those details; the guide picked here is what they start from. Microsoft's general REST API Guidelines are deprecated: Microsoft now keeps the Azure guidelines, the complete one, and the Microsoft Graph guidelines, which are for Graph workloads only. Applies to HTTP/JSON APIs described in OpenAPI; GraphQL and gRPC follow their own conventions, and the API evolution pack decides the description format.",
75
+ "defaultValue": "zalando",
76
+ "options": [
77
+ {
78
+ "value": "azure",
79
+ "label": "the Microsoft Azure REST API Guidelines",
80
+ "description": "Microsoft's current REST guide (azure/Guidelines.md in microsoft/api-guidelines): camelCase field names, lists as a value array with a nextLink, an error object with code and message plus an x-ms-error-code header, a required api-version query parameter, JSON Merge Patch for updates. Pick it on Azure or Microsoft stacks, or when your callers already know Azure's APIs; its Spectral ruleset is archived, so you keep a copy yourself."
81
+ },
82
+ {
83
+ "value": "zalando",
84
+ "label": "the Zalando RESTful API Guidelines",
85
+ "description": "An open guide of numbered MUST, SHOULD and MAY rules: API first, snake_case property names, kebab-case paths, Problem JSON for errors, cursor-based pagination preferred, no version in the URL. Pick it for a REST landscape of several teams that wants rules strict enough to lint; Zally and a community Spectral ruleset check them."
86
+ },
87
+ {
88
+ "value": "google",
89
+ "label": "Google's API Improvement Proposals (AIPs)",
90
+ "description": "Google's numbered proposals for resource-oriented APIs: resource names, the standard methods Get, List, Create, Update and Delete, custom methods with a colon verb, page tokens, errors as google.rpc.Status, written protobuf-first and mapped to HTTP/JSON with camelCase fields (AIP-127). Pick it when your APIs are also served over gRPC or you follow Google Cloud's style; only protocol buffers have a linter (api-linter), so for OpenAPI the team writes the Spectral rules."
91
+ },
92
+ {
93
+ "value": "own",
94
+ "label": "our own guide, derived from a published one",
95
+ "description": "A guide kept in the repository (api/style/guide.md) that names the published guide it starts from, numbers its rules, and says where and why it differs. Pick it when the organisation already has conventions no published guide matches, or several guides must be reconciled; you own the rules and their ruleset."
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ "key": "LINT",
101
+ "title": "Enforcement",
102
+ "label": "How is conformance to the guide enforced?",
103
+ "hint": "A linter checks naming and structure on every change in seconds; reviewers then spend their time on the design, which no linter judges. API owners review contract changes either way.",
104
+ "defaultValue": "spectral",
105
+ "options": [
106
+ {
107
+ "value": "spectral",
108
+ "label": "Spectral in CI, failing the pull request",
109
+ "description": "Every pull request lints the OpenAPI documents with Spectral and the guide's ruleset kept in the repository; a finding of severity error blocks the merge, warnings show on the changed lines. Pick it whenever the guide has a ruleset or the team can write one. With the Zalando guide, Zally does the same where the team runs a Zally server."
110
+ },
111
+ {
112
+ "value": "review",
113
+ "label": "review by the API owners only",
114
+ "description": "No linter: the API owners check each contract change against the guide with a checklist in the pull request. Pick it for one small API, or for the months before a ruleset exists; it does not scale past a few APIs and misses what a tired reviewer misses."
115
+ }
116
+ ]
117
+ },
118
+ {
119
+ "key": "DESIGN",
120
+ "title": "Contract first?",
121
+ "label": "Does the OpenAPI document come before the code or from it?",
122
+ "hint": "Design-first agrees the contract before anyone builds against it; code-first keeps the document and the code from drifting apart because one is made from the other. The guide is checked on the document in both cases.",
123
+ "defaultValue": "design",
124
+ "options": [
125
+ {
126
+ "value": "design",
127
+ "label": "the OpenAPI document written first and merged before the code",
128
+ "description": "A new or changed operation is proposed as a change to the document alone, reviewed, merged, and only then implemented; the server serves exactly what the document describes. Pick it for APIs other teams or companies call, where the contract is agreed before anyone builds against it. The Zalando guide requires it (rule 100, API first)."
129
+ },
130
+ {
131
+ "value": "code",
132
+ "label": "the OpenAPI document generated from the code",
133
+ "description": "The document is generated from the code's annotations (springdoc-openapi, FastAPI, @nestjs/swagger, tsoa), committed under api/, and each pull request shows its diff for review. Pick it for APIs whose callers are your own front ends, or where the framework's annotations are the team's habit."
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ "key": "EXCEPTIONS",
139
+ "title": "Deviations",
140
+ "label": "How is a deviation from the guide recorded?",
141
+ "hint": "Some deviations are necessary: a legacy API, a partner's format, a framework that cannot do otherwise. Recorded where they happen, with a reason and an end, they stay visible; unrecorded, they become the rule.",
142
+ "defaultValue": "inline",
143
+ "options": [
144
+ {
145
+ "value": "inline",
146
+ "label": "an inline exception in the OpenAPI document, with a reason and an expiry",
147
+ "description": "A deviation is recorded on the operation or schema it concerns, as an x-api-style-exceptions entry naming the rule, the reason, the approving API owner and an expiry date; the linter turns that rule off there and nowhere else. Pick it for a landscape with legacy APIs or partner formats that cannot follow every rule."
148
+ },
149
+ {
150
+ "value": "none",
151
+ "label": "no exceptions; a rule that does not fit is changed for every API",
152
+ "description": "Nothing turns a rule off for one API: a rule that does not fit is changed or removed in the ruleset for everyone. Pick it for a new landscape with few APIs, where the first exception would not be the last."
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ "key": "API_OWNERS",
158
+ "label": "Which GitHub team owns the API style and approves contract changes?",
159
+ "defaultValue": "@acme/api-owners"
160
+ },
161
+ {
162
+ "key": "EXCEPTION_MONTHS",
163
+ "label": "For how many months at most may an exception stand before it is renewed? (inline exceptions only)",
164
+ "defaultValue": "6",
165
+ "type": "number"
166
+ }
167
+ ]
168
+ },
169
+ "nodes": [
170
+ {
171
+ "id": "need",
172
+ "type": "need",
173
+ "label": "APIs that read as one",
174
+ "x": 0,
175
+ "y": 0,
176
+ "kind": "brief",
177
+ "source": "Hub concern pack: API style guide",
178
+ "description": "Other systems and other parts of this system call its APIs. Every caller learns one API and expects the next to work the same way: the same names, the same lists, the same errors. Without a guide, and without a check that the guide is followed, each API drifts its own way and every caller pays for it in client code. The snippets assume one OpenAPI document per API under api/ (api/orders.yaml), the style ruleset in api/style/ruleset.yaml extended by .spectral.yaml at the root, our own guide (where there is one) in api/style/guide.md, the router's table exported from src/app, and CODEOWNERS and the pull-request template under .github/."
179
+ },
180
+ {
181
+ "id": "req-guide-declared",
182
+ "type": "requirement",
183
+ "label": "Guide named in every contract",
184
+ "x": 260,
185
+ "y": 0,
186
+ "ears_type": "ubiquitous",
187
+ "action": "declare in every OpenAPI document under api/ the guide it follows, as info.x-api-guide with the name and URL of {{GUIDE}} and the revision adopted, the same guide in every document",
188
+ "rationale": "Callers and reviewers can tell which conventions to expect, and a guide that changes upstream is adopted on purpose at a known revision; OpenAPI allows such x- extensions on the Info Object (OpenAPI Specification 3.1.1, Specification Extensions)."
189
+ },
190
+ {
191
+ "id": "req-lint",
192
+ "type": "requirement",
193
+ "label": "Contracts linted on every change",
194
+ "x": 260,
195
+ "y": 130,
196
+ "ears_type": "event-driven",
197
+ "trigger": "a pull request changes a document under api/ or the style ruleset",
198
+ "action": "lint every document under api/ with Spectral and the ruleset of {{GUIDE}}, block the merge on any finding of severity error, and show warnings on the changed lines",
199
+ "rationale": "Naming and structure are what a linter checks best and reviewers check worst; failing at severity error is Spectral's default (Spectral documentation, CLI: --fail-severity).",
200
+ "hubWhen": {
201
+ "LINT": [
202
+ "spectral"
203
+ ]
204
+ }
205
+ },
206
+ {
207
+ "id": "req-ruleset-pinned",
208
+ "type": "requirement",
209
+ "label": "Ruleset kept and pinned",
210
+ "x": 260,
211
+ "y": 260,
212
+ "ears_type": "ubiquitous",
213
+ "action": "keep the style ruleset in the repository under api/style/, extending the guide's published ruleset only as a vendored copy or a package at an exact version, never a URL, so that a change upstream never fails an unchanged pull request",
214
+ "rationale": "A ruleset fetched from a branch changes under you; the Azure ruleset is archived and will not change at all, so it is kept as a copy (Spectral documentation, extends; Azure API Style Guide).",
215
+ "hubWhen": {
216
+ "LINT": [
217
+ "spectral"
218
+ ]
219
+ }
220
+ },
221
+ {
222
+ "id": "req-rule-sources",
223
+ "type": "requirement",
224
+ "label": "Every rule names its guideline",
225
+ "x": 260,
226
+ "y": 390,
227
+ "ears_type": "ubiquitous",
228
+ "action": "give every rule the ruleset defines a documentationUrl to the guideline it enforces and a severity of error for the guide's MUST (DO) rules and warn for its SHOULD rules",
229
+ "rationale": "A finding that links to its guideline is fixed rather than argued about, and the severity mirrors the guide's own keywords (Spectral documentation, rules: documentationUrl and severity; Zalando RESTful API Guidelines, rule 100).",
230
+ "hubWhen": {
231
+ "LINT": [
232
+ "spectral"
233
+ ]
234
+ }
235
+ },
236
+ {
237
+ "id": "req-owners-review",
238
+ "type": "requirement",
239
+ "label": "API owners approve contract changes",
240
+ "x": 260,
241
+ "y": 520,
242
+ "ears_type": "event-driven",
243
+ "trigger": "a pull request changes a document or the style ruleset under api/",
244
+ "action": "request a review from {{API_OWNERS}} and merge it only after one of them approves, having checked the change against {{GUIDE}} for what no rule checks",
245
+ "rationale": "A linter checks names and shapes, not whether a resource is the right one; the guides assume a review by people who own the API style (Microsoft Azure REST API Guidelines, API review; Zalando RESTful API Guidelines, rule 100)."
246
+ },
247
+ {
248
+ "id": "req-review-checklist",
249
+ "type": "requirement",
250
+ "label": "Guide checklist ticked",
251
+ "x": 260,
252
+ "y": 650,
253
+ "ears_type": "event-driven",
254
+ "trigger": "a pull request changes a document under api/",
255
+ "action": "carry the API style checklist of {{GUIDE}} from the pull-request template, and merge only when every item of it is ticked",
256
+ "rationale": "Without a linter the checklist is the only record that each rule was looked at; an unticked item is a question the reviewer skipped.",
257
+ "hubWhen": {
258
+ "LINT": [
259
+ "review"
260
+ ]
261
+ }
262
+ },
263
+ {
264
+ "id": "req-design-first",
265
+ "type": "requirement",
266
+ "label": "Contract merged before code",
267
+ "x": 260,
268
+ "y": 780,
269
+ "ears_type": "unwanted-behaviour",
270
+ "unwanted_condition": "a pull request changes a document under api/ and the implementation under src/ together",
271
+ "action": "refuse the merge, so that a contract change is reviewed and merged on its own before the code that serves it",
272
+ "rationale": "An agreed contract lets callers build against it while it is implemented; reviewed beside its code, the contract is read as a by-product of it (Zalando RESTful API Guidelines, rule 100, API first).",
273
+ "hubWhen": {
274
+ "DESIGN": [
275
+ "design"
276
+ ]
277
+ }
278
+ },
279
+ {
280
+ "id": "req-design-routes",
281
+ "type": "requirement",
282
+ "label": "Server serves the contract",
283
+ "x": 260,
284
+ "y": 910,
285
+ "ears_type": "ubiquitous",
286
+ "action": "serve exactly the operations its OpenAPI documents describe: 0 routes the documents do not describe, and 501 Not Implemented for every described operation not built yet",
287
+ "rationale": "With the contract first, the code follows it; an undescribed route is a contract nobody reviewed, and 501 is the status for a method the server does not support yet (RFC 9110, 15.6.2).",
288
+ "hubWhen": {
289
+ "DESIGN": [
290
+ "design"
291
+ ]
292
+ }
293
+ },
294
+ {
295
+ "id": "req-code-first",
296
+ "type": "requirement",
297
+ "label": "Generated contract committed",
298
+ "x": 260,
299
+ "y": 1040,
300
+ "ears_type": "event-driven",
301
+ "trigger": "a pull request is built",
302
+ "action": "generate the OpenAPI documents from the code and fail when they differ from the documents committed under api/, so that every contract change shows as a diff in the pull request",
303
+ "rationale": "Generated from the code the document cannot drift from it, but callers and the linter read the committed copy; the diff is where a reviewer sees the contract change (OpenAPI Specification 3.1.1).",
304
+ "hubWhen": {
305
+ "DESIGN": [
306
+ "code"
307
+ ]
308
+ }
309
+ },
310
+ {
311
+ "id": "req-exception-recorded",
312
+ "type": "requirement",
313
+ "label": "Deviations recorded where they occur",
314
+ "x": 260,
315
+ "y": 1170,
316
+ "ears_type": "ubiquitous",
317
+ "action": "record each deviation from {{GUIDE}} on the element of the OpenAPI document it concerns, as an x-api-style-exceptions entry naming the rule, the reason, the approving API owner, the approval date and an expiry at most {{EXCEPTION_MONTHS}} months later, and turn a lint rule off only through such an entry",
318
+ "rationale": "An exception kept beside what it excuses is seen by every reader of the contract; Spectral can turn a rule off for one part of one document, and Zally's x-zally-ignore shows the same idea (Spectral documentation, overrides; Zally).",
319
+ "hubWhen": {
320
+ "EXCEPTIONS": [
321
+ "inline"
322
+ ]
323
+ }
324
+ },
325
+ {
326
+ "id": "req-exception-expiry",
327
+ "type": "requirement",
328
+ "label": "Expired exceptions fail",
329
+ "x": 260,
330
+ "y": 1300,
331
+ "ears_type": "unwanted-behaviour",
332
+ "unwanted_condition": "an exception passes its expiry date",
333
+ "action": "fail the build until the deviation is fixed or the exception is renewed with a new approval in a pull request the API owners approve",
334
+ "rationale": "An exception without an end becomes the rule; the expiry makes someone decide again.",
335
+ "hubWhen": {
336
+ "EXCEPTIONS": [
337
+ "inline"
338
+ ]
339
+ }
340
+ },
341
+ {
342
+ "id": "req-no-exceptions",
343
+ "type": "requirement",
344
+ "label": "No rule off for one API",
345
+ "x": 260,
346
+ "y": 1430,
347
+ "ears_type": "unwanted-behaviour",
348
+ "unwanted_condition": "a document or the ruleset turns a rule off for one part of an API, through an x-api-style-exceptions entry, x-zally-ignore or a Spectral override",
349
+ "action": "fail the build; a rule that does not fit is changed or removed in the ruleset for every API, in a pull request the API owners approve",
350
+ "rationale": "With no exceptions the ruleset is the same for everyone, so a misfit rule is fixed once instead of excused many times (Spectral documentation, overrides; Zally, rule H002: avoid x-zally-ignore).",
351
+ "hubWhen": {
352
+ "EXCEPTIONS": [
353
+ "none"
354
+ ]
355
+ }
356
+ },
357
+ {
358
+ "id": "req-own-guide",
359
+ "type": "requirement",
360
+ "label": "Our guide says how each rule is checked",
361
+ "x": 260,
362
+ "y": 1560,
363
+ "ears_type": "ubiquitous",
364
+ "action": "keep the guide in api/style/guide.md, naming the published guide it derives from and its revision, with every rule numbered, marked MUST or SHOULD, and followed by the lint rule that checks it or \"review\"",
365
+ "rationale": "A guide of our own is only as good as its upkeep: naming the base keeps its answers traceable, and naming the check for each rule shows what is enforced and what is hoped for (Spectral documentation, rulesets).",
366
+ "hubWhen": {
367
+ "GUIDE": [
368
+ "own"
369
+ ]
370
+ }
371
+ },
372
+ {
373
+ "id": "sc-guide-declared",
374
+ "type": "scenario",
375
+ "label": "Contract names its guide",
376
+ "x": 520,
377
+ "y": 0,
378
+ "given": "the OpenAPI documents under api/",
379
+ "when": "their info objects are read",
380
+ "then": "each has x-api-guide with a name, an https URL and a revision, and all name the same guide"
381
+ },
382
+ {
383
+ "id": "sc-lint",
384
+ "type": "scenario",
385
+ "label": "Violation blocks the merge",
386
+ "x": 520,
387
+ "y": 130,
388
+ "given": "a pull request adding a property whose name breaks the guide's casing rule",
389
+ "when": "the API style job runs",
390
+ "then": "it fails with an annotation on that line, and the pull request cannot be merged",
391
+ "hubWhen": {
392
+ "LINT": [
393
+ "spectral"
394
+ ]
395
+ }
396
+ },
397
+ {
398
+ "id": "sc-ruleset-pinned",
399
+ "type": "scenario",
400
+ "label": "Unpinned ruleset refused",
401
+ "x": 520,
402
+ "y": 260,
403
+ "given": "a ruleset that extends a raw GitHub URL",
404
+ "when": "the ruleset check runs",
405
+ "then": "it fails naming the URL, and passes once the ruleset is vendored or installed at an exact version",
406
+ "hubWhen": {
407
+ "LINT": [
408
+ "spectral"
409
+ ]
410
+ }
411
+ },
412
+ {
413
+ "id": "sc-rule-sources",
414
+ "type": "scenario",
415
+ "label": "Rule without a source refused",
416
+ "x": 520,
417
+ "y": 390,
418
+ "given": "a new rule in api/style/ruleset.yaml with no documentationUrl",
419
+ "when": "the ruleset check runs",
420
+ "then": "it fails naming the rule",
421
+ "hubWhen": {
422
+ "LINT": [
423
+ "spectral"
424
+ ]
425
+ }
426
+ },
427
+ {
428
+ "id": "sc-owners-review",
429
+ "type": "scenario",
430
+ "label": "Contract waits for its owners",
431
+ "x": 520,
432
+ "y": 520,
433
+ "given": "a pull request that changes api/orders.yaml",
434
+ "when": "it is opened",
435
+ "then": "{{API_OWNERS}} is requested for review and the merge waits for its approval"
436
+ },
437
+ {
438
+ "id": "sc-review-checklist",
439
+ "type": "scenario",
440
+ "label": "Unticked item blocks",
441
+ "x": 520,
442
+ "y": 650,
443
+ "given": "a pull request changing api/orders.yaml whose checklist has one item unticked",
444
+ "when": "the checklist job runs",
445
+ "then": "it fails, and passes once the item is ticked",
446
+ "hubWhen": {
447
+ "LINT": [
448
+ "review"
449
+ ]
450
+ }
451
+ },
452
+ {
453
+ "id": "sc-design-first",
454
+ "type": "scenario",
455
+ "label": "Mixed change refused",
456
+ "x": 520,
457
+ "y": 780,
458
+ "given": "a pull request adding an operation to api/orders.yaml and its handler to src/",
459
+ "when": "the design-first check runs",
460
+ "then": "it fails; split into two pull requests, the contract one passes",
461
+ "hubWhen": {
462
+ "DESIGN": [
463
+ "design"
464
+ ]
465
+ }
466
+ },
467
+ {
468
+ "id": "sc-design-routes",
469
+ "type": "scenario",
470
+ "label": "Undescribed route caught",
471
+ "x": 520,
472
+ "y": 910,
473
+ "given": "a handler for GET /orders/{id}/notes that api/orders.yaml does not describe",
474
+ "when": "the route test runs",
475
+ "then": "it fails naming GET /orders/{id}/notes",
476
+ "hubWhen": {
477
+ "DESIGN": [
478
+ "design"
479
+ ]
480
+ }
481
+ },
482
+ {
483
+ "id": "sc-code-first",
484
+ "type": "scenario",
485
+ "label": "Stale contract caught",
486
+ "x": 520,
487
+ "y": 1040,
488
+ "given": "a pull request that renames a field in the code without regenerating api/",
489
+ "when": "it is built",
490
+ "then": "the contract job fails and names api/ as changed",
491
+ "hubWhen": {
492
+ "DESIGN": [
493
+ "code"
494
+ ]
495
+ }
496
+ },
497
+ {
498
+ "id": "sc-exception-recorded",
499
+ "type": "scenario",
500
+ "label": "Incomplete exception refused",
501
+ "x": 520,
502
+ "y": 1170,
503
+ "given": "an x-api-style-exceptions entry with no reason on GET /orders",
504
+ "when": "the exception check runs",
505
+ "then": "it fails naming the operation; with a reason, an approver and an expiry it passes and the rule is off for that operation only",
506
+ "hubWhen": {
507
+ "EXCEPTIONS": [
508
+ "inline"
509
+ ]
510
+ }
511
+ },
512
+ {
513
+ "id": "sc-exception-expiry",
514
+ "type": "scenario",
515
+ "label": "Expired exception fails",
516
+ "x": 520,
517
+ "y": 1300,
518
+ "given": "an exception whose expiry was yesterday",
519
+ "when": "the exception check runs",
520
+ "then": "it fails naming the rule and the date",
521
+ "hubWhen": {
522
+ "EXCEPTIONS": [
523
+ "inline"
524
+ ]
525
+ }
526
+ },
527
+ {
528
+ "id": "sc-no-exceptions",
529
+ "type": "scenario",
530
+ "label": "Override refused",
531
+ "x": 520,
532
+ "y": 1430,
533
+ "given": "a pull request that adds an overrides section to .spectral.yaml",
534
+ "when": "the build runs",
535
+ "then": "it fails and asks for the rule to be changed in api/style/ruleset.yaml instead",
536
+ "hubWhen": {
537
+ "EXCEPTIONS": [
538
+ "none"
539
+ ]
540
+ }
541
+ },
542
+ {
543
+ "id": "sc-own-guide",
544
+ "type": "scenario",
545
+ "label": "Rule without a check refused",
546
+ "x": 520,
547
+ "y": 1560,
548
+ "given": "api/style/guide.md with a rule \"R14 MUST\" and no \"Checked by:\" line",
549
+ "when": "the guide test runs",
550
+ "then": "it fails, and passes once the rule names a lint rule that exists or \"review\"",
551
+ "hubWhen": {
552
+ "GUIDE": [
553
+ "own"
554
+ ]
555
+ }
556
+ },
557
+ {
558
+ "id": "adr-guide-azure",
559
+ "type": "adr",
560
+ "label": "APIs follow the Microsoft Azure REST API Guidelines",
561
+ "x": 780,
562
+ "y": 0,
563
+ "concern": "api-style-guide",
564
+ "status": "accepted",
565
+ "date": "",
566
+ "context": "Other systems and other parts of this system call its API, and every caller pays for each inconsistency in it: a field named in camelCase here and snake_case there, lists paged three ways, errors in four shapes. The forces: without a written guide every team decides these small questions again, and differently; a published guide settles hundreds of them at once and has been argued over in public, but none fits every case and each brings its own conventions with it; rules that only reviewers check drift with reviewer fatigue, while a linter catches naming and structure in seconds and says nothing about design; some deviations are necessary (a legacy API, a partner's format), but an exception without a reason and an end becomes the rule; and the contract may be written before the code or produced from it, while the guide has to hold for the document callers read. HTTP semantics (RFC 9110) are the common ground every guide refines. This pack applies to HTTP/JSON APIs described in OpenAPI; GraphQL and gRPC follow their own conventions.",
567
+ "decision": "Every HTTP/JSON API of the element follows the Microsoft Azure REST API Guidelines (azure/Guidelines.md on the vNext branch of microsoft/api-guidelines), at the revision recorded in each document's info.x-api-guide. The general Microsoft REST API Guidelines are deprecated and are not used; the Microsoft Graph guidelines apply to Microsoft Graph workloads only. Its DO rules are binding, its YOU SHOULD rules are followed unless an exception says why; the parts written for Azure Resource Manager and the Azure API Stewardship Board are not adopted, and our API owners ({{API_OWNERS}}) take the Board's place. For the other API Guidelines packs it implies camelCase field names, lists as an object with a value array and an absolute nextLink, an error object with code and message and an x-ms-error-code header, JSON Merge Patch for partial updates, ETag with If-Match for concurrency and Repeatability-Request-ID for retried POSTs; its api-version query parameter is weighed in the API evolution pack. Conformance: {{LINT}}. Where Spectral lints, api/style/ruleset.yaml extends the Spectral ruleset of Azure/azure-api-style-guide (spectral.yaml with its functions directory), vendored into api/style/vendor/azure at that repository's final commit: the repository was archived in September 2026 when Azure moved its specifications to TypeSpec, so the copy is ours to keep. Contract: {{DESIGN}}. Deviations: {{EXCEPTIONS}}. The OpenAPI extensions of our own are named in this decision and nowhere else: info.x-api-guide (the guide and its revision), x-api-style-exceptions (a recorded deviation, where deviations are allowed) and x-retry-safe (an operation a client must not retry, when the Idempotency and concurrency pack decides so); a pack or team that needs another x- name adds it here first.",
568
+ "consequences": "• Callers who know Azure's APIs, and clients generated for them, find what they expect.\n• The guide is long and written for Azure services; deciding which of its rules apply is work the API owners do once and record.\n• The archived ruleset gets no fixes: rules that misfire on OpenAPI 3.1 are changed in our copy, and new rules are ours to write.\n• Azure itself now designs in TypeSpec, so the guide's own tooling has moved away from hand-written OpenAPI.",
569
+ "alternatives": "1. The Zalando RESTful API Guidelines: stricter, with numbered rules made to be linted, but snake_case and Problem JSON differ from Microsoft's conventions.\n2. Google's AIPs: thorough on resource design, but protobuf-first and without an OpenAPI linter.\n3. The Microsoft Graph REST API Guidelines: Microsoft's other current guide, but built around Microsoft Graph and OData conventions.\n4. Our own guide derived from this one: freedom to drop the Azure-only parts, at the cost of keeping a guide.",
570
+ "hubWhen": {
571
+ "GUIDE": [
572
+ "azure"
573
+ ]
574
+ }
575
+ },
576
+ {
577
+ "id": "adr-guide-zalando",
578
+ "type": "adr",
579
+ "label": "APIs follow the Zalando RESTful API Guidelines",
580
+ "x": 780,
581
+ "y": 130,
582
+ "concern": "api-style-guide",
583
+ "status": "accepted",
584
+ "date": "",
585
+ "context": "Other systems and other parts of this system call its API, and every caller pays for each inconsistency in it: a field named in camelCase here and snake_case there, lists paged three ways, errors in four shapes. The forces: without a written guide every team decides these small questions again, and differently; a published guide settles hundreds of them at once and has been argued over in public, but none fits every case and each brings its own conventions with it; rules that only reviewers check drift with reviewer fatigue, while a linter catches naming and structure in seconds and says nothing about design; some deviations are necessary (a legacy API, a partner's format), but an exception without a reason and an end becomes the rule; and the contract may be written before the code or produced from it, while the guide has to hold for the document callers read. HTTP semantics (RFC 9110) are the common ground every guide refines. This pack applies to HTTP/JSON APIs described in OpenAPI; GraphQL and gRPC follow their own conventions.",
586
+ "decision": "Every HTTP/JSON API of the element follows the Zalando RESTful API Guidelines (opensource.zalando.com/restful-api-guidelines), at the revision recorded in each document's info.x-api-guide. MUST rules are binding, SHOULD rules are followed unless an exception says why. Every document carries info.x-api-id and info.x-audience (rules 215 and 219). For the other API Guidelines packs it implies snake_case property names (rule 118), kebab-case path segments (rule 129), Problem JSON for errors (rule 176), cursor-based pagination over offsets (rule 160), and ETag with If-Match and the Idempotency-Key header as options (rules 182 and 230); its rule against versions in the URL (rule 115) is weighed in the API evolution pack. Rule 100 asks for API first, which is met only when the OpenAPI document is written and merged before the code. Conformance: {{LINT}}. Where Spectral lints, api/style/ruleset.yaml extends the zalando flavour of the community ruleset @baloise/spectral-rules (zalando.yml, installed at an exact version), which covers part of the MUST rules, and adds rules of ours for the rest that a document shows; Zally, Zalando's own linter, is the alternative where the team runs a Zally server (zally lint fails on any MUST violation). Contract: {{DESIGN}}. Deviations: {{EXCEPTIONS}}. API owners ({{API_OWNERS}}) approve every contract change. The OpenAPI extensions of our own are named in this decision and nowhere else: info.x-api-guide (the guide and its revision), x-api-style-exceptions (a recorded deviation, where deviations are allowed) and x-retry-safe (an operation a client must not retry, when the Idempotency and concurrency pack decides so); a pack or team that needs another x- name adds it here first.",
587
+ "consequences": "• Numbered rules with MUST, SHOULD and MAY make findings and exceptions easy to name.\n• snake_case fields are unusual for JavaScript clients, which map names or live with them.\n• The community Spectral ruleset is maintained by Baloise, not Zalando, and covers only part of the MUST rules; the rest are ours to write or to check in review.\n• The guide also covers events and Zalando's own infrastructure (x-api-id, x-audience); the parts that do not apply to us are recorded once.",
588
+ "alternatives": "1. The Microsoft Azure REST API Guidelines: camelCase and nextLink, familiar to Azure users, but its ruleset is archived.\n2. Google's AIPs: thorough on resource design, but protobuf-first and without an OpenAPI linter.\n3. Our own guide derived from this one: our conventions, at the cost of keeping a guide.\n4. No guide: every team decides again, and the callers pay for the differences.",
589
+ "hubWhen": {
590
+ "GUIDE": [
591
+ "zalando"
592
+ ]
593
+ }
594
+ },
595
+ {
596
+ "id": "adr-guide-google",
597
+ "type": "adr",
598
+ "label": "APIs follow Google's API Improvement Proposals",
599
+ "x": 780,
600
+ "y": 260,
601
+ "concern": "api-style-guide",
602
+ "status": "accepted",
603
+ "date": "",
604
+ "context": "Other systems and other parts of this system call its API, and every caller pays for each inconsistency in it: a field named in camelCase here and snake_case there, lists paged three ways, errors in four shapes. The forces: without a written guide every team decides these small questions again, and differently; a published guide settles hundreds of them at once and has been argued over in public, but none fits every case and each brings its own conventions with it; rules that only reviewers check drift with reviewer fatigue, while a linter catches naming and structure in seconds and says nothing about design; some deviations are necessary (a legacy API, a partner's format), but an exception without a reason and an end becomes the rule; and the contract may be written before the code or produced from it, while the guide has to hold for the document callers read. HTTP semantics (RFC 9110) are the common ground every guide refines. This pack applies to HTTP/JSON APIs described in OpenAPI; GraphQL and gRPC follow their own conventions.",
605
+ "decision": "Every HTTP/JSON API of the element follows Google's API Improvement Proposals (google.aip.dev), the general AIPs at the revision recorded in each document's info.x-api-guide: resource-oriented design (AIP-121), resource names (AIP-122), the standard methods (AIP-131 to AIP-135) and custom methods with a colon verb (AIP-136), mapped to HTTP/JSON as AIP-127 describes. For the other API Guidelines packs it implies lowerCamelCase JSON field names (the JSON form of AIP-140's lower_snake_case), page_size and page_token with next_page_token for lists (AIP-158), errors as google.rpc.Status (AIP-193), an etag field for concurrency (AIP-154) and a request_id for safe retries (AIP-155); its major version in the path (AIP-185) is weighed in the API evolution pack. Conformance: {{LINT}}. No Spectral ruleset for AIPs on OpenAPI is published (Google's api-linter checks protocol buffers only), so where Spectral lints, the team writes the rules in api/style/ruleset.yaml, each linked to its AIP, starting with the resource names, the standard methods and the field names. Contract: {{DESIGN}}. Deviations: {{EXCEPTIONS}}. API owners ({{API_OWNERS}}) approve every contract change. The OpenAPI extensions of our own are named in this decision and nowhere else: info.x-api-guide (the guide and its revision), x-api-style-exceptions (a recorded deviation, where deviations are allowed) and x-retry-safe (an operation a client must not retry, when the Idempotency and concurrency pack decides so); a pack or team that needs another x- name adds it here first.",
606
+ "consequences": "• The most thorough guidance on resource design of the three, with a reason given for each rule.\n• The AIPs are written for protocol buffers and gRPC; applying them to a hand-written OpenAPI document means translating each rule through AIP-127.\n• Every lint rule is ours to write and keep, so coverage starts small and grows.\n• Callers who know Google Cloud APIs find what they expect; others meet custom methods such as POST /orders/123:cancel, which some HTTP tooling handles badly.",
607
+ "alternatives": "1. The Zalando RESTful API Guidelines: written for REST over HTTP and with a ruleset to extend.\n2. The Microsoft Azure REST API Guidelines: camelCase like the AIPs, written for HTTP, ruleset archived.\n3. Our own guide derived from the AIPs: keeps their resource model and drops what does not fit HTTP.",
608
+ "hubWhen": {
609
+ "GUIDE": [
610
+ "google"
611
+ ]
612
+ }
613
+ },
614
+ {
615
+ "id": "adr-guide-own",
616
+ "type": "adr",
617
+ "label": "APIs follow our own guide",
618
+ "x": 780,
619
+ "y": 390,
620
+ "concern": "api-style-guide",
621
+ "status": "accepted",
622
+ "date": "",
623
+ "context": "Other systems and other parts of this system call its API, and every caller pays for each inconsistency in it: a field named in camelCase here and snake_case there, lists paged three ways, errors in four shapes. The forces: without a written guide every team decides these small questions again, and differently; a published guide settles hundreds of them at once and has been argued over in public, but none fits every case and each brings its own conventions with it; rules that only reviewers check drift with reviewer fatigue, while a linter catches naming and structure in seconds and says nothing about design; some deviations are necessary (a legacy API, a partner's format), but an exception without a reason and an end becomes the rule; and the contract may be written before the code or produced from it, while the guide has to hold for the document callers read. HTTP semantics (RFC 9110) are the common ground every guide refines. This pack applies to HTTP/JSON APIs described in OpenAPI; GraphQL and gRPC follow their own conventions.",
624
+ "decision": "Every HTTP/JSON API of the element follows our own guide, api/style/guide.md, kept in the repository. Its first lines name the published guide it derives from (the Zalando RESTful API Guidelines, the Microsoft Azure REST API Guidelines or Google's AIPs) and the revision taken; each rule is numbered (R1, R2, …), marked MUST or SHOULD, says where it differs from the base and why, and is followed by a line naming the lint rule that checks it or \"review\". The answers it gives on resource design, errors, collections and idempotency are the ones the other API Guidelines packs record. Each document names the guide in info.x-api-guide. Conformance: {{LINT}}. Where Spectral lints, api/style/ruleset.yaml extends the base guide's ruleset where one exists (a vendored copy of the Azure ruleset, or @baloise/spectral-rules for Zalando, at an exact version) and adds a rule for each checkable rule of ours. Contract: {{DESIGN}}. Deviations: {{EXCEPTIONS}}. The guide and the ruleset change only in pull requests the API owners ({{API_OWNERS}}) approve. The OpenAPI extensions of our own are named in this decision and nowhere else: info.x-api-guide (the guide and its revision), x-api-style-exceptions (a recorded deviation, where deviations are allowed) and x-retry-safe (an operation a client must not retry, when the Idempotency and concurrency pack decides so); a pack or team that needs another x- name adds it here first.",
625
+ "consequences": "• The rules fit the organisation, and each says where it came from.\n• We keep the guide: every change to the base guide is ours to read and adopt or not.\n• New team members learn a guide they cannot find on the web; the guide and its checks must be good enough to learn from.\n• Without discipline the guide grows into a list of everybody's preferences; each rule needs an owner's approval and a check.",
626
+ "alternatives": "1. A published guide as it is: no upkeep, and callers may know it already, but its misfits become exceptions.\n2. No written guide, only the ruleset: rules without reasons, argued about at every finding.",
627
+ "hubWhen": {
628
+ "GUIDE": [
629
+ "own"
630
+ ]
631
+ }
632
+ },
633
+ {
634
+ "id": "adr-design-first",
635
+ "type": "adr",
636
+ "label": "The contract is written before the code",
637
+ "x": 780,
638
+ "y": 520,
639
+ "concern": "api-style-guide",
640
+ "status": "accepted",
641
+ "date": "",
642
+ "context": "Other systems and other parts of this system call its API, and every caller pays for each inconsistency in it: a field named in camelCase here and snake_case there, lists paged three ways, errors in four shapes. The forces: without a written guide every team decides these small questions again, and differently; a published guide settles hundreds of them at once and has been argued over in public, but none fits every case and each brings its own conventions with it; rules that only reviewers check drift with reviewer fatigue, while a linter catches naming and structure in seconds and says nothing about design; some deviations are necessary (a legacy API, a partner's format), but an exception without a reason and an end becomes the rule; and the contract may be written before the code or produced from it, while the guide has to hold for the document callers read. HTTP semantics (RFC 9110) are the common ground every guide refines. This pack applies to HTTP/JSON APIs described in OpenAPI; GraphQL and gRPC follow their own conventions.",
643
+ "decision": "The OpenAPI 3.1 document under api/ is written before the code. A new or changed operation or schema is proposed in a pull request that changes only the documents under api/, reviewed against {{GUIDE}} by {{API_OWNERS}}, merged, and only then implemented in a pull request of its own. Callers can build against a mock served from the merged document (Prism) while the code is written. The server serves exactly what the documents describe: a test compares the router's table with them, and a described operation not built yet answers 501 Not Implemented.",
644
+ "consequences": "• The contract is agreed before anyone builds against it, and callers can start at once.\n• Two pull requests for each new operation, and the second may find the first was wrong, which means a third.\n• The router and the document are kept in step by a test, not by generation; the test must list routes from the router itself.",
645
+ "alternatives": "1. The document generated from the code: no drift and one pull request, but the contract is reviewed only after it is built.\n2. Contract and code in one pull request: faster, but the contract is read as a by-product of the code.",
646
+ "hubWhen": {
647
+ "DESIGN": [
648
+ "design"
649
+ ]
650
+ }
651
+ },
652
+ {
653
+ "id": "adr-code-first",
654
+ "type": "adr",
655
+ "label": "The contract is generated from the code",
656
+ "x": 780,
657
+ "y": 650,
658
+ "concern": "api-style-guide",
659
+ "status": "accepted",
660
+ "date": "",
661
+ "context": "Other systems and other parts of this system call its API, and every caller pays for each inconsistency in it: a field named in camelCase here and snake_case there, lists paged three ways, errors in four shapes. The forces: without a written guide every team decides these small questions again, and differently; a published guide settles hundreds of them at once and has been argued over in public, but none fits every case and each brings its own conventions with it; rules that only reviewers check drift with reviewer fatigue, while a linter catches naming and structure in seconds and says nothing about design; some deviations are necessary (a legacy API, a partner's format), but an exception without a reason and an end becomes the rule; and the contract may be written before the code or produced from it, while the guide has to hold for the document callers read. HTTP semantics (RFC 9110) are the common ground every guide refines. This pack applies to HTTP/JSON APIs described in OpenAPI; GraphQL and gRPC follow their own conventions.",
662
+ "decision": "The OpenAPI documents are generated from the code (springdoc-openapi on Spring, app.openapi() in FastAPI, @nestjs/swagger, tsoa), written to api/ by npm run openapi:generate or the build's equivalent, and committed. Every pull request regenerates them and fails when the committed copy differs, so each contract change is a diff reviewed beside the code that made it, by {{API_OWNERS}} against {{GUIDE}}. The linter and the callers read the committed documents.",
663
+ "consequences": "• The document cannot drift from the code, and a change needs one pull request.\n• The contract is reviewed after it is built; a design the reviewers reject costs the implementation too.\n• What the document can say is limited by the generator's annotations; some rules of the guide (descriptions, examples, extensions) need annotations of their own.",
664
+ "alternatives": "1. The document written first and merged before the code: agreed earlier, at the cost of two pull requests and a route test.\n2. Generating the document at runtime only, without committing it: no diff to review and nothing for the linter to read before release.",
665
+ "hubWhen": {
666
+ "DESIGN": [
667
+ "code"
668
+ ]
669
+ }
670
+ },
671
+ {
672
+ "id": "ff-guide-declared",
673
+ "type": "fitness-fn",
674
+ "label": "Contracts name their guide",
675
+ "x": 1040,
676
+ "y": 0,
677
+ "characteristic": "maintainability",
678
+ "scope": "atomic",
679
+ "cadence": "triggered",
680
+ "trigger": "pull-request",
681
+ "invocation": "automated",
682
+ "description": "A test reads every OpenAPI document under api/ and checks info.x-api-guide, then that all documents name the same guide.\n\nThreshold: Every document under api/ has info.x-api-guide with a name, an https URL and a revision; 1 distinct guide across all documents\n\nTool: Vitest with the yaml package (or the test runner of your stack)\n\n```ts\n// test/api/guide.test.ts\nimport { readdirSync, readFileSync } from 'node:fs'\nimport { parse } from 'yaml'\nimport { describe, expect, it } from 'vitest'\n\nconst docs = readdirSync('api').filter((f) => f.endsWith('.yaml'))\nconst guideOf = (file: string) => parse(readFileSync(`api/${file}`, 'utf8')).info?.['x-api-guide']\n\ndescribe.each(docs)('%s', (file) => {\n it('names the guide it follows, at a revision', () => {\n const guide = guideOf(file)\n expect(guide, 'info.x-api-guide is missing').toBeTruthy()\n expect(String(guide.name ?? '')).not.toBe('')\n expect(guide.url).toMatch(/^https:\\/\\//)\n expect(String(guide.revision ?? '')).not.toBe('')\n })\n})\n\nit('names the same guide in every document', () => {\n expect(new Set(docs.map((f) => guideOf(f)?.url)).size).toBeLessThanOrEqual(1)\n})\n```"
683
+ },
684
+ {
685
+ "id": "ff-spectral-ci",
686
+ "type": "fitness-fn",
687
+ "label": "Spectral lints every contract change",
688
+ "x": 1040,
689
+ "y": 130,
690
+ "characteristic": "maintainability",
691
+ "scope": "atomic",
692
+ "cadence": "triggered",
693
+ "trigger": "pull-request",
694
+ "invocation": "automated",
695
+ "description": "A workflow runs on every pull request that touches api/ or the ruleset, lints all documents with the ruleset in .spectral.yaml and fails at severity error; the github-actions format puts each finding on its line in the pull request. The job is listed among the checks the main branch requires, in the ruleset the Code review and branching pack keeps.\n\nThreshold: 0 Spectral findings of severity error in the documents under api/ for the pull request to merge; warnings annotated, not blocking\n\nTool: Spectral CLI (@stoplight/spectral-cli) in GitHub Actions\n\n```yaml\n# .github/workflows/api-style.yml\nname: api-style\non:\n pull_request:\n paths: ['api/**', '.spectral.yaml', 'package-lock.json']\njobs:\n lint:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - uses: actions/setup-node@v4.1.0 # pin by commit SHA in your repository\n with:\n node-version: 22\n cache: npm\n - run: npm ci # @stoplight/spectral-cli and the guide's ruleset package, at exact versions\n - run: node api/style/check-ruleset.mjs\n - run: npx spectral lint \"api/*.yaml\" --ruleset .spectral.yaml --fail-severity error --format github-actions\n```",
696
+ "hubWhen": {
697
+ "LINT": [
698
+ "spectral"
699
+ ]
700
+ }
701
+ },
702
+ {
703
+ "id": "ff-ruleset",
704
+ "type": "fitness-fn",
705
+ "label": "Ruleset pinned and every rule sourced",
706
+ "x": 1040,
707
+ "y": 260,
708
+ "characteristic": "maintainability",
709
+ "scope": "atomic",
710
+ "cadence": "triggered",
711
+ "trigger": "pull-request",
712
+ "invocation": "automated",
713
+ "description": "A script run in the API style job reads api/style/ruleset.yaml: every extends entry must be a local file, a Spectral built-in or a package installed at an exact version in package.json, and every rule the file defines (not a mere severity change of an extended rule) must link to its guideline and carry error or warn.\n\nThreshold: 0 extends entries that are URLs or packages without an exact version; 0 rules defined in api/style/ruleset.yaml without an https documentationUrl or with a severity other than error or warn\n\nTool: Node.js with the yaml package\n\n```js\n// api/style/check-ruleset.mjs\nimport { readFileSync } from 'node:fs'\nimport { parse } from 'yaml'\n\nconst ruleset = parse(readFileSync('api/style/ruleset.yaml', 'utf8'))\nconst pkg = JSON.parse(readFileSync('package.json', 'utf8'))\nconst versions = { ...pkg.dependencies, ...pkg.devDependencies }\nconst problems = []\nfor (const entry of [ruleset.extends ?? []].flat()) {\n const ref = Array.isArray(entry) ? entry[0] : entry // [ruleset, 'recommended' | 'all' | 'off']\n if (/^https?:/.test(ref)) { problems.push(`extends ${ref}: a URL changes under you; vendor it or install it at an exact version`); continue }\n if (ref.startsWith('spectral:') || (ref.startsWith('.') && !ref.includes('node_modules/'))) continue\n const name = /^(?:.*node_modules\\/)?((?:@[^/]+\\/)?[^/]+)/.exec(ref)[1]\n if (!/^\\d+\\.\\d+\\.\\d+$/.test(versions[name] ?? '')) problems.push(`${name} is not installed at an exact version`)\n}\nfor (const [name, rule] of Object.entries(ruleset.rules ?? {})) {\n if (typeof rule !== 'object' || rule === null) continue // a severity change of an extended rule\n if (!/^https:\\/\\//.test(rule.documentationUrl ?? '')) problems.push(`${name}: no documentationUrl to the guideline it enforces`)\n if (!['error', 'warn'].includes(rule.severity)) problems.push(`${name}: severity is error (MUST) or warn (SHOULD)`)\n}\nif (problems.length) { console.error(problems.join('\\n')); process.exit(1) }\n```",
714
+ "hubWhen": {
715
+ "LINT": [
716
+ "spectral"
717
+ ]
718
+ }
719
+ },
720
+ {
721
+ "id": "ff-codeowners",
722
+ "type": "fitness-fn",
723
+ "label": "API owners own the contracts",
724
+ "x": 1040,
725
+ "y": 390,
726
+ "characteristic": "maintainability",
727
+ "scope": "atomic",
728
+ "cadence": "triggered",
729
+ "trigger": "pull-request",
730
+ "invocation": "automated",
731
+ "description": "A CI step checks that .github/CODEOWNERS gives /api/ (the documents and the style ruleset) to the API owners, and asks GitHub whether the rules that apply to main require a code owner's review, so the approval cannot be skipped. The branch ruleset itself is kept by the Code review and branching pack; this check only reads it. The step needs a token that can read the repository's rules (GH_TOKEN).\n\nThreshold: CODEOWNERS assigns /api/ to {{API_OWNERS}}, and the rules of the main branch require a code owner's review\n\nTool: bash with the GitHub CLI (REST: GET /repos/{owner}/{repo}/rules/branches/{branch})\n\n```bash\n#!/usr/bin/env bash\n# the API owners own api/, and main requires their approval\nset -euo pipefail\ngrep -Eq '^/api/[[:space:]].*{{API_OWNERS}}' .github/CODEOWNERS \\\n || { echo \"CODEOWNERS: /api/ is not owned by {{API_OWNERS}}\"; exit 1; }\nrequired=$(gh api \"repos/$GITHUB_REPOSITORY/rules/branches/main\" \\\n --jq '[.[] | select(.type == \"pull_request\") | .parameters.require_code_owner_review] | any')\n[ \"$required\" = true ] || { echo \"main does not require a code owner's review\"; exit 1; }\n```"
732
+ },
733
+ {
734
+ "id": "ff-review-checklist",
735
+ "type": "fitness-fn",
736
+ "label": "Style checklist ticked",
737
+ "x": 1040,
738
+ "y": 520,
739
+ "characteristic": "maintainability",
740
+ "scope": "atomic",
741
+ "cadence": "triggered",
742
+ "trigger": "pull-request",
743
+ "invocation": "manual",
744
+ "description": "The pull-request template (.github/pull_request_template.md) carries a section \"## API style checklist\" with one item per MUST rule of the guide that a reviewer checks. A workflow on pull requests that touch api/ reads the description and fails while the section is missing or has an unticked item; it reruns when the description is edited.\n\nThreshold: 0 unticked items in the \"API style checklist\" section of a pull request that changes api/; a missing section fails too\n\nTool: GitHub Actions (bash over the pull request's body)\n\n```yaml\n# .github/workflows/api-review.yml\nname: api-review\non:\n pull_request:\n types: [opened, edited, synchronize, reopened]\n paths: ['api/**']\njobs:\n checklist:\n runs-on: ubuntu-latest\n steps:\n - name: Every item of the API style checklist is ticked\n env:\n BODY: ${{ github.event.pull_request.body }}\n run: |\n section=$(printf '%s\\n' \"$BODY\" | tr -d '\\r' | sed -n '/^## API style checklist/,/^## /p')\n [ -n \"$section\" ] || { echo \"no 'API style checklist' section (see .github/pull_request_template.md)\"; exit 1; }\n if printf '%s\\n' \"$section\" | grep -q '^- \\[ \\]'; then echo \"unticked items in the API style checklist\"; exit 1; fi\n```",
745
+ "hubWhen": {
746
+ "LINT": [
747
+ "review"
748
+ ]
749
+ }
750
+ },
751
+ {
752
+ "id": "ff-design-first-pr",
753
+ "type": "fitness-fn",
754
+ "label": "Contract changes come alone",
755
+ "x": 1040,
756
+ "y": 650,
757
+ "characteristic": "maintainability",
758
+ "scope": "atomic",
759
+ "cadence": "triggered",
760
+ "trigger": "pull-request",
761
+ "invocation": "automated",
762
+ "description": "A CI step on every pull request lists the files changed against the base branch and fails when both a contract document and implementation code are among them.\n\nThreshold: 0 pull requests that change a document under api/ and a file under src/ together\n\nTool: bash and git in the CI job (checkout with fetch-depth: 0)\n\n```bash\n#!/usr/bin/env bash\n# a contract change is merged on its own, before the code that serves it\nset -euo pipefail\nchanged=$(git diff --name-only \"origin/${GITHUB_BASE_REF:-main}...HEAD\")\nif printf '%s\\n' \"$changed\" | grep -q '^api/[^/]*\\.yaml$' && printf '%s\\n' \"$changed\" | grep -q '^src/'; then\n echo \"this pull request changes the contract under api/ and the code under src/ together;\"\n echo \"merge the contract change first, then implement it\"\n exit 1\nfi\n```",
763
+ "hubWhen": {
764
+ "DESIGN": [
765
+ "design"
766
+ ]
767
+ }
768
+ },
769
+ {
770
+ "id": "ff-routes-match",
771
+ "type": "fitness-fn",
772
+ "label": "Server serves the contract",
773
+ "x": 1040,
774
+ "y": 780,
775
+ "characteristic": "compatibility",
776
+ "scope": "atomic",
777
+ "cadence": "triggered",
778
+ "trigger": "pull-request",
779
+ "invocation": "automated",
780
+ "description": "A test lists the operations of every document under api/ and the routes from the router itself (not from a list kept by hand), fails on a route the documents do not describe, and calls each described operation the router does not serve, expecting 501 from the fallback handler.\n\nThreshold: 0 routes in the router's table that the documents do not describe; every described operation not in the table answers 501\n\nTool: Vitest with supertest and the yaml package (or the test runner and HTTP client of your stack)\n\n```ts\n// test/api/routes.test.ts\nimport { readdirSync, readFileSync } from 'node:fs'\nimport { parse } from 'yaml'\nimport request from 'supertest'\nimport { expect, it } from 'vitest'\nimport { app, routes } from '../../src/app' // routes: the router's table, [{ method, path }]\n\nconst METHODS = ['get', 'put', 'post', 'delete', 'patch', 'head', 'options', 'trace']\nconst described = readdirSync('api').filter((f) => f.endsWith('.yaml')).flatMap((file) => {\n const { paths = {} } = parse(readFileSync(`api/${file}`, 'utf8'))\n return Object.entries(paths as Record<string, object>).flatMap(([path, item]) =>\n Object.keys(item).filter((k) => METHODS.includes(k)).map((m) => `${m.toUpperCase()} ${path}`))\n})\nconst served = routes.map((r) => `${r.method.toUpperCase()} ${r.path.replace(/:(\\w+)/g, '{$1}')}`)\n\nit('serves no route the contract does not describe', () => {\n expect(served.filter((r) => !described.includes(r))).toEqual([])\n})\n\nit('answers 501 for each described operation not built yet', async () => {\n for (const op of described.filter((d) => !served.includes(d))) {\n const [method, path] = op.split(' ')\n expect((await request(app)[method.toLowerCase() as 'get'](path.replace(/\\{\\w+\\}/g, 'x'))).status, op).toBe(501)\n }\n})\n```",
781
+ "hubWhen": {
782
+ "DESIGN": [
783
+ "design"
784
+ ]
785
+ }
786
+ },
787
+ {
788
+ "id": "ff-generated-matches",
789
+ "type": "fitness-fn",
790
+ "label": "Committed contract is what the code makes",
791
+ "x": 1040,
792
+ "y": 910,
793
+ "characteristic": "compatibility",
794
+ "scope": "atomic",
795
+ "cadence": "triggered",
796
+ "trigger": "pull-request",
797
+ "invocation": "automated",
798
+ "description": "A workflow on every pull request regenerates the OpenAPI documents from the code and fails when anything under api/ changed or appeared, so a contract change that was not committed cannot merge.\n\nThreshold: 0 differences, new files included, under api/ after regenerating the documents from the code\n\nTool: GitHub Actions with the project's generator (npm run openapi:generate over @nestjs/swagger or tsoa; on Spring, springdoc-openapi-maven-plugin in ./mvnw verify)\n\n```yaml\n# .github/workflows/api-generated.yml\nname: api-generated\non: [pull_request]\njobs:\n contract:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - uses: actions/setup-node@v4.1.0 # pin by commit SHA in your repository\n with:\n node-version: 22\n cache: npm\n - run: npm ci\n - run: npm run openapi:generate # writes api/*.yaml from the code\n - name: The committed contract is what the code produces\n run: |\n git status --porcelain -- api/\n test -z \"$(git status --porcelain -- api/)\" || { echo \"run npm run openapi:generate and commit api/\"; exit 1; }\n```",
799
+ "hubWhen": {
800
+ "DESIGN": [
801
+ "code"
802
+ ]
803
+ }
804
+ },
805
+ {
806
+ "id": "ff-exceptions",
807
+ "type": "fitness-fn",
808
+ "label": "Exceptions complete and current",
809
+ "x": 1040,
810
+ "y": 1040,
811
+ "characteristic": "maintainability",
812
+ "scope": "atomic",
813
+ "cadence": "triggered",
814
+ "trigger": "pull-request",
815
+ "invocation": "automated",
816
+ "description": "A script run in CI walks every document under api/ for x-api-style-exceptions entries, checks each, and writes .spectral.yaml: the style ruleset plus one Spectral override per exception, turning its rule off at that JSON pointer only. CI runs it and then git diff --exit-code .spectral.yaml, so an override added by hand, without its entry, fails. With review only, the overrides are written but nothing lints with them.\n\nThreshold: 0 exceptions without a rule, a reason, an approver and dates; 0 expired; 0 standing more than {{EXCEPTION_MONTHS}} months from approval; 0 differences between the committed .spectral.yaml and the one the exceptions produce\n\nTool: Node.js with the yaml package; Spectral overrides\n\n```js\n// api/style/exceptions.mjs — entries: { rule, reason, approvedBy, approved: 2026-10-01, until: 2027-04-01 }\nimport { readdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { parse, stringify } from 'yaml'\n\nconst MAX_MONTHS = {{EXCEPTION_MONTHS}}\nconst KEY = 'x-api-style-exceptions'\nconst pointer = (parts) => '#/' + parts.map((p) => encodeURIComponent(String(p).replaceAll('~', '~0').replaceAll('/', '~1'))).join('/')\nconst problems = []\nconst overrides = []\nfunction walk(node, parts, file) {\n if (!node || typeof node !== 'object') return\n for (const e of node[KEY] ?? []) {\n const where = file + pointer(parts)\n if (!e.rule || !e.reason || !e.approvedBy) problems.push(`${where}: an exception names its rule, reason and approver`)\n const limit = new Date(e.approved)\n limit.setMonth(limit.getMonth() + MAX_MONTHS)\n if (!(Date.parse(e.until) <= limit.getTime())) problems.push(`${where}: ${e.rule} stands past ${MAX_MONTHS} months from its approval`)\n if (!(Date.parse(e.until) >= Date.now())) problems.push(`${where}: ${e.rule} expired on ${e.until}`)\n overrides.push({ files: [where], rules: { [e.rule]: 'off' } })\n }\n for (const [k, v] of Object.entries(node)) if (k !== KEY) walk(v, [...parts, k], file)\n}\nfor (const f of readdirSync('api').filter((n) => n.endsWith('.yaml'))) walk(parse(readFileSync(`api/${f}`, 'utf8')), [], `api/${f}`)\nwriteFileSync('.spectral.yaml', stringify({ extends: ['./api/style/ruleset.yaml'], ...(overrides.length ? { overrides } : {}) }))\nif (problems.length) { console.error(problems.join('\\n')); process.exit(1) }\n```",
817
+ "hubWhen": {
818
+ "EXCEPTIONS": [
819
+ "inline"
820
+ ]
821
+ }
822
+ },
823
+ {
824
+ "id": "ff-no-exceptions",
825
+ "type": "fitness-fn",
826
+ "label": "No rule turned off for one API",
827
+ "x": 1040,
828
+ "y": 1170,
829
+ "characteristic": "maintainability",
830
+ "scope": "atomic",
831
+ "cadence": "triggered",
832
+ "trigger": "pull-request",
833
+ "invocation": "automated",
834
+ "description": "A CI step searches the documents for inline exceptions and the ruleset files for Spectral overrides, and fails on any; turning a rule off for every API in api/style/ruleset.yaml stays allowed, through a pull request the API owners approve.\n\nThreshold: 0 x-api-style-exceptions or x-zally-ignore keys under api/; 0 overrides sections in .spectral.yaml or api/style/*.yaml\n\nTool: bash and grep in the CI job\n\n```bash\n#!/usr/bin/env bash\n# no rule is turned off for one part of one API\nset -euo pipefail\ninline=$(grep -rnE '\"?(x-api-style-exceptions|x-zally-ignore)\"?[[:space:]]*:' api/ || true)\noverrides=$(grep -lE '^overrides:' .spectral.yaml api/style/*.yaml 2>/dev/null || true)\nif [ -n \"$inline$overrides\" ]; then\n printf '%s\\n' \"$inline\" \"$overrides\" | sed '/^$/d'\n echo \"exceptions are not allowed: change or remove the rule in api/style/ruleset.yaml for every API\"\n exit 1\nfi\n```",
835
+ "hubWhen": {
836
+ "EXCEPTIONS": [
837
+ "none"
838
+ ]
839
+ }
840
+ },
841
+ {
842
+ "id": "ff-own-guide",
843
+ "type": "fitness-fn",
844
+ "label": "Our guide says how each rule is checked",
845
+ "x": 1040,
846
+ "y": 1300,
847
+ "characteristic": "maintainability",
848
+ "scope": "atomic",
849
+ "cadence": "triggered",
850
+ "trigger": "pull-request",
851
+ "invocation": "automated",
852
+ "description": "A test parses api/style/guide.md: the \"Derived from:\" line, each numbered rule with its \"Checked by: review\" or \"Checked by: spectral `rule-name`\" line, and the rule names, which must be defined in api/style/ruleset.yaml or in a local ruleset it extends. With review only, every rule says review and the ruleset may be absent.\n\nThreshold: api/style/guide.md names its base guide with an https link and a revision; every \"### R<n> MUST|SHOULD\" rule is followed by a \"Checked by:\" line; 0 lint rules named that the ruleset does not define\n\nTool: Vitest with the yaml package\n\n```ts\n// test/api/own-guide.test.ts\nimport { existsSync, readFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { parse } from 'yaml'\nimport { expect, it } from 'vitest'\n\nconst guide = readFileSync('api/style/guide.md', 'utf8')\nconst rulesIn = (file: string): string[] => {\n if (!existsSync(file)) return []\n const r = parse(readFileSync(file, 'utf8')) ?? {}\n const local = [r.extends ?? []].flat().map((e) => (Array.isArray(e) ? e[0] : e)).filter((e) => e.startsWith('.'))\n return [...Object.keys(r.rules ?? {}), ...local.flatMap((e) => rulesIn(join(dirname(file), e)))]\n}\nconst lintRules = rulesIn('api/style/ruleset.yaml')\n\nit('names the published guide it derives from, at a revision', () => {\n expect(guide).toMatch(/^Derived from: \\[.+\\]\\(https:\\/\\/[^)]+\\) at revision \\S+/m)\n})\n\nit('says for every rule how it is checked', () => {\n const headings = guide.match(/^### R\\d+ (MUST|SHOULD) /gm) ?? []\n const rules = [...guide.matchAll(/^### R\\d+ (?:MUST|SHOULD) .+\\n+Checked by: (?:review|spectral `([\\w-]+)`)$/gm)]\n expect(rules.length, 'a \"Checked by:\" line after every rule').toBe(headings.length)\n expect(rules.map((r) => r[1]).filter((name) => name && !lintRules.includes(name))).toEqual([])\n})\n```",
853
+ "hubWhen": {
854
+ "GUIDE": [
855
+ "own"
856
+ ]
857
+ }
858
+ }
859
+ ],
860
+ "relations": [
861
+ {
862
+ "id": "req-guide-declared--derives--need",
863
+ "sourceId": "req-guide-declared",
864
+ "targetId": "need",
865
+ "relationType": "derives"
866
+ },
867
+ {
868
+ "id": "req-lint--derives--need",
869
+ "sourceId": "req-lint",
870
+ "targetId": "need",
871
+ "relationType": "derives"
872
+ },
873
+ {
874
+ "id": "req-ruleset-pinned--derives--need",
875
+ "sourceId": "req-ruleset-pinned",
876
+ "targetId": "need",
877
+ "relationType": "derives"
878
+ },
879
+ {
880
+ "id": "req-rule-sources--derives--need",
881
+ "sourceId": "req-rule-sources",
882
+ "targetId": "need",
883
+ "relationType": "derives"
884
+ },
885
+ {
886
+ "id": "req-owners-review--derives--need",
887
+ "sourceId": "req-owners-review",
888
+ "targetId": "need",
889
+ "relationType": "derives"
890
+ },
891
+ {
892
+ "id": "req-review-checklist--derives--need",
893
+ "sourceId": "req-review-checklist",
894
+ "targetId": "need",
895
+ "relationType": "derives"
896
+ },
897
+ {
898
+ "id": "req-design-first--derives--need",
899
+ "sourceId": "req-design-first",
900
+ "targetId": "need",
901
+ "relationType": "derives"
902
+ },
903
+ {
904
+ "id": "req-design-routes--derives--need",
905
+ "sourceId": "req-design-routes",
906
+ "targetId": "need",
907
+ "relationType": "derives"
908
+ },
909
+ {
910
+ "id": "req-code-first--derives--need",
911
+ "sourceId": "req-code-first",
912
+ "targetId": "need",
913
+ "relationType": "derives"
914
+ },
915
+ {
916
+ "id": "req-exception-recorded--derives--need",
917
+ "sourceId": "req-exception-recorded",
918
+ "targetId": "need",
919
+ "relationType": "derives"
920
+ },
921
+ {
922
+ "id": "req-exception-expiry--derives--need",
923
+ "sourceId": "req-exception-expiry",
924
+ "targetId": "need",
925
+ "relationType": "derives"
926
+ },
927
+ {
928
+ "id": "req-no-exceptions--derives--need",
929
+ "sourceId": "req-no-exceptions",
930
+ "targetId": "need",
931
+ "relationType": "derives"
932
+ },
933
+ {
934
+ "id": "req-own-guide--derives--need",
935
+ "sourceId": "req-own-guide",
936
+ "targetId": "need",
937
+ "relationType": "derives"
938
+ },
939
+ {
940
+ "id": "sc-guide-declared--verifies--req-guide-declared",
941
+ "sourceId": "sc-guide-declared",
942
+ "targetId": "req-guide-declared",
943
+ "relationType": "verifies"
944
+ },
945
+ {
946
+ "id": "sc-lint--verifies--req-lint",
947
+ "sourceId": "sc-lint",
948
+ "targetId": "req-lint",
949
+ "relationType": "verifies"
950
+ },
951
+ {
952
+ "id": "sc-ruleset-pinned--verifies--req-ruleset-pinned",
953
+ "sourceId": "sc-ruleset-pinned",
954
+ "targetId": "req-ruleset-pinned",
955
+ "relationType": "verifies"
956
+ },
957
+ {
958
+ "id": "sc-rule-sources--verifies--req-rule-sources",
959
+ "sourceId": "sc-rule-sources",
960
+ "targetId": "req-rule-sources",
961
+ "relationType": "verifies"
962
+ },
963
+ {
964
+ "id": "sc-owners-review--verifies--req-owners-review",
965
+ "sourceId": "sc-owners-review",
966
+ "targetId": "req-owners-review",
967
+ "relationType": "verifies"
968
+ },
969
+ {
970
+ "id": "sc-review-checklist--verifies--req-review-checklist",
971
+ "sourceId": "sc-review-checklist",
972
+ "targetId": "req-review-checklist",
973
+ "relationType": "verifies"
974
+ },
975
+ {
976
+ "id": "sc-design-first--verifies--req-design-first",
977
+ "sourceId": "sc-design-first",
978
+ "targetId": "req-design-first",
979
+ "relationType": "verifies"
980
+ },
981
+ {
982
+ "id": "sc-design-routes--verifies--req-design-routes",
983
+ "sourceId": "sc-design-routes",
984
+ "targetId": "req-design-routes",
985
+ "relationType": "verifies"
986
+ },
987
+ {
988
+ "id": "sc-code-first--verifies--req-code-first",
989
+ "sourceId": "sc-code-first",
990
+ "targetId": "req-code-first",
991
+ "relationType": "verifies"
992
+ },
993
+ {
994
+ "id": "sc-exception-recorded--verifies--req-exception-recorded",
995
+ "sourceId": "sc-exception-recorded",
996
+ "targetId": "req-exception-recorded",
997
+ "relationType": "verifies"
998
+ },
999
+ {
1000
+ "id": "sc-exception-expiry--verifies--req-exception-expiry",
1001
+ "sourceId": "sc-exception-expiry",
1002
+ "targetId": "req-exception-expiry",
1003
+ "relationType": "verifies"
1004
+ },
1005
+ {
1006
+ "id": "sc-no-exceptions--verifies--req-no-exceptions",
1007
+ "sourceId": "sc-no-exceptions",
1008
+ "targetId": "req-no-exceptions",
1009
+ "relationType": "verifies"
1010
+ },
1011
+ {
1012
+ "id": "sc-own-guide--verifies--req-own-guide",
1013
+ "sourceId": "sc-own-guide",
1014
+ "targetId": "req-own-guide",
1015
+ "relationType": "verifies"
1016
+ },
1017
+ {
1018
+ "id": "ff-guide-declared--implements--adr-guide-azure",
1019
+ "sourceId": "ff-guide-declared",
1020
+ "targetId": "adr-guide-azure",
1021
+ "relationType": "implements"
1022
+ },
1023
+ {
1024
+ "id": "ff-guide-declared--implements--adr-guide-zalando",
1025
+ "sourceId": "ff-guide-declared",
1026
+ "targetId": "adr-guide-zalando",
1027
+ "relationType": "implements"
1028
+ },
1029
+ {
1030
+ "id": "ff-guide-declared--implements--adr-guide-google",
1031
+ "sourceId": "ff-guide-declared",
1032
+ "targetId": "adr-guide-google",
1033
+ "relationType": "implements"
1034
+ },
1035
+ {
1036
+ "id": "ff-guide-declared--implements--adr-guide-own",
1037
+ "sourceId": "ff-guide-declared",
1038
+ "targetId": "adr-guide-own",
1039
+ "relationType": "implements"
1040
+ },
1041
+ {
1042
+ "id": "ff-spectral-ci--implements--adr-guide-azure",
1043
+ "sourceId": "ff-spectral-ci",
1044
+ "targetId": "adr-guide-azure",
1045
+ "relationType": "implements"
1046
+ },
1047
+ {
1048
+ "id": "ff-spectral-ci--implements--adr-guide-zalando",
1049
+ "sourceId": "ff-spectral-ci",
1050
+ "targetId": "adr-guide-zalando",
1051
+ "relationType": "implements"
1052
+ },
1053
+ {
1054
+ "id": "ff-spectral-ci--implements--adr-guide-google",
1055
+ "sourceId": "ff-spectral-ci",
1056
+ "targetId": "adr-guide-google",
1057
+ "relationType": "implements"
1058
+ },
1059
+ {
1060
+ "id": "ff-spectral-ci--implements--adr-guide-own",
1061
+ "sourceId": "ff-spectral-ci",
1062
+ "targetId": "adr-guide-own",
1063
+ "relationType": "implements"
1064
+ },
1065
+ {
1066
+ "id": "ff-ruleset--implements--adr-guide-azure",
1067
+ "sourceId": "ff-ruleset",
1068
+ "targetId": "adr-guide-azure",
1069
+ "relationType": "implements"
1070
+ },
1071
+ {
1072
+ "id": "ff-ruleset--implements--adr-guide-zalando",
1073
+ "sourceId": "ff-ruleset",
1074
+ "targetId": "adr-guide-zalando",
1075
+ "relationType": "implements"
1076
+ },
1077
+ {
1078
+ "id": "ff-ruleset--implements--adr-guide-google",
1079
+ "sourceId": "ff-ruleset",
1080
+ "targetId": "adr-guide-google",
1081
+ "relationType": "implements"
1082
+ },
1083
+ {
1084
+ "id": "ff-ruleset--implements--adr-guide-own",
1085
+ "sourceId": "ff-ruleset",
1086
+ "targetId": "adr-guide-own",
1087
+ "relationType": "implements"
1088
+ },
1089
+ {
1090
+ "id": "ff-codeowners--implements--adr-guide-azure",
1091
+ "sourceId": "ff-codeowners",
1092
+ "targetId": "adr-guide-azure",
1093
+ "relationType": "implements"
1094
+ },
1095
+ {
1096
+ "id": "ff-codeowners--implements--adr-guide-zalando",
1097
+ "sourceId": "ff-codeowners",
1098
+ "targetId": "adr-guide-zalando",
1099
+ "relationType": "implements"
1100
+ },
1101
+ {
1102
+ "id": "ff-codeowners--implements--adr-guide-google",
1103
+ "sourceId": "ff-codeowners",
1104
+ "targetId": "adr-guide-google",
1105
+ "relationType": "implements"
1106
+ },
1107
+ {
1108
+ "id": "ff-codeowners--implements--adr-guide-own",
1109
+ "sourceId": "ff-codeowners",
1110
+ "targetId": "adr-guide-own",
1111
+ "relationType": "implements"
1112
+ },
1113
+ {
1114
+ "id": "ff-review-checklist--implements--adr-guide-azure",
1115
+ "sourceId": "ff-review-checklist",
1116
+ "targetId": "adr-guide-azure",
1117
+ "relationType": "implements"
1118
+ },
1119
+ {
1120
+ "id": "ff-review-checklist--implements--adr-guide-zalando",
1121
+ "sourceId": "ff-review-checklist",
1122
+ "targetId": "adr-guide-zalando",
1123
+ "relationType": "implements"
1124
+ },
1125
+ {
1126
+ "id": "ff-review-checklist--implements--adr-guide-google",
1127
+ "sourceId": "ff-review-checklist",
1128
+ "targetId": "adr-guide-google",
1129
+ "relationType": "implements"
1130
+ },
1131
+ {
1132
+ "id": "ff-review-checklist--implements--adr-guide-own",
1133
+ "sourceId": "ff-review-checklist",
1134
+ "targetId": "adr-guide-own",
1135
+ "relationType": "implements"
1136
+ },
1137
+ {
1138
+ "id": "ff-design-first-pr--implements--adr-design-first",
1139
+ "sourceId": "ff-design-first-pr",
1140
+ "targetId": "adr-design-first",
1141
+ "relationType": "implements"
1142
+ },
1143
+ {
1144
+ "id": "ff-routes-match--implements--adr-design-first",
1145
+ "sourceId": "ff-routes-match",
1146
+ "targetId": "adr-design-first",
1147
+ "relationType": "implements"
1148
+ },
1149
+ {
1150
+ "id": "ff-generated-matches--implements--adr-code-first",
1151
+ "sourceId": "ff-generated-matches",
1152
+ "targetId": "adr-code-first",
1153
+ "relationType": "implements"
1154
+ },
1155
+ {
1156
+ "id": "ff-exceptions--implements--adr-guide-azure",
1157
+ "sourceId": "ff-exceptions",
1158
+ "targetId": "adr-guide-azure",
1159
+ "relationType": "implements"
1160
+ },
1161
+ {
1162
+ "id": "ff-exceptions--implements--adr-guide-zalando",
1163
+ "sourceId": "ff-exceptions",
1164
+ "targetId": "adr-guide-zalando",
1165
+ "relationType": "implements"
1166
+ },
1167
+ {
1168
+ "id": "ff-exceptions--implements--adr-guide-google",
1169
+ "sourceId": "ff-exceptions",
1170
+ "targetId": "adr-guide-google",
1171
+ "relationType": "implements"
1172
+ },
1173
+ {
1174
+ "id": "ff-exceptions--implements--adr-guide-own",
1175
+ "sourceId": "ff-exceptions",
1176
+ "targetId": "adr-guide-own",
1177
+ "relationType": "implements"
1178
+ },
1179
+ {
1180
+ "id": "ff-no-exceptions--implements--adr-guide-azure",
1181
+ "sourceId": "ff-no-exceptions",
1182
+ "targetId": "adr-guide-azure",
1183
+ "relationType": "implements"
1184
+ },
1185
+ {
1186
+ "id": "ff-no-exceptions--implements--adr-guide-zalando",
1187
+ "sourceId": "ff-no-exceptions",
1188
+ "targetId": "adr-guide-zalando",
1189
+ "relationType": "implements"
1190
+ },
1191
+ {
1192
+ "id": "ff-no-exceptions--implements--adr-guide-google",
1193
+ "sourceId": "ff-no-exceptions",
1194
+ "targetId": "adr-guide-google",
1195
+ "relationType": "implements"
1196
+ },
1197
+ {
1198
+ "id": "ff-no-exceptions--implements--adr-guide-own",
1199
+ "sourceId": "ff-no-exceptions",
1200
+ "targetId": "adr-guide-own",
1201
+ "relationType": "implements"
1202
+ },
1203
+ {
1204
+ "id": "ff-own-guide--implements--adr-guide-own",
1205
+ "sourceId": "ff-own-guide",
1206
+ "targetId": "adr-guide-own",
1207
+ "relationType": "implements"
1208
+ }
1209
+ ]
1210
+ }