Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DonIsaac opened this issue Aug 11, 2024 · 1 comment
Closed

Comments

@DonIsaac
Copy link

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.

@GREsau
Copy link
Owner

GREsau commented Aug 11, 2024

Duplicate of #38 / #120 / #129

Fortunately, this is now fixed in schemars v1.0.0-alpha.3

@GREsau GREsau closed this as completed Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants