-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
There are two provenance schemas in packages/schemas/src/api-responses.ts with misleading names. The name FullProvenanceSchema implies it is a superset of ProvenanceSchema, but they are completely different shapes used in different API contexts.
Current state
ProvenanceSchema (api-responses.ts:67) — used in the web UI API, all fields nullable:
export const ProvenanceSchema = z.object({
publish_method: z.string().nullable(),
repository: z.string().nullable(),
sha: z.string().nullable(),
});FullProvenanceSchema (api-responses.ts:181) — used in the V1 bundle API, all fields required:
export const FullProvenanceSchema = z.object({
schema_version: z.string(),
provider: z.string(),
repository: z.string(),
sha: z.string(),
});They share repository and sha but are otherwise unrelated. Neither extends the other.
Suggested fix
Rename to reflect their actual context:
ProvenanceSchema→PackageProvenanceSchema(web UI / internal API)FullProvenanceSchema→BundleProvenanceSchema(V1 bundle API)
Update all usages:
PackageVersionSchema(api-responses.ts:140) — swap toPackageProvenanceSchemaBundleSchema(api-responses.ts:201) — swap toBundleProvenanceSchemaVersionInfoSchema(api-responses.ts:238) — swap toBundleProvenanceSchemaVersionDetailSchema— swap toBundleProvenanceSchema- Exported TypeScript type aliases at the bottom of the file
Notes
Pure rename refactor — no behaviour change, no breaking change to inferred TypeScript types. Makes it immediately clear which provenance shape belongs to which API layer.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels