Skip to content

Commit

Permalink
correct enum type
Browse files Browse the repository at this point in the history
  • Loading branch information
gtarpenning committed Nov 18, 2024
1 parent ac3a466 commit f5e95bb
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const AnnotationScorerFormSchema = z.object({
.describe('Optional maximum length of the string'),
}),
z.object({
type: z.literal('array'),
options: z.array(z.string()).describe('List of options to choose from'),
type: z.literal('enum'),
enum: z.array(z.string()).describe('List of options to choose from'),
}),
]),
});
Expand Down Expand Up @@ -75,14 +75,21 @@ export const onAnnotationScorerSave = async (
data: z.infer<typeof AnnotationScorerFormSchema>,
client: TraceServerClient
) => {
let type = data.Type.type;
if (type === 'enum') {
type = 'string';
}
return createBaseObjectInstance(client, 'AnnotationSpec', {
obj: {
project_id: projectIdFromParts({entity, project}),
object_id: sanitizeObjectId(data.Name),
val: {
name: data.Name,
description: data.Description,
json_schema: data.Type,
json_schema: {
...data.Type,
type,
},
},
},
});
Expand Down

0 comments on commit f5e95bb

Please sign in to comment.