INNER CODE UNIT · Rust
max_operation_definitions
apollographql/apollo-rs · crates/apollo-smith/src/lib.rs:224
pub fn max_operation_definitions(mut self, max: usize) -> Self {
self.max_operation_definitions = max;
self
}
/// Generate random definitions according to the configured maximums
/// and return the resulting [`Document`].
pub fn build(mut self) -> Result<Document> {
for _ in 0..self.u.int_in_range(1..=self.max_scalar_types)? {
let scalar_type_def = self.scalar_type_definition()?;
self.scalar_type_defs.push(scalar_type_def);
}
for _ in 0..self.u.int_in_range(1..=self.max_enum_types)? {
let enum_type_def = self.enum_type_definition()?;
self.enum_type_defs.push(enum_type_def);
}