-
-
Notifications
You must be signed in to change notification settings - Fork 294
Open
Description
Thanks for the great crate!
I have the following code.
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(tag = "key")]
#[serde(rename_all = "kebab-case")]
#[derive(schemars::JsonSchema)]
pub enum DataSource {
/// Format Key?
Format(FormatInfo),
/// Lint Key?
Lint(LintInfo),
}
/// Format Information
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(schemars::JsonSchema)]
pub struct FormatInfo {
includes: Vec<String>,
excludes: Vec<String>,
}
/// Lint Information
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(schemars::JsonSchema)]
pub struct LintInfo {
includes: Vec<String>,
excludes: Vec<String>,
}Output Schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "DataSource",
"oneOf": [
{
"description": "Format Key?",
"type": "object",
"properties": {
"key": {
// I want to "title" and "description" here
"type": "string",
"const": "format"
}
},
"$ref": "#/$defs/FormatInfo",
"required": [
"key"
]
},
{
"description": "Lint Key?",
"type": "object",
"properties": {
"key": {
// I want to "title" and "description" here
"type": "string",
"const": "lint"
}
},
"$ref": "#/$defs/LintInfo",
"required": [
"key"
]
}
],
"$defs": {
"FormatInfo": {
"description": "Format Information",
"type": "object",
"properties": {
"excludes": {
"type": "array",
"items": {
"type": "string"
}
},
"includes": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"includes",
"excludes"
]
},
"LintInfo": {
"description": "Lint Information",
"type": "object",
"properties": {
"excludes": {
"type": "array",
"items": {
"type": "string"
}
},
"includes": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"includes",
"excludes"
]
}
}
}Is there a way to add title and description properties to the "key" property?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels