Skip to content

Commit

Permalink
chore(graphQL): enable codeQuery validation and return error message (#…
Browse files Browse the repository at this point in the history
…3518)

Signed-off-by: Wei Zhang <[email protected]>
  • Loading branch information
zwpaper authored Dec 6, 2024
1 parent 4e9c151 commit 0fed122
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
17 changes: 4 additions & 13 deletions ee/tabby-schema/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1318,19 +1318,10 @@ fn from_validation_errors<S: ScalarValue>(error: ValidationErrors) -> FieldError

error.errors().iter().for_each(|(field, kind)| match kind {
validator::ValidationErrorsKind::Struct(e) => {
for (_, error) in e.0.iter() {
if let validator::ValidationErrorsKind::Field(field_errors) = error {
for error in field_errors {
let mut obj = Object::with_capacity(2);
obj.add_field("path", Value::scalar(field.to_string()));
obj.add_field(
"message",
Value::scalar(error.message.clone().unwrap_or_default().to_string()),
);
errors.push(obj.into());
}
}
}
let mut obj = Object::with_capacity(2);
obj.add_field("path", field.to_string().into());
obj.add_field("message", Value::scalar(e.to_string()));
errors.push(obj.into());
}
validator::ValidationErrorsKind::List(_) => {
warn!("List errors are not handled");
Expand Down
1 change: 1 addition & 0 deletions ee/tabby-schema/src/schema/thread/inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub struct CreateThreadAndRunInput {
#[validate(nested)]
pub thread: CreateThreadInput,

#[validate(nested)]
#[graphql(default)]
pub options: ThreadRunOptionsInput,
}
Expand Down

0 comments on commit 0fed122

Please sign in to comment.