Skip to content

refactor(schemas): rename ProvenanceSchema and FullProvenanceSchema to clarify their contexts #13

@shwetank-dev

Description

@shwetank-dev

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:

  • ProvenanceSchemaPackageProvenanceSchema (web UI / internal API)
  • FullProvenanceSchemaBundleProvenanceSchema (V1 bundle API)

Update all usages:

  • PackageVersionSchema (api-responses.ts:140) — swap to PackageProvenanceSchema
  • BundleSchema (api-responses.ts:201) — swap to BundleProvenanceSchema
  • VersionInfoSchema (api-responses.ts:238) — swap to BundleProvenanceSchema
  • VersionDetailSchema — swap to BundleProvenanceSchema
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions