Skip to content

Api versions#3

Open
sedkis wants to merge 15 commits intomainfrom
api-versions
Open

Api versions#3
sedkis wants to merge 15 commits intomainfrom
api-versions

Conversation

@sedkis
Copy link
Collaborator

@sedkis sedkis commented Mar 3, 2026

No description provided.

sedkis and others added 15 commits February 19, 2026 14:52
…and ordering - step 01-01

- New `tyk apply -f <path>` command for batch applying API and policy configs
- Recursive directory scanning for .yaml/.yml/.json files
- Classification: API (x-tyk-api-gateway) or policy (id+name+access_rights)
- Policies applied before APIs; alphabetical within each group
- Non-config files (.md, .txt) silently skipped
- Unrecognized parseable files reported as FAILED
- Empty directory returns exit code 2
- Single file mode with auto-detection
- Env var override in initConfig for TYK_DASH_URL/TYK_AUTH_TOKEN/TYK_ORG_ID

Acceptance tests: 7 new (walking skeleton + 6 behavior tests)
Unit tests: 0 (all behavior tested through integration tests)

Step-ID: 01-01
Co-Authored-By: Claude <noreply@anthropic.com>
… handling - step 01-02

- Enable 3 acceptance tests: AllFilesSucceed, PartialFailure, IdempotentRerun
- Fix applyAPI to fail on non-404 GET errors instead of falling through to create
- Progress lines [n/total] and summary already present from step 01-01
- Exit 0 on success, exit 1 on partial failure

Step-ID: 01-02
Co-Authored-By: Claude <noreply@anthropic.com>
- Add --continue-on-error flag (default true); when false, stops on first failure
- Remaining unprocessed files reported as skipped in summary
- HTTP 401 always halts immediately with exit code 3
- Fix policy GET error handling for non-200/non-404 responses

Co-Authored-By: Claude <noreply@anthropic.com>
- Acceptance test: DryRun scenarios (NoMutations, WouldCreateAndWouldUpdate, ParseErrorReported, Summary)
- Unit tests: 0 new (acceptance tests sufficient)
- Add --dry-run flag that performs GET-only existence checks
- Reports "would create" or "would update" per file, no mutating requests
- Summary shows "Dry run complete. 0 changes made."

Step-ID: 02-02

Co-Authored-By: Claude <noreply@anthropic.com>
- Acceptance test: JSON output with --json flag producing valid schema
- Unit tests: 0 new (4 acceptance tests cover all behaviors)
- Refactoring: L1+L2+L3 continuous

Co-Authored-By: Claude <noreply@anthropic.com>
… resolution

Replace pre-fetched API list with lazy lookup callbacks (ByID, ByName, ByListenPath, ByTags) so selectors only fetch what they need. Enables O(1) ID lookups and search-based name/listenPath resolution instead of loading all APIs upfront.

Co-Authored-By: Claude <noreply@anthropic.com>
…n - step 01-02

- Acceptance test: versioning metadata extraction from x-tyk-api-gateway.info.versioning
- Unit tests: 1 table-driven test with 5 cases (full, no-ext, no-versioning, partial, set_default)
- Refactoring: L1+L2+L3 continuous

Step-ID: 01-02
Co-Authored-By: Claude <noreply@anthropic.com>
- versionNotFoundError: exit code 3, lists available versions
- versionConflictError: exit code 4, suggests apply command
- apiNotFoundForVersionError: exit code 3, suggests api list

Test Budget: 3 behaviors x 2 = 6 max, used 3

Step-ID: 01-01
Co-Authored-By: Claude <noreply@anthropic.com>
- Posts OAS doc to /api/apis/oas with base_api_id, new_version_name, set_default query params
- Returns *types.APIResponse on success, passes through dashboard errors
- Unit tests: 2 new (success + error passthrough)

Step-ID: 01-03
Co-Authored-By: Claude <noreply@anthropic.com>
- Acceptance test: versions list with human, JSON, and not-found scenarios
- Unit tests: 3 new (within budget: 3 behaviors x 2 = 6 max)
- Wired NewAPIVersionsCommand() into NewAPICommand()
- Replaced placeholder NewAPIVersionsListCommand() with real implementation
- Calls client.ListOASAPIVersions, displays version table on stderr
- --json outputs structured JSON to stdout with api_id, default, versions
- API not found returns exit code 3 with helpful message

Step-ID: 02-01
Co-Authored-By: Claude <noreply@anthropic.com>
- Acceptance test: switch-default switches version, no-op when already default,
  exit 3 on version not found, JSON structured output
- Unit tests: 6 new (success, no-op, not-found, JSON, JSON no-op, API not found)
- Refactoring: L1+L2+L3 continuous

Step-ID: 02-02
Co-Authored-By: Claude <noreply@anthropic.com>
…le loading - step 02-03

- Acceptance test: create version via OAS file with conflict pre-check
- Unit tests: 4 new (success+hint, set-default, conflict exit-4, JSON output)
- Refactoring: L1+L2+L3 continuous

Step-ID: 02-03
Co-Authored-By: Claude <noreply@anthropic.com>
- classifyContent detects versioning metadata, returns configFileAPIVersion
- sortFiles orders: policies first, base APIs second, version files third
- applyVersionFileWithOp sends POST with base_api_id/new_version_name params
- dryRunFile reports "would create version" for version files
- JSON output includes version_name field for version operations

Acceptance test: version file classification, sorting, dry-run, JSON output
Unit tests: 4 new (integration)
Refactoring: L1+L2+L3 continuous

Step-ID: 03-01
Co-Authored-By: Claude <noreply@anthropic.com>
Architecture design, user stories, acceptance criteria, journey maps,
and execution tracking for the OAS versioning feature.

Co-Authored-By: Claude <noreply@anthropic.com>
Replace 14 process artifacts (journey maps, acceptance criteria, roadmaps,
execution logs) with two focused documents: a user guide matching the
manage-policies pattern, and a design doc with ADRs and data flows.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant