mrmime 0.0.3

Small, explicit MIME type registry with fast lookup by type or extension.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::MimeType;

// Map MimeType to an OpenAPI string schema for utoipa users.
#[cfg(feature = "utoipa")]
impl utoipa::PartialSchema for MimeType {
    fn schema() -> utoipa::openapi::RefOr<utoipa::openapi::schema::Schema> {
        use utoipa::openapi::schema::{ObjectBuilder, Schema, Type};
        let schema: Schema = ObjectBuilder::new().schema_type(Type::String).into();
        schema.into()
    }
}

#[cfg(feature = "utoipa")]
impl utoipa::ToSchema for MimeType {}