pub struct Options {
pub date_to_date_time: Option<bool>,
pub clone_schema: Option<bool>,
pub support_pattern_properties: Option<bool>,
pub keep_not_supported: Option<Vec<String>>,
pub strict_mode: Option<bool>,
pub remove_read_only: Option<bool>,
pub remove_write_only: Option<bool>,
pub pattern_properties_handler: Option<PatternPropertiesHandler>,
pub definition_keywords: Option<Vec<String>>,
pub before_transform: Option<BeforeTransform>,
pub after_transform: Option<AfterTransform>,
}Expand description
Caller-facing options. Every field is optional. Unset fields take the
defaults described on ResolvedOptions.
Two ways to set options. Use struct-update syntax against Options::new:
let options = Options {
support_pattern_properties: Some(true),
..Options::new()
};Or chain the setters, which take plain values and wrap them for you:
let options = Options::new()
.support_pattern_properties(true)
.strict_mode(false);Fields§
§date_to_date_time: Option<bool>Rewrite format: "date" to format: "date-time". Default false.
clone_schema: Option<bool>Accepted for compatibility and ignored. Conversion takes the input by value and never mutates the caller’s data, so the output is the same whether this is set or unset. Default true.
support_pattern_properties: Option<bool>Move x-patternProperties to patternProperties and run the handler.
Default false.
keep_not_supported: Option<Vec<String>>Keywords to keep that would otherwise be stripped. Each entry is removed from the strip list. Default empty.
strict_mode: Option<bool>Reject input type values outside the draft-04 type set. Default true.
remove_read_only: Option<bool>Drop object properties marked readOnly: true. Default false.
remove_write_only: Option<bool>Drop object properties marked writeOnly: true. Default false.
pattern_properties_handler: Option<PatternPropertiesHandler>Replacement for the default patternProperties handler.
definition_keywords: Option<Vec<String>>Dotted paths whose values hold named sub-schemas to convert, for example
"definitions" or "schema.definitions". Default empty.
before_transform: Option<BeforeTransform>Hook run on each node before keyword processing.
after_transform: Option<AfterTransform>Hook run on each node after keyword processing.
Implementations§
Source§impl Options
impl Options
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct empty options. Equivalent to Options::default.
Sourcepub fn date_to_date_time(self, value: bool) -> Self
pub fn date_to_date_time(self, value: bool) -> Self
Set date_to_date_time. See the field for meaning.
Sourcepub fn clone_schema(self, value: bool) -> Self
pub fn clone_schema(self, value: bool) -> Self
Set clone_schema. Accepted for compatibility and has no effect.
Sourcepub fn support_pattern_properties(self, value: bool) -> Self
pub fn support_pattern_properties(self, value: bool) -> Self
Set support_pattern_properties. See the field for meaning.
Sourcepub fn keep_not_supported(self, value: Vec<String>) -> Self
pub fn keep_not_supported(self, value: Vec<String>) -> Self
Set keep_not_supported. See the field for meaning.
Sourcepub fn strict_mode(self, value: bool) -> Self
pub fn strict_mode(self, value: bool) -> Self
Set strict_mode. See the field for meaning.
Sourcepub fn remove_read_only(self, value: bool) -> Self
pub fn remove_read_only(self, value: bool) -> Self
Set remove_read_only. See the field for meaning.
Sourcepub fn remove_write_only(self, value: bool) -> Self
pub fn remove_write_only(self, value: bool) -> Self
Set remove_write_only. See the field for meaning.
Sourcepub fn definition_keywords(self, value: Vec<String>) -> Self
pub fn definition_keywords(self, value: Vec<String>) -> Self
Set definition_keywords. See the field for meaning.
Sourcepub fn pattern_properties_handler<F>(self, handler: F) -> Self
pub fn pattern_properties_handler<F>(self, handler: F) -> Self
Set the patternProperties handler from a plain closure. The closure is
boxed for you, so callers do not write Arc::new.
Sourcepub fn before_transform<F>(self, hook: F) -> Self
pub fn before_transform<F>(self, hook: F) -> Self
Set the before-transform hook from a plain closure. The closure is boxed for you.
Sourcepub fn after_transform<F>(self, hook: F) -> Self
pub fn after_transform<F>(self, hook: F) -> Self
Set the after-transform hook from a plain closure. The closure is boxed for you.