Skip to content
Snippets Groups Projects
Unverified Commit ec572f88 authored by Johannes Feichtner's avatar Johannes Feichtner Committed by GitHub
Browse files

refactor(manager/pep621): simplify zod schema for parsing pdm.lock (#27717)

parent 1d4972c8
Branches
Tags
No related merge requests found
...@@ -61,14 +61,16 @@ export const PyProjectSchema = z.object({ ...@@ -61,14 +61,16 @@ export const PyProjectSchema = z.object({
export const PdmLockfileSchema = Toml.pipe( export const PdmLockfileSchema = Toml.pipe(
z.object({ z.object({
package: LooseArray( package: LooseArray(
z z.object({
.object({
name: z.string(), name: z.string(),
version: z.string(), version: z.string(),
})
.transform(({ name, version }): [string, string] => [name, version]),
)
.transform((entries) => Object.fromEntries(entries))
.catch({}),
}), }),
).transform(({ package: lock }) => ({ lock })); ),
}),
)
.transform(({ package: pkg }) =>
Object.fromEntries(
pkg.map(({ name, version }): [string, string] => [name, version]),
),
)
.transform((lock) => ({ lock }));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment