Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Settings schema #2167

Merged
merged 1 commit into from
Jan 5, 2025
Merged

Update Settings schema #2167

merged 1 commit into from
Jan 5, 2025

Conversation

christian-byrne
Copy link
Collaborator

@christian-byrne christian-byrne commented Jan 5, 2025

Adds missing fields from core settings to Settings schema.

┆Issue is synchronized with this Notion page by Unito

@christian-byrne christian-byrne requested a review from a team as a code owner January 5, 2025 05:00
@huchenlei
Copy link
Member

BTW is there a way to enforce the schema typing? How were you performing the check?

@huchenlei huchenlei merged commit 6525389 into main Jan 5, 2025
10 checks passed
@huchenlei huchenlei deleted the settings-type branch January 5, 2025 17:56
@christian-byrne
Copy link
Collaborator Author

BTW is there a way to enforce the schema typing? How were you performing the check?

I was just doing it like this in strict mode:

-const zSettings = z.record(z.any()).and(
-  z
-    .object({
+const zSettings =
+  z.object({
@@ -10,7 +9,7 @@
       'Comfy.DevMode': z.boolean(),
       'Comfy.Workflow.ShowMissingNodesWarning': z.boolean(),
       'Comfy.Workflow.ShowMissingModelsWarning': z.boolean(),
       'Comfy.DisableFloatRounding': z.boolean(),
+      ...
@@ -55,6 +54,6 @@
       'LiteGraph.Canvas.MaximumFps': z.number(),
       'Comfy.Workflow.ConfirmDelete': z.boolean()
     })
-    .optional()
 )

@huchenlei
Copy link
Member

Oh yea, enabling ts-strict changes zod schema behaviour. I think the gradual ts strict check does not modify the zod behaviour that is why.

@christian-byrne
Copy link
Collaborator Author

christian-byrne commented Jan 6, 2025

Oh, I see now. I just tried and it also works with "noPropertyAccessFromIndexSignature": true while strict mode is off. It may be better if there's a schema for core settings which can be enforced. And then the schema for settings is the union of that and any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants