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§

Create an arbitrary vector of Argument

Create an arbitrary vector of Argument given ArgumentsDef

Create an arbitrary Argument

Create an arbitrary Argument

Create an arbitrary ArgumentsDef

Create an arbitrary Description

Create an arbitrary vector of Directive

Create an arbitrary Directive given a directive location

Create an arbitrary DirectiveDef

Create an arbitrary HashSet of DirectiveLocation

Create an arbitrary EnumTypeDef

Choose an arbitrary EnumTypeDef in existings (already created) enum definitions

Create an arbitrary variant Name given an enum

Create an arbitrary EnumValueDefinition

Create an arbitrary list of FieldDef

Create an arbitrary Field given an object type

Create an arbitrary FragmentDef

Create an arbitrary FragmentSpread, returns None if no fragment definition was previously created

Create an arbitrary InlineFragment

Create an arbitrary TypeCondition

Create an arbitrary InputObjectTypeDef

Create an arbitrary InputValue

Create an arbitrary list of InputValueDef

Create an arbitrary InputValueDef

Create an arbitrary InterfaceTypeDef

Create an arbitrary HashSet of implemented interfaces

Create an arbitrary Name

Create an arbitrary type Name

Create an arbitrary Name with an index included in the name (to avoid name conflict)

Create an arbitrary ObjectTypeDef

Create an arbitrary OperationDef taking the last SchemaDef

Create an arbitrary ScalarTypeDef

Create an arbitrary SchemaDef

Create an arbitrary SelectionSet

Create an arbitrary Selection

Create an arbitrary Ty

Choose an arbitrary existing Ty given a slice of existing types

Choose an arbitrary existing named Ty given a slice of existing types

Create an arbitrary UnionTypeDef

Create an arbitrary list of VariableDef

Create an arbitrary VariableDef

Create an instance of DocumentBuilder

Create an instance of DocumentBuilder given a Document to be able to call methods on DocumentBuilder and generate valid entities like for example an operation

Returns whether the provided Unstructured is now empty

Convert a DocumentBuilder into a GraphQL Document

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.