Making All Fields Optional Except One in a Schema

            Schema.standardSchemaV1(
                Schema.Struct({
                    ...Object.fromEntries(
                        Object.entries(Chat.update.fields).map(([key, schema]) => [
                            key,
                            Schema.optional(schema as Schema.Any),
                        ]),
                    ),
                    id: recordId("chat"),
                }),
            ),


is there cleaner way of doing this?
I wanna make every field optional except one ?
Was this page helpful?