[TT-17515] Rename Tyk Classic hard_timeouts duration wire field#8335
Conversation
Rename the granular enforced-timeout field on the Tyk Classic API definition from `timeout_duration` to `duration`, so it matches the OAS field name (`enforceTimeout.duration`). This is a minimal wire-tag rename only: the Go field name (HardTimeoutMeta.TimeoutDuration) is unchanged, so the enforcement path and the negative-value validator are untouched. The pre-release `timeout_duration` name was never released, so there is no migration. Per product decision, Classic does NOT round up and fill the legacy whole-second `timeout` field from `duration` (a deliberate omission, documented as a limitation); users wanting forward compatibility on older gateways set `timeout` explicitly or migrate to Tyk OAS. - apidef/api_definitions.go: HardTimeoutMeta.TimeoutDuration json/bson tag timeout_duration -> duration - apidef/schema.json: hard_timeouts item property renamed - apidef/oas/middleware.go: update doc-comment reference - apidef/api_definitions_test.go: add TestHardTimeoutMeta_DurationWireTag
|
SentinelOne CNS Hardcoded Secret Detector SentinelOne CNS is a cloud-agnostic, agentless CSPM & CWPP solution that continuously detects and prevents vulnerabilities that have the highest probability of being exploited in Azure, AWS, Google Cloud, and Kubernetes. |
🚨 Jira Linter FailedCommit: The Jira linter failed to validate your PR. Please check the error details below: 🔍 Click to view error detailsNext Steps
This comment will be automatically deleted once the linter passes. |
🎯 Recommended Merge TargetsBased on JIRA ticket TT-17515: Granular Endpoint Enforced Timeout for Tyk Classic API Fix Version: Tyk 5.14.0
Required:
📋 Workflow
|
|
This pull request renames the Files Changed AnalysisThe changes are confined to four files:
The changes are minimal and consistent, with a net addition of 36 lines, primarily for the new test case. Architecture & Impact Assessment
graph TD
subgraph id1[API Definition Layer]
A[Classic API Definition JSON] -- Contains --> B(hard_timeouts);
B -- "Field renamed" --> B_New["hard_timeouts with 'duration' field"];
end
subgraph id2[Go Structs]
C[apidef.HardTimeoutMeta] --|`json:"duration"`|--> B_New;
end
subgraph id3["Gateway Logic (Unaffected)"]
D[Reverse Proxy] -- Uses --> C;
E[Validator] -- Uses --> C;
end
A -- "Parsed into" --> C;
style B fill:#ffcccc
style B_New fill:#ccffcc
Scope Discovery & Context ExpansionThe scope of this change is narrow and well-defined, limited to the wire format of the Tyk Classic API definition. The author correctly notes that since the Go field A search for usages of Metadata
Powered by Visor from Probelabs Last updated: 2026-06-19T12:05:39.700Z | Triggered by: pr_opened | Commit: b34fe59 💡 TIP: You can chat with Visor using |
✅ Security Check PassedNo security issues found – changes LGTM. ✅ Architecture Check PassedNo architecture issues found – changes LGTM. ✅ Security Check PassedNo security issues found – changes LGTM. \n\n✅ Architecture Check PassedNo architecture issues found – changes LGTM. \n\n✅ Performance Check PassedNo performance issues found – changes LGTM. Powered by Visor from Probelabs Last updated: 2026-06-19T12:05:19.260Z | Triggered by: pr_opened | Commit: b34fe59 💡 TIP: You can chat with Visor using |
|
|
Isn't it backward incompatible change which breaks legacy API definitions which had this field before? |
@buger not really, as the old naming wasn't released yet, it's only present in |
|
/release to release-5.14.0 |
|
/release to release-5.14 |
|
|
|
|



Summary
Renames the granular enforced-timeout field on the Tyk Classic API definition from
timeout_durationtoduration, so it matches the Tyk OAS field name (enforceTimeout.duration). Closes the Classic half of thedurationrename agreed during TT-12339 (OAS was done in #8278).Ticket: TT-17515 (parent TT-12339).
What changed
Minimal wire-tag rename only — the Go field name
HardTimeoutMeta.TimeoutDurationis unchanged, so the enforcement path (gateway/reverse_proxy.go) and the negative-value validator (apidef/validator.go) are untouched.apidef/api_definitions.go—HardTimeoutMeta.TimeoutDurationjson/bson tagtimeout_duration→durationapidef/schema.json—hard_timeouts[]item property renamed (format pattern preserved)apidef/oas/middleware.go— doc-comment reference updatedapidef/api_definitions_test.go— newTestHardTimeoutMeta_DurationWireTag(marshal/unmarshal/omitempty)Out of scope (by product decision)
durationis not folded into the legacy whole-secondtimeoutfield. This was a deliberate omission (agreed with product) — a Classic API created with onlydurationhas no enforced timeout on an older Gateway unlesstimeoutis also set. This is an accepted, documented limitation; users wanting sub-second precision are steered to Tyk OAS.0/0msremain valid (no timeout).Compatibility
timeoutfield is untouched; existing APIs keep working on upgrade and downgrade.timeout_durationname was never released, so there is nothing to migrate — any definition still carrying that key would deserialize the granular value as zero. This rename is safe on that premise.Testing
go test ./apidef/ -run 'TestSchema$|HardTimeoutMeta_DurationWireTag' -count=1✅ (incl. struct-vs-embedded-schema validation)go test ./gateway/ -run TestTimeoutPrioritization -count=1✅ (sub-second + legacy enforcement)Downstream
Dashboard support is in tyk-analytics-ui (Classic designer note) + a
tykdependency bump in tyk-analytics that lands after this merges.