Repository navigation
chore(mockapi): update OpenAPI spec - #312
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
Warning
Changes suggested — 🟡 2 warnings
🔍 Full review · 3 files reviewed
Verification
- Every schema that has
environment_init_resourcesis a top-level component, so therange schemasloop inpatchSpecreaches the Create, Patch and response variants alike. - The integration discriminator mappings in the refreshed spec make the removed
integrationTypesenum patch redundant for oneOf matching; IntegrationPatch drops its discriminator together with the oneOf→anyOf change. - The
/users/*/ssh-keysmock responses (authSSHKey: id, label, value, sha256, active, user_id) only use properties that the newSSHKeyschema defines. mockLogsQuerynow returnsdata: []instead of null, matching the spec's array type, and eachlogLinefield is a defineddataitem 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
CLI buildsBuilt from ad51625 (merged into the base branch). Downloads need a GitHub login, and expire after 7 days.
Or download one with the GitHub CLI, e.g.: gh run download 43211157984 -R upsun/cli -n cli-linux-amd64
chmod +x upsun
./upsun --versionOn macOS, if you downloaded it with a browser, remove the quarantine attribute before running it: |
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refreshes
pkg/mockapi/openapi.json(make update-openapi-spec), which fixes thelint-upstreamjob, and adapts the mock API's validation:typediscriminator, so the patches restricting their type enums are removed.IntegrationPatchhas its discriminator removed, as an update can leave out the type./ssh_keysroutes are no longer in the spec, so they are listed innotInSpec. The Auth API's SSH key routes and the logs query are now in the spec, so they are validated.Taskschema only has the task builders, not the task's own properties, so it is replaced with an object.environment_init_resourcesis now a mapping per environment type. The API still accepts a string (which setsdevelopment), and the CLI still sends one, so the mock accepts both. Updating the CLI will be a separate PR."data": nullfor an empty page.🤖 Generated with Claude Code