pub enum SchemaError {
Show 13 variants
NotJson(String),
NotAnObject {
at: String,
kind: &'static str,
},
UnsupportedKeyword {
keyword: String,
at: String,
why: &'static str,
},
UnsupportedPattern {
pattern: String,
why: String,
},
UnsupportedFormat {
format: String,
at: String,
},
UnknownType {
at: String,
found: String,
},
UnsupportedRef {
reference: String,
},
RefNotFound {
reference: String,
token: String,
},
RefCollision {
pointer: String,
},
BadValue {
keyword: String,
at: String,
why: String,
},
RootDisplaced {
got: String,
},
Emitted(GrammarError),
Internal(&'static str),
}Expand description
What the JSON-schema converter refused, and why.
Variants§
NotJson(String)
The schema text was not valid JSON.
NotAnObject
A schema, or a subschema, was not a JSON object. JSON Schema’s
boolean form (true / false as a whole schema) is not ported.
UnsupportedKeyword
A keyword is present that the chosen branch does not act on. Ignoring it would widen the grammar past what the schema allows.
UnsupportedPattern
A pattern this port cannot compile to GBNF. llama.cpp’s
_visit_pattern handles a subset of ECMA-262; the cases named here
are the ones it mishandles rather than the ones it skips.
UnsupportedFormat
"format" names something outside the six llama.cpp special-cases
(date, time, date-time, uuid, uuid1..uuid5).
UnknownType
"type" is not a string, or names no JSON type.
UnsupportedRef
A $ref this port will not follow: a remote URL, or anything that
is not a #/-rooted JSON pointer into the same document.
RefNotFound
A #/-rooted $ref whose pointer does not land on anything.
RefCollision
Two schemas compiled into ONE grammar (super::GrammarBuilder)
spell the same $ref pointer and mean different subschemas. The
rule name is derived from the pointer, so honouring the first
would compile the second against the wrong definition.
BadValue
A keyword’s value has the wrong JSON type for what it means.
RootDisplaced
The top-level schema did not end up owning the rule named root,
so the grammar’s entry point would be some subschema’s rule. This
is reachable upstream (a property named "" takes root first)
and silently produces a grammar for the wrong document.
Emitted(GrammarError)
The converter emitted a grammar the engine in this repo cannot parse. That is a bug in this module, never in the caller’s schema.
Internal(&'static str)
An invariant of this module was violated – a builtin table lookup that cannot fail did. A bug here, not in the caller’s schema.
Trait Implementations§
Source§impl Clone for SchemaError
impl Clone for SchemaError
Source§fn clone(&self) -> SchemaError
fn clone(&self) -> SchemaError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SchemaError
impl Debug for SchemaError
Source§impl Display for SchemaError
impl Display for SchemaError
impl Eq for SchemaError
Source§impl Error for SchemaError
impl Error for SchemaError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<GrammarError> for SchemaError
impl From<GrammarError> for SchemaError
Source§fn from(e: GrammarError) -> Self
fn from(e: GrammarError) -> Self
Source§impl PartialEq for SchemaError
impl PartialEq for SchemaError
impl StructuralPartialEq for SchemaError
Auto Trait Implementations§
impl Freeze for SchemaError
impl RefUnwindSafe for SchemaError
impl Send for SchemaError
impl Sync for SchemaError
impl Unpin for SchemaError
impl UnsafeUnpin for SchemaError
impl UnwindSafe for SchemaError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more