Skip to content

Commit

Permalink
feat: validate extra keys not allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
ebubae committed Nov 1, 2024
1 parent 1798a50 commit 335a7c4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/controllers/translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ interface IgboEnglishTranslationMetadata {
igbo: string;
}

const TranslationRequestBody = z.object({
text: z.string(),
sourceLanguageCode: z.nativeEnum(LanguageEnum),
destinationLanguageCode: z.nativeEnum(LanguageEnum),
});
const TranslationRequestBody = z
.object({
text: z.string(),
sourceLanguageCode: z.nativeEnum(LanguageEnum),
destinationLanguageCode: z.nativeEnum(LanguageEnum),
})
.strict();

interface Translation {
translation: string;
Expand Down

0 comments on commit 335a7c4

Please sign in to comment.