Skip to content

chore(mockapi): update OpenAPI spec - #312

Merged
pjcdawkins merged 3 commits into
mainfrom
chore/update-openapi-spec
Nov 13, 2026
Merged

pjcdawkins merged 3 commits into
mainfrom
chore/update-openapi-spec

Conversation

@pjcdawkins

Copy link
Copy Markdown
Contributor

Refreshes pkg/mockapi/openapi.json (make update-openapi-spec), which fixes the lint-upstream job, and adapts the mock API's validation:

  • Integration and route schemas now have a type discriminator, so the patches restricting their type enums are removed. IntegrationPatch has its discriminator removed, as an update can leave out the type.
  • The Accounts API's /ssh_keys routes are no longer in the spec, so they are listed in notInSpec. The Auth API's SSH key routes and the logs query are now in the spec, so they are validated.
  • The spec's Task schema only has the task builders, not the task's own properties, so it is replaced with an object.
  • environment_init_resources is now a mapping per environment type. The API still accepts a string (which sets development), and the CLI still sends one, so the mock accepts both. Updating the CLI will be a separate PR.
  • The logs query mock returned "data": null for an empty page.

🤖 Generated with Claude Code

pjcdawkins and others added 2 commits November 12, 2026 07:44
Refresh pkg/mockapi/openapi.json from the published spec, and adapt the
mock API's validation:

- Integration and route schemas now have a type discriminator, so the
  patches restricting their type enums are removed. The discriminator is
  removed from IntegrationPatch, as an update can leave out the type.
- The Accounts API's /ssh_keys routes left the spec, so they are listed
  in notInSpec; the Auth API's SSH key routes and the logs query are now
  in the spec, so they are validated.
- The spec's Task schema is a copy of the deployment's task builders, so
  it is replaced with an object.
- The log query mock returned "data": null for an empty page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The spec has environment_init_resources as a mapping per environment
type. The API still accepts a string, which sets "development", and the
CLI still sends one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@upsun-dispatch upsun-dispatch Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Changes suggested — 🟡 2 warnings

🔍 Full review · 3 files reviewed

Verification
  • Every schema that has environment_init_resources is a top-level component, so the range schemas loop in patchSpec reaches the Create, Patch and response variants alike.
  • The integration discriminator mappings in the refreshed spec make the removed integrationTypes enum patch redundant for oneOf matching; IntegrationPatch drops its discriminator together with the oneOf→anyOf change.
  • The /users/*/ssh-keys mock responses (authSSHKey: id, label, value, sha256, active, user_id) only use properties that the new SSHKey schema defines.
  • mockLogsQuery now returns data: [] instead of null, matching the spec's array type, and each logLine field is a defined data item property.

There are no new tests. The change runs through the existing integration tests (environment_log_test.go, the SSH key and integration tests), which validate requests and responses against the refreshed spec via validateOpenAPI. The non-blocking lint-upstream CI job checks that the spec is up to date.

Review details
  • Commit: afde23e
  • Model: claude-opus-5-5

Review 1 of 10 for this pull request · View the full run

Comment thread pkg/mockapi/openapi.go Resolved
Comment thread pkg/mockapi/openapi.json Resolved
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

CLI builds

Built from ad51625 (merged into the base branch). Downloads need a GitHub login, and expire after 7 days.

Platform Download
linux-amd64 cli-linux-amd64
linux-arm64 cli-linux-arm64
darwin-amd64 cli-darwin-amd64
darwin-arm64 cli-darwin-arm64
windows-amd64 cli-windows-amd64

Or download one with the GitHub CLI, e.g.:

gh run download 43211157984 -R upsun/cli -n cli-linux-amd64
chmod +x upsun
./upsun --version

On macOS, if you downloaded it with a browser, remove the quarantine attribute before running it: xattr -d com.apple.quarantine upsun.

- The legacy string for environment_init_resources keeps its enum, so
  invalid values are still caught.
- The spec names the logs query's sort parameter "order", but the API
  reads "order_by" (as the CLI sends), so the spec is patched and the
  parameter is validated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pjcdawkins
pjcdawkins merged commit 52bc700 into main Nov 13, 2026
13 checks passed
@pjcdawkins
pjcdawkins deleted the chore/update-openapi-spec branch November 13, 2026 13:35
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