Skip to content

bug(schemars_derive/docs): newlines get stripped in example blocks #313

@DonIsaac

Description

@DonIsaac
use schemars::JsonSchema;
use serde::Deserialize;

/// # Some Config
/// 
/// This config does some stuff.
///
/// # Example
///
/// ```jsonc
/// {
///   // use this config setting in a certain way
///   "foo": ["bar", "baz"],
/// }
/// ```
#[derive(Debug, Deserialize, Default, JSONSchema)]
pub struct Config {
    foo: Vec<String>
}

When rendered to a JSON schema, the code block in the schema's description field will be stripped, causing invalid JSONC to be rendered. It looks like other markdown in description has its whitespace preserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions