Repository navigation
feat: name enum query parameter types - #108
Merged
Merged
Conversation
Generate a type for each enum-valued query parameter, named <Operation>Query<Parameter>, e.g. ListOrganizationTraceItemAttributesQueryDataset. Array parameters name their element type. These enums are inlined in each <Operation>Data type, so consumers had to derive them with NonNullable<...['query']>[...]. Co-Authored-By: BYK <burak.kaya@sentry.io>
sentry-junior
Bot
requested review from
BYK,
MathurAditya724 and
betegon
as code owners
October 23, 2026 21:33
BYK
requested changes
Oct 23, 2026
Read operations and their Data types from the sdk.gen.ts and types.gen.ts ASTs instead of matching source text with regexes, like generate-client.mjs and constrain-throw-options.mjs do. Fail the build when an operation has an unexpected shape or a spec enum parameter is missing from its Data['query'] type, instead of skipping it silently.
BYK
approved these changes
Oct 23, 2026
2 tasks done
BYK
added a commit
to getsentry/toolkit
that referenced
this pull request
Oct 23, 2026
Upgrades the CLI's `@sentry/api` dependency from `^0.356.0` to `^0.399.0`, the release that includes getsentry/sentry-api-schema#108. That release exports a named type for every enum-valued query parameter, such as `ListOrganizationTraceItemAttributesQueryDataset`, so callers no longer need to derive them with `NonNullable<…["query"]>`. #1559 will switch its trace-item attribute types to these once this lands. The lockfile change only covers `@sentry/api`. `pnpm-workspace.yaml` moves the `minimumReleaseAgeExclude` entry to the new version, because 0.399.0 was published today. Two schema changes between 0.356.0 and 0.399.0 broke existing tests. Both changes match Sentry's current behavior, so the tests were updated rather than the code: - **Sentry App components:** the organization endpoint now returns a required `installationUuid` (getsentry/sentry#127591). The CLI validates this response against the schema, so the `issue-app-links` test fixture now includes the field; without it, all 37 issue-link tests failed. The org endpoint always passes `installation_uuids` to the serializer, so live responses always include the field. Self-hosted servers older than that change will fail this validation. - **Replay fields:** the replay index now accepts every replay response field, including `replay_type`, because the field list comes from `ReplayDetailsResponse` (getsentry/sentry#128518). The two tests that expected `replay_type` to be rejected now check a field that isn't in the schema, `device.model_id`. Verification: typecheck and lint pass. CLI tests: 11,295 passed and 6 failed. The 6 failures are permission tests that also fail on a clean `main` in my sandbox (completions, code-scanner, file-changes, telemetry, upgrade). <!-- junior-request-attribution:start --> via **BYK**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:local%3Aweb%3A7fba2603229556152deec3d2 --> -- [View Junior Session in Sentry](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A7fba2603229556152deec3d2/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <burak.kaya@sentry.io>
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.
Each enum-valued query parameter now gets a named type for one of its values, called
<Operation>Query<Parameter>. For array parameters, it's the element type:The spec is dereferenced, so the generator inlines these enums in each operation's
<Operation>Datatype. Consumers currently have to dig them out by hand. getsentry/toolkit#1559 does exactly that:With these types, consumers import the name instead and no longer redeclare the shape themselves.
How it works
scripts/generate-query-enum-types.mjsruns aftergenerate-error-results.mjs. It maps eachsdk.gen.tsoperation to its route the same way that script does, and writessrc/query-enums.gen.ts.<Operation>Datatype rather than copying the enum values, so it can't drift from what the operation accepts.export type * from './query-enums.gen.ts'. It's type-only, so the bundle doesn't change.types.gen.tsexport or with another alias. TheQueryinfix keeps the names clear of the generator'sData,Error(s)andResponse(s)suffixes.The current spec produces 64 aliases across 36 operations.
test/typecheck.tschecks a valid and an invalid dataset, and that the array parameter's alias is the element type. The README gains a short "Query parameter types" section.Ran
bun run build,bun run typecheck,bun test(163 pass) andbun run test:node.via BYK.
--
View Junior Session in Sentry