Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
74c333a to
c500f15
Compare
c500f15 to
b1bb28d
Compare
| const matches = searchEndpoints(query, undefined, references); | ||
| if (matches.length > 0) { | ||
| return { kind: "endpoints", endpoints: matches }; | ||
| } |
There was a problem hiding this comment.
Method-prefixed exact IDs return an array instead of one endpoint object
sentry schema GET listOrganizationEvents (and similar METHOD + operationId/fn lookups) resolves as kind: "endpoints", so --json emits a one-element array instead of the bare endpoint object exact lookups are documented to keep.
Evidence
resolveIdentifierLookup(query)matches the raw string only, soGET listOrganizationEventsnever hits the single-endpoint branch.searchEndpoints()strips the method, exact-matcheslistOrganizationEvents, and returns a plain one-element list with nomatchmetadata.resolveResourceQuery()then always wraps anysearchEndpoints()hit as{ kind: "endpoints" }, including that single exact result.- Path and bare-identifier exact paths still return
{ kind: "endpoint" }; tests cover those shapes but not METHOD + operationId.
Identified by Warden · code-review · Y6V-GWQ
There was a problem hiding this comment.
Fix attempt detected (commit 4f38e78)
The resolver was rewritten to improve schema lookup and preserve exact endpoint results, but METHOD-prefixed operation IDs still fall through to searchEndpoints and are returned as a one-element endpoints array.
The original issue appears unresolved. Please review and try again.
Evaluated by Warden
b1bb28d to
4f38e78
Compare
BYK
left a comment
There was a problem hiding this comment.
This is pretty great! Pushing back for even more automation to prevent drift.
There was a problem hiding this comment.
I think all this should be part of the @sentry/api module.
|
|
||
| export const viewCommand = buildCommand({ | ||
| docs: { | ||
| relatedApi: [TRACE_DETAILS_API], |
There was a problem hiding this comment.
Instead of manually indicating these, we should be able to use the same mechanism we use to determine destructive commands with actual code inspection and generate this data on the fly at/before build time which would be easier to maintain.
| * sentry schema --search <query> → search endpoints by keyword | ||
| * sentry schema <resource> → show endpoints for a resource | ||
| * sentry schema <resource> <op> → show detailed endpoint info | ||
| * sentry schema <concept> → discover related API endpoints |
There was a problem hiding this comment.
We should move all these examples to the command's examples section.
| !(operation || query.includes(" ")) && | ||
| (resource.includes("*") || resource.includes("?")) | ||
| ) { | ||
| return resolveGlobQuery(resource); |
There was a problem hiding this comment.
We should use fuzzy-match and our shared search utility functions here too.
| const METRIC_DETECTOR_QUERY = `type:${METRIC_DETECTOR_TYPE}`; | ||
|
|
||
| /** API references shared by metric alert commands; detectors also serve other products. */ | ||
| export const METRIC_ALERT_API = { |
There was a problem hiding this comment.
These also should come from @sentry/api? And definitely auto-generated.
| if (startMatch) { | ||
| return startMatch; | ||
| /** Conservative English plurals for discovery only, never endpoint identity. */ | ||
| function normalizeWord(word: string): string { |
sentry schemanow discovers API capabilities from OpenAPI metadata and real CLI command paths, includinglog,trace, andalert metrics. Ambiguous queries return candidates with context instead of silently choosing the first endpoint; exact lookups keep their JSON shape.Reuses command introspection and schema generation, with tests for API/CLI growth and compatibility.
Examples:
Validation: typecheck, lint, and schema tests pass. The full local suite is not green: an unchanged installer test fails on macOS, and asset-catalog tests require the unavailable
actool.