mod codegen;
mod error;
mod schema;
pub use error::JsonSchemaGenError;
pub use schema::JsonSchema;
use std::io::Write;
use std::path::Path;
pub fn generate_to_writer<W: Write>(
schema_json: &str,
writer: &mut W,
) -> Result<(), JsonSchemaGenError> {
codegen::generate_to_writer(schema_json, writer)
}
pub fn generate_from_file(
input_path: impl AsRef<Path>,
output_path: impl AsRef<Path>,
) -> Result<(), JsonSchemaGenError> {
let schema_json: String = std::fs::read_to_string(input_path)?;
let mut output_file: std::fs::File = std::fs::File::create(output_path)?;
generate_to_writer(&schema_json, &mut output_file)
}