From 9c000a85611799307c48612f25587b3fdbca504c Mon Sep 17 00:00:00 2001 From: Samuel <39674930+samgj18@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:40:09 +0100 Subject: [PATCH] chore: adding annotation to shorten error message (#96) --- integrationos-domain/src/domain/schema/common_model.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/integrationos-domain/src/domain/schema/common_model.rs b/integrationos-domain/src/domain/schema/common_model.rs index f54d8b4f..fb4f3fe1 100644 --- a/integrationos-domain/src/domain/schema/common_model.rs +++ b/integrationos-domain/src/domain/schema/common_model.rs @@ -667,10 +667,10 @@ impl CommonModel { ) } - /// Generates a zod schema for the model in TypeScript + /// Generates an effect schema for the model in TypeScript fn as_typescript_schema(&self) -> String { format!( - "export const {} = Schema.Struct({{ {} }});\n", + "export const {} = Schema.Struct({{ {} }}).annotations({{ title: '{}' }});\n", replace_reserved_keyword(&self.name, Lang::TypeScript) .replace("::", "") .pascal_case(), @@ -680,7 +680,8 @@ impl CommonModel { .collect::>() .into_iter() .collect::>() - .join(",\n ") + .join(",\n "), + self.name ) }