Skip to content

Clean up summary API usage #1287

@kmcginnes

Description

@kmcginnes

While investigating a user's schema sync issue I noticed some code that could use some cleaning up.

  • Calls with mode=detailed but doesn't use extra fields
  • Does not validate response structure
  • Performs unchecked property access on response

async function fetchSummary(
connection: NormalizedConnection,
featureFlags: FeatureFlags,
options?: RequestInit
) {
try {
const response = await fetchDatabaseRequest(
connection,
featureFlags,
`${connection.url}/pg/statistics/summary?mode=detailed`,
{
method: "GET",
...options,
}
);
return response.payload.graphSummary as GraphSummary;
} catch (error) {
logger.error(
"[Gremlin Explorer] Failed to gather summary statistics",
error
);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    reliabilityIssues relating to improvements in reliabilityschemaIssues related to the schema definition or synchronization

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions