Skip to content

Commit

Permalink
fix(datasource/docker): allow null in schema values (#24205)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Sep 1, 2023
1 parent 7c4609e commit 223cee1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/modules/datasource/docker/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { Release } from '../types';
*/
export const ManifestObject = z.object({
schemaVersion: z.literal(2),
mediaType: z.string().optional(),
mediaType: z.string().nullish(),
});

/**
Expand All @@ -20,17 +20,17 @@ export const ManifestObject = z.object({
export const Descriptor = z.object({
mediaType: z.string(),
digest: z.string(),
size: z.number().int().gt(0).optional(),
size: z.number().int().gt(0).nullish(),
});
/**
* OCI platform properties
* https://github.com/opencontainers/image-spec/blob/main/image-index.md
*/
const OciPlatform = z
.object({
architecture: z.string().optional(),
architecture: z.string().nullish(),
})
.optional();
.nullish();

/**
* OCI Image Configuration.
Expand All @@ -40,8 +40,8 @@ const OciPlatform = z
*/
export const OciImageConfig = z.object({
// This is required by the spec, but probably not present in the wild.
architecture: z.string().optional(),
config: z.object({ Labels: z.record(z.string()).optional() }).optional(),
architecture: z.string().nullish(),
config: z.object({ Labels: z.record(z.string()).nullish() }).nullish(),
});
export type OciImageConfig = z.infer<typeof OciImageConfig>;

Expand All @@ -52,8 +52,8 @@ export type OciImageConfig = z.infer<typeof OciImageConfig>;
export const OciHelmConfig = z.object({
name: z.string(),
version: z.string(),
home: z.string().optional(),
sources: z.array(z.string()).optional(),
home: z.string().nullish(),
sources: z.array(z.string()).nullish(),
});
export type OciHelmConfig = z.infer<typeof OciHelmConfig>;

Expand All @@ -70,7 +70,7 @@ export const OciImageManifest = ManifestObject.extend({
'application/vnd.cncf.helm.config.v1+json',
]),
}),
annotations: z.record(z.string()).optional(),
annotations: z.record(z.string()).nullish(),
});
export type OciImageManifest = z.infer<typeof OciImageManifest>;

Expand All @@ -90,7 +90,7 @@ export const OciImageIndexManifest = ManifestObject.extend({
platform: OciPlatform,
})
),
annotations: z.record(z.string()).optional(),
annotations: z.record(z.string()).nullish(),
});

// Old Docker manifests
Expand Down

0 comments on commit 223cee1

Please sign in to comment.