@@ -28,14 +28,12 @@ use std::{error::Error, fs, path::Path};
2828use log:: error;
2929use serde:: { Deserialize , Serialize } ;
3030
31- use crate :: error:: DataModelError ;
3231use crate :: exporters:: { render_jinja_template, Templates } ;
3332use crate :: json:: export:: to_json_schema;
34- use crate :: json:: schema:: SchemaObject ;
3533use crate :: json:: validation:: { validate_json, ValidationError } ;
3634use crate :: linkml:: export:: serialize_linkml;
3735use crate :: markdown:: frontmatter:: FrontMatter ;
38- use crate :: markdown:: parser:: { parse_markdown, validate_model } ;
36+ use crate :: markdown:: parser:: parse_markdown;
3937use crate :: object:: { Enumeration , Object } ;
4038use crate :: validation:: Validator ;
4139use colored:: Colorize ;
@@ -367,63 +365,6 @@ impl DataModel {
367365 pub fn from_markdown_string ( content : & str ) -> Result < Self , Validator > {
368366 parse_markdown ( content, None )
369367 }
370-
371- /// Parse a JSON schema file and create a data model
372- ///
373- /// * `path` - Path to the JSON schema file
374- ///
375- /// # Returns
376- /// A data model
377- #[ allow( clippy:: result_large_err) ]
378- pub fn from_json_schema ( path : & Path ) -> Result < Self , DataModelError > {
379- let content = fs:: read_to_string ( path) ?;
380- let schema: SchemaObject = serde_json:: from_str ( & content) ?;
381- let model: DataModel = schema
382- . try_into ( )
383- . expect ( "Could not convert schema to data model" ) ;
384-
385- // Validate the data model
386- validate_model ( & model) . map_err ( DataModelError :: ValidationError ) ?;
387-
388- Ok ( model)
389- }
390-
391- /// Parse a JSON schema string and create a data model
392- ///
393- /// * `content` - The JSON schema string
394- ///
395- /// # Returns
396- /// A data model
397- #[ allow( clippy:: result_large_err) ]
398- pub fn from_json_schema_string ( content : & str ) -> Result < Self , DataModelError > {
399- let schema: SchemaObject = serde_json:: from_str ( content) ?;
400- let model: DataModel = schema
401- . try_into ( )
402- . expect ( "Could not convert schema to data model" ) ;
403-
404- // Validate the data model
405- validate_model ( & model) . map_err ( DataModelError :: ValidationError ) ?;
406-
407- Ok ( model)
408- }
409-
410- /// Parse a JSON schema object and create a data model
411- ///
412- /// * `schema` - The JSON schema object
413- ///
414- /// # Returns
415- /// A data model
416- #[ allow( clippy:: result_large_err) ]
417- pub fn from_json_schema_object ( schema : SchemaObject ) -> Result < Self , DataModelError > {
418- let model: DataModel = schema
419- . try_into ( )
420- . expect ( "Could not convert schema to data model" ) ;
421-
422- // Validate the data model
423- validate_model ( & model) . map_err ( DataModelError :: ValidationError ) ?;
424-
425- Ok ( model)
426- }
427368}
428369
429370#[ cfg( test) ]
0 commit comments