From ea09532ff2faad7c70acb010eeb23b3ecb791c39 Mon Sep 17 00:00:00 2001
From: Mathieu Kniewallner <mathieu.kniewallner@gmail.com>
Date: Mon, 9 Sep 2024 15:34:49 +0200
Subject: [PATCH] refactor(manager/pep621): extract custom managers (#31280)

---
 lib/modules/manager/pep621/schema.ts | 68 ++++++++++++++--------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/lib/modules/manager/pep621/schema.ts b/lib/modules/manager/pep621/schema.ts
index f63791335f..4fc2b80a7d 100644
--- a/lib/modules/manager/pep621/schema.ts
+++ b/lib/modules/manager/pep621/schema.ts
@@ -8,6 +8,37 @@ const DependencyRecordSchema = z
   .record(z.string(), z.array(z.string()))
   .optional();
 
+const PdmSchema = z.object({
+  'dev-dependencies': DependencyRecordSchema,
+  source: z
+    .array(
+      z.object({
+        url: z.string(),
+        name: z.string(),
+        verify_ssl: z.boolean().optional(),
+      }),
+    )
+    .optional(),
+});
+
+const HatchSchema = z.object({
+  envs: z
+    .record(
+      z.string(),
+      z
+        .object({
+          dependencies: DependencyListSchema,
+          'extra-dependencies': DependencyListSchema,
+        })
+        .optional(),
+    )
+    .optional(),
+});
+
+const UvSchema = z.object({
+  'dev-dependencies': DependencyListSchema,
+});
+
 export const PyProjectSchema = z.object({
   project: z
     .object({
@@ -25,40 +56,9 @@ export const PyProjectSchema = z.object({
     .optional(),
   tool: z
     .object({
-      pdm: z
-        .object({
-          'dev-dependencies': DependencyRecordSchema,
-          source: z
-            .array(
-              z.object({
-                url: z.string(),
-                name: z.string(),
-                verify_ssl: z.boolean().optional(),
-              }),
-            )
-            .optional(),
-        })
-        .optional(),
-      hatch: z
-        .object({
-          envs: z
-            .record(
-              z.string(),
-              z
-                .object({
-                  dependencies: DependencyListSchema,
-                  'extra-dependencies': DependencyListSchema,
-                })
-                .optional(),
-            )
-            .optional(),
-        })
-        .optional(),
-      uv: z
-        .object({
-          'dev-dependencies': DependencyListSchema,
-        })
-        .optional(),
+      pdm: PdmSchema.optional(),
+      hatch: HatchSchema.optional(),
+      uv: UvSchema.optional(),
     })
     .optional(),
 });
-- 
GitLab