specta-jsonschema 0.0.3

Export your Rust types to a JSON Schema
Documentation
use std::io;

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error("IO error: {0}")]
    Io(#[from] io::Error),

    #[error("JSON serialization error: {0}")]
    Json(#[from] serde_json::Error),

    #[error("Invalid schema version: {0}")]
    InvalidSchemaVersion(String),

    #[error("Duplicate type name '{name}' at {location1} and {location2}")]
    DuplicateTypeName {
        name: String,
        location1: String,
        location2: String,
    },

    #[error("Invalid type name '{name}' at {path}")]
    InvalidTypeName { name: String, path: String },

    #[error("Unable to convert schema: {0}")]
    ConversionError(String),

    #[error("Format error: {message}: {source}")]
    Format {
        message: &'static str,
        source: specta::FormatError,
    },

    #[error("Unsupported DataType: {0}")]
    UnsupportedDataType(String),

    #[error("Invalid reference: {0}")]
    InvalidReference(String),
}

impl Error {
    pub(crate) fn format(message: &'static str, source: specta::FormatError) -> Self {
        Self::Format { message, source }
    }
}