pub struct IsOApi3PropRequiredHelper;
Expand description
Returns true is the current context is an open api 3 required component property, false otherwise
let json = json!({
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"username": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"username"
]
});
assert_eq!(
exec_template(json, "{{#each properties}}{{@key}} is {{#if (is_oapi3_property_required @key ../required)}}required{{else}}not required{{/if}}\n{{/each}}"),
r#"id is required
username is required
name is not required
"#
);
Trait Implementations§
Source§impl HelperDef for IsOApi3PropRequiredHelper
impl HelperDef for IsOApi3PropRequiredHelper
Source§fn call_inner<'reg: 'rc, 'rc>(
&self,
h: &Helper<'reg, 'rc>,
_: &'reg Handlebars<'reg>,
_: &'rc Context,
_: &mut RenderContext<'reg, 'rc>,
) -> Result<ScopedJson<'reg, 'rc>, RenderError>
fn call_inner<'reg: 'rc, 'rc>( &self, h: &Helper<'reg, 'rc>, _: &'reg Handlebars<'reg>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, ) -> Result<ScopedJson<'reg, 'rc>, RenderError>
A simplified api to define helper Read more
Auto Trait Implementations§
impl Freeze for IsOApi3PropRequiredHelper
impl RefUnwindSafe for IsOApi3PropRequiredHelper
impl Send for IsOApi3PropRequiredHelper
impl Sync for IsOApi3PropRequiredHelper
impl Unpin for IsOApi3PropRequiredHelper
impl UnwindSafe for IsOApi3PropRequiredHelper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more