pub struct JsonFactory;Expand description
Factory for creating JSON test payloads.
§Example
ⓘ
use fastapi_core::fixtures::JsonFactory;
// Valid JSON object
let obj = JsonFactory::object()
.field("name", "Alice")
.field("age", 30)
.build();
// Valid JSON array
let arr = JsonFactory::array()
.push(1)
.push(2)
.build();
// Invalid JSON
let invalid = JsonFactory::malformed();Implementations§
Source§impl JsonFactory
impl JsonFactory
Sourcepub fn object() -> JsonObjectFactory
pub fn object() -> JsonObjectFactory
Create an object factory.
Sourcepub fn array() -> JsonArrayFactory
pub fn array() -> JsonArrayFactory
Create an array factory.
Sourcepub fn trailing_comma() -> Vec<u8> ⓘ
pub fn trailing_comma() -> Vec<u8> ⓘ
Generate JSON with trailing comma.
Sourcepub fn single_quotes() -> Vec<u8> ⓘ
pub fn single_quotes() -> Vec<u8> ⓘ
Generate JSON with single quotes (invalid).
Sourcepub fn unquoted_keys() -> Vec<u8> ⓘ
pub fn unquoted_keys() -> Vec<u8> ⓘ
Generate JSON with unquoted keys (invalid).
Sourcepub fn empty_object() -> Vec<u8> ⓘ
pub fn empty_object() -> Vec<u8> ⓘ
Generate empty object.
Sourcepub fn empty_array() -> Vec<u8> ⓘ
pub fn empty_array() -> Vec<u8> ⓘ
Generate empty array.
Auto Trait Implementations§
impl Freeze for JsonFactory
impl RefUnwindSafe for JsonFactory
impl Send for JsonFactory
impl Sync for JsonFactory
impl Unpin for JsonFactory
impl UnwindSafe for JsonFactory
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).