pub struct SchemaConverter {
pub emit_local_placeholders: bool,
pub type_prefix: String,
pub is_private: bool,
}Expand description
Converts a JSON Schema document into LuaLS (EmmyLua) annotation strings.
Fields§
§emit_local_placeholders: boolIf true, emit local X = {} after each class definition so that
the annotations have a symbol to attach to.
type_prefix: StringPrefix to add to all class and alias names (e.g. “schema.”).
is_private: boolImplementations§
Source§impl SchemaConverter
impl SchemaConverter
pub fn new(is_private: bool) -> Self
Sourcepub fn convert(&self, schema: &Value) -> ConvertResult
pub fn convert(&self, schema: &Value) -> ConvertResult
Convert a JSON Schema (as serde_json::Value) into EmmyLua annotation text.
Sourcepub fn convert_from_str(&self, json_str: &str) -> Result<ConvertResult, Error>
pub fn convert_from_str(&self, json_str: &str) -> Result<ConvertResult, Error>
Convert a JSON Schema string into LuaLS annotation text.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SchemaConverter
impl RefUnwindSafe for SchemaConverter
impl Send for SchemaConverter
impl Sync for SchemaConverter
impl Unpin for SchemaConverter
impl UnsafeUnpin for SchemaConverter
impl UnwindSafe for SchemaConverter
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
Mutably borrows from an owned value. Read more