Struct apollo_smith::DocumentBuilder
source · [−]pub struct DocumentBuilder<'a> { /* private fields */ }Expand description
DocumentBuilder is a struct to build an arbitrary valid GraphQL document
// fuzz/fuzz_targets/my_apollo_smith_fuzz_target.rs
#![no_main]
use libfuzzer_sys::fuzz_target;
use arbitrary::Unstructured;
use apollo_smith::DocumentBuilder;
fuzz_target!(|input: &[u8]| {
let mut u = Unstructured::new(input);
let gql_doc = DocumentBuilder::new(&mut u)?;
let document = gql_doc.finish();
let document_str = String::from(document);
// Your code here...
});Implementations
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn description(&mut self) -> Result<Description>
pub fn description(&mut self) -> Result<Description>
Create an arbitrary Description
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn directives(&mut self) -> Result<Vec<Directive>>
pub fn directives(&mut self) -> Result<Vec<Directive>>
Create an arbitrary vector of Directive
sourcepub fn directive_def(&mut self) -> Result<DirectiveDef>
pub fn directive_def(&mut self) -> Result<DirectiveDef>
Create an arbitrary DirectiveDef
sourcepub fn directive_locations(&mut self) -> Result<HashSet<DirectiveLocation>>
pub fn directive_locations(&mut self) -> Result<HashSet<DirectiveLocation>>
Create an arbitrary HashSet of DirectiveLocation
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn enum_type_definition(&mut self) -> Result<EnumTypeDef>
pub fn enum_type_definition(&mut self) -> Result<EnumTypeDef>
Create an arbitrary EnumTypeDef
sourcepub fn choose_enum(&mut self) -> Result<&EnumTypeDef>
pub fn choose_enum(&mut self) -> Result<&EnumTypeDef>
Choose an arbitrary EnumTypeDef in existings (already created) enum definitions
sourcepub fn arbitrary_variant<'b>(
&mut self,
enum_: &'b EnumTypeDef
) -> Result<&'b Name>
pub fn arbitrary_variant<'b>(
&mut self,
enum_: &'b EnumTypeDef
) -> Result<&'b Name>
Create an arbitrary variant Name given an enum
sourcepub fn enum_values_definition(&mut self) -> Result<HashSet<EnumValueDefinition>>
pub fn enum_values_definition(&mut self) -> Result<HashSet<EnumValueDefinition>>
Create an arbitrary EnumValueDefinition
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn fields_definition(&mut self, exclude: &[&Name]) -> Result<Vec<FieldDef>>
pub fn fields_definition(&mut self, exclude: &[&Name]) -> Result<Vec<FieldDef>>
Create an arbitrary list of FieldDef
sourcepub fn field_with_index(&mut self, index: usize) -> Result<Field>
pub fn field_with_index(&mut self, index: usize) -> Result<Field>
Create an arbitrary Field given an index to put in the name of the field (to avoid duplicated fields)
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn fragment_definition(&mut self) -> Result<FragmentDef>
pub fn fragment_definition(&mut self) -> Result<FragmentDef>
Create an arbitrary FragmentDef
sourcepub fn fragment_spread(
&mut self,
excludes: &mut Vec<Name>
) -> Result<Option<FragmentSpread>>
pub fn fragment_spread(
&mut self,
excludes: &mut Vec<Name>
) -> Result<Option<FragmentSpread>>
Create an arbitrary FragmentSpread, returns None if no fragment definition was previously created
sourcepub fn inline_fragment(&mut self) -> Result<InlineFragment>
pub fn inline_fragment(&mut self) -> Result<InlineFragment>
Create an arbitrary InlineFragment
sourcepub fn type_condition(&mut self) -> Result<TypeCondition>
pub fn type_condition(&mut self) -> Result<TypeCondition>
Create an arbitrary TypeCondition
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn input_object_type_definition(&mut self) -> Result<InputObjectTypeDef>
pub fn input_object_type_definition(&mut self) -> Result<InputObjectTypeDef>
Create an arbitrary InputObjectTypeDef
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn input_value(&mut self) -> Result<InputValue>
pub fn input_value(&mut self) -> Result<InputValue>
Create an arbitrary InputValue
sourcepub fn input_values_def(&mut self) -> Result<Vec<InputValueDef>>
pub fn input_values_def(&mut self) -> Result<Vec<InputValueDef>>
Create an arbitrary list of InputValueDef
sourcepub fn input_value_def(&mut self) -> Result<InputValueDef>
pub fn input_value_def(&mut self) -> Result<InputValueDef>
Create an arbitrary InputValueDef
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn interface_type_definition(&mut self) -> Result<InterfaceTypeDef>
pub fn interface_type_definition(&mut self) -> Result<InterfaceTypeDef>
Create an arbitrary InterfaceTypeDef
sourcepub fn implements_interfaces(&mut self) -> Result<HashSet<Name>>
pub fn implements_interfaces(&mut self) -> Result<HashSet<Name>>
Create an arbitrary HashSet of implemented interfaces
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn name_with_index(&mut self, index: usize) -> Result<Name>
pub fn name_with_index(&mut self, index: usize) -> Result<Name>
Create an arbitrary Name with an index included in the name (to avoid name conflict)
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn object_type_definition(&mut self) -> Result<ObjectTypeDef>
pub fn object_type_definition(&mut self) -> Result<ObjectTypeDef>
Create an arbitrary ObjectTypeDef
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn operation_definition(&mut self) -> Result<OperationDef>
pub fn operation_definition(&mut self) -> Result<OperationDef>
Create an arbitrary OperationDef
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn scalar_type_definition(&mut self) -> Result<ScalarTypeDef>
pub fn scalar_type_definition(&mut self) -> Result<ScalarTypeDef>
Create an arbitrary ScalarTypeDef
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn schema_definition(&mut self) -> Result<SchemaDef>
pub fn schema_definition(&mut self) -> Result<SchemaDef>
Create an arbitrary SchemaDef
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn union_type_definition(&mut self) -> Result<UnionTypeDef>
pub fn union_type_definition(&mut self) -> Result<UnionTypeDef>
Create an arbitrary UnionTypeDef
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
sourcepub fn variable_definitions(&mut self) -> Result<Vec<VariableDef>>
pub fn variable_definitions(&mut self) -> Result<Vec<VariableDef>>
Create an arbitrary list of VariableDef
sourcepub fn variable_definition(&mut self) -> Result<VariableDef>
pub fn variable_definition(&mut self) -> Result<VariableDef>
Create an arbitrary VariableDef
sourceimpl<'a> DocumentBuilder<'a>
impl<'a> DocumentBuilder<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for DocumentBuilder<'a>
impl<'a> Send for DocumentBuilder<'a>
impl<'a> Sync for DocumentBuilder<'a>
impl<'a> Unpin for DocumentBuilder<'a>
impl<'a> !UnwindSafe for DocumentBuilder<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more