feat: add e2e integration tests and canonical versioning

This commit is contained in:
Aarnav Tale
2025-11-16 18:31:09 -05:00
parent 63d1e84ebe
commit 08a251cc8c
16 changed files with 536 additions and 17 deletions
@@ -12,10 +12,6 @@ export interface ApiKeyEndpoints {
export default defineApiEndpoints<ApiKeyEndpoints>((client, apiKey) => ({
getApiKeys: async () => {
if (client.isAtleast('0.27.0')) {
console.log('wow we are at least 0.27.0!');
}
const { apiKeys } = await client.apiFetch<{ apiKeys: Key[] }>(
'GET',
'v1/apikey',
+25 -1
View File
@@ -1,3 +1,4 @@
import canonicals from '~/openapi-canonical-families.json';
import hashes from '~/openapi-operation-hashes.json';
import log from '~/utils/log';
@@ -64,7 +65,30 @@ export function detectApiVersion(
);
}
return bestVersion;
const canonical = Object.entries(canonicals).find(([_, family]) =>
family.includes(bestVersion),
)?.[0] as Version | undefined;
if (!canonical) {
log.warn(
'api',
'Could not canonicalize detected version %s, using as-is',
bestVersion,
);
return bestVersion;
}
if (canonical !== bestVersion) {
log.info(
'api',
'Canonicalizing detected version %s → %s (same schema)',
bestVersion,
canonical,
);
}
return canonical;
}
/**