Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: safely parse
Pipfile.lock
(#20825)
- Loading branch information
1 parent
cbbeecb
commit 1567386
Showing
2 changed files
with
50 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { z } from 'zod'; | ||
|
||
const PipfileLockEntrySchema = z | ||
.record( | ||
z.string(), | ||
z.object({ | ||
version: z.string().optional(), | ||
}) | ||
) | ||
.optional(); | ||
export const PipfileLockSchema = z.object({ | ||
_meta: z | ||
.object({ | ||
requires: z | ||
.object({ | ||
python_version: z.string().optional(), | ||
python_full_version: z.string().optional(), | ||
}) | ||
.optional(), | ||
}) | ||
.optional(), | ||
default: PipfileLockEntrySchema, | ||
develop: PipfileLockEntrySchema, | ||
}); |