-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial SDL implementation * export functions * fix input type definitions * fix missing implementors * remove need for ParseResult * down to 1 failing test * fix kitchen sink by adding possible_interface back, we should verify whether this is a bug as a possible interface is also a possible type * bug found in build_client_schema * validate * more fixes * run clippy * Update src/schema/build_client_schema.rs Co-authored-by: Dominic Petrick <[email protected]> * Update src/schema/build_client_schema.rs Co-authored-by: Dominic Petrick <[email protected]> --------- Co-authored-by: Dominic Petrick <[email protected]>
- Loading branch information
1 parent
9122b54
commit 79440ed
Showing
15 changed files
with
2,251 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use std::{error::Error, fmt::Display}; | ||
|
||
// Todo: Maybe reuse top level GraphQL/Syntax error struct? Would that be suitable? | ||
#[derive(Debug)] | ||
pub enum SchemaError { | ||
SyntaxError(String), | ||
ValidationError(String), | ||
} | ||
|
||
impl Display for SchemaError { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
SchemaError::SyntaxError(s) => write!(f, "{}", s), | ||
SchemaError::ValidationError(s) => write!(f, "Validation error: {}", s), | ||
} | ||
} | ||
} | ||
|
||
impl Error for SchemaError {} | ||
|
||
macro_rules! syntax_err { | ||
($msg:literal, $($arg:tt)*) => { | ||
Err(syntax!($msg, $($arg)*)) | ||
}; | ||
|
||
($msg:literal) => { | ||
Err(syntax!($msg)) | ||
}; | ||
} | ||
|
||
macro_rules! syntax { | ||
($msg:literal, $($arg:tt)*) => { | ||
SchemaError::SyntaxError(format!($msg, $($arg)*)) | ||
}; | ||
|
||
($msg:literal) => { | ||
SchemaError::SyntaxError(format!($msg)) | ||
}; | ||
} | ||
|
||
macro_rules! validation { | ||
($msg:literal, $($arg:tt)*) => { | ||
SchemaError::ValidationError(format!($msg, $($arg)*)) | ||
}; | ||
|
||
($msg:literal) => { | ||
SchemaError::ValidationError(format!($msg)) | ||
}; | ||
} | ||
|
||
// Required for macro visibility. | ||
pub(crate) use syntax; | ||
pub(crate) use syntax_err; | ||
pub(crate) use validation; |
Oops, something went wrong.