example
Module providing utilities for handling GraphQL example directives and printing example values.
getDirectiveExampleOption()β
function getDirectiveExampleOption(options): Maybe<TypeDirectiveExample>
Defined in: example.ts:44
Retrieves directive example options from the provided print type options.
Parametersβ
optionsβ
PrintTypeOptions
Configuration options
Returnsβ
Maybe
<TypeDirectiveExample
>
The directive example configuration if valid, otherwise undefined
printExample()β
function printExample(type, options): Maybe<string>
Defined in: example.ts:247
Prints an example value for a given GraphQL type or operation.
Parametersβ
typeβ
unknown
The GraphQL type or operation to generate an example for
optionsβ
PrintTypeOptions
Configuration options for printing the example
Returnsβ
Maybe
<string
>
Stringified example if available, otherwise undefined
Exampleβ
const example = printExample(type, { schema, exampleSection });
if (example) {
console.log(example);
}