Skip to content

Commit

Permalink
Document private functions with @internal tag (#2205)
Browse files Browse the repository at this point in the history
  • Loading branch information
Enda authored and IvanGoncharov committed Oct 1, 2019
1 parent 6fc5e42 commit 5eb7c4d
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 22 deletions.
19 changes: 17 additions & 2 deletions src/execution/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ function buildResponse(
/**
* Essential assertions before executing to provide developer feedback for
* improper use of the GraphQL library.
*
* @internal
*/
export function assertValidExecutionArguments(
schema: GraphQLSchema,
Expand All @@ -267,6 +269,8 @@ export function assertValidExecutionArguments(
* execute, which we will pass throughout the other execution methods.
*
* Throws a GraphQLError if a valid execution context cannot be created.
*
* @internal
*/
export function buildExecutionContext(
schema: GraphQLSchema,
Expand Down Expand Up @@ -465,6 +469,8 @@ function executeFields(
* CollectFields requires the "runtime type" of an object. For a field which
* returns an Interface or Union type, the "runtime type" will be the actual
* Object type returned by that field.
*
* @internal
*/
export function collectFields(
exeContext: ExecutionContext,
Expand Down Expand Up @@ -641,6 +647,9 @@ function resolveField(
);
}

/**
* @internal
*/
export function buildResolveInfo(
exeContext: ExecutionContext,
fieldDef: GraphQLField<mixed, mixed>,
Expand All @@ -664,8 +673,12 @@ export function buildResolveInfo(
};
}

// Isolates the "ReturnOrAbrupt" behavior to not de-opt the `resolveField`
// function. Returns the result of resolveFn or the abrupt-return Error object.
/**
* Isolates the "ReturnOrAbrupt" behavior to not de-opt the `resolveField`
* function. Returns the result of resolveFn or the abrupt-return Error object.
*
* @internal
*/
export function resolveFieldValueOrError(
exeContext: ExecutionContext,
fieldDef: GraphQLField<mixed, mixed>,
Expand Down Expand Up @@ -1192,6 +1205,8 @@ export const defaultFieldResolver: GraphQLFieldResolver<
* are allowed, like on a Union. __schema could get automatically
* added to the query type, but that would require mutating type
* definitions, which would cause issues.
*
* @internal
*/
export function getFieldDef(
schema: GraphQLSchema,
Expand Down
4 changes: 4 additions & 0 deletions src/execution/values.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ type CoercedVariableValues =
* Note: The returned value is a plain Object with a prototype, since it is
* exposed to user code. Care should be taken to not pull values from the
* Object prototype.
*
* @internal
*/
export function getVariableValues(
schema: GraphQLSchema,
Expand Down Expand Up @@ -153,6 +155,8 @@ function coerceVariableValues(
* Note: The returned value is a plain Object with a prototype, since it is
* exposed to user code. Care should be taken to not pull values from the
* Object prototype.
*
* @internal
*/
export function getArgumentValues(
def: GraphQLField<mixed, mixed> | GraphQLDirective,
Expand Down
9 changes: 7 additions & 2 deletions src/language/blockString.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc.
*
* This implements the GraphQL spec's BlockStringValue() static algorithm.
*
* @internal
*/
export function dedentBlockStringValue(rawString: string): string {
// Expand a block string's raw value into independent lines.
Expand All @@ -30,8 +32,9 @@ export function dedentBlockStringValue(rawString: string): string {
// Return a string of the lines joined with U+000A.
return lines.join('\n');
}

// @internal
/**
* @internal
*/
export function getBlockStringIndentation(
lines: $ReadOnlyArray<string>,
): number {
Expand Down Expand Up @@ -71,6 +74,8 @@ function isBlank(str) {
* Print a block string in the indented block form by adding a leading and
* trailing blank line. However, if a block string starts with whitespace and is
* a single-line, adding a leading blank line would strip that whitespace.
*
* @internal
*/
export function printBlockString(
value: string,
Expand Down
4 changes: 3 additions & 1 deletion src/language/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export type Lexer<TOptions> = {
...
};

// @internal
/**
* @internal
*/
export function isPunctuatorTokenKind(kind: TokenKindEnum) {
return (
kind === TokenKind.BANG ||
Expand Down
3 changes: 3 additions & 0 deletions src/type/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,9 @@ function fieldsToFieldsConfig(fields) {
}));
}
/**
* @internal
*/
export function argsToArgsConfig(
args: $ReadOnlyArray<GraphQLArgument>,
): GraphQLFieldConfigArgumentMap {
Expand Down
4 changes: 3 additions & 1 deletion src/validation/rules/KnownArgumentNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export function KnownArgumentNames(context: ValidationContext): ASTVisitor {
};
}

// @internal
/**
* @internal
*/
export function KnownArgumentNamesOnDirectives(
context: ValidationContext | SDLValidationContext,
): ASTVisitor {
Expand Down
4 changes: 3 additions & 1 deletion src/validation/rules/ProvidedRequiredArguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export function ProvidedRequiredArguments(
};
}

// @internal
/**
* @internal
*/
export function ProvidedRequiredArgumentsOnDirectives(
context: ValidationContext | SDLValidationContext,
): ASTVisitor {
Expand Down
8 changes: 5 additions & 3 deletions src/validation/specifiedRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { UniqueDirectivesPerLocation } from './rules/UniqueDirectivesPerLocation
// Spec Section: "Argument Names"
import {
KnownArgumentNames,
KnownArgumentNamesOnDirectives, // @internal
KnownArgumentNamesOnDirectives,
} from './rules/KnownArgumentNames';

// Spec Section: "Argument Uniqueness"
Expand All @@ -72,7 +72,7 @@ import { ValuesOfCorrectType } from './rules/ValuesOfCorrectType';
// Spec Section: "Argument Optionality"
import {
ProvidedRequiredArguments,
ProvidedRequiredArgumentsOnDirectives, // @internal
ProvidedRequiredArgumentsOnDirectives,
} from './rules/ProvidedRequiredArguments';

// Spec Section: "All Variable Usages Are Allowed"
Expand Down Expand Up @@ -127,7 +127,9 @@ import { UniqueFieldDefinitionNames } from './rules/UniqueFieldDefinitionNames';
import { UniqueDirectiveNames } from './rules/UniqueDirectiveNames';
import { PossibleTypeExtensions } from './rules/PossibleTypeExtensions';

// @internal
/**
* @internal
*/
export const specifiedSDLRules = Object.freeze([
LoneSchemaDefinition,
UniqueOperationTypes,
Expand Down
4 changes: 3 additions & 1 deletion src/validation/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ export function validate(
return errors;
}

// @internal
/**
* @internal
*/
export function validateSDL(
documentAST: DocumentNode,
schemaToExtend?: ?GraphQLSchema,
Expand Down
4 changes: 3 additions & 1 deletion tstypes/language/blockString.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
*/
export function dedentBlockStringValue(rawString: string): string;

// @internal
/**
* @internal
*/
export function getBlockStringIndentation(lines: ReadonlyArray<string>): number;

/**
Expand Down
4 changes: 3 additions & 1 deletion tstypes/language/directiveLocation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
*/
export const DirectiveLocation: _DirectiveLocation;

// @internal
/**
* @internal
*/
type _DirectiveLocation = {
// Request Definitions
QUERY: 'QUERY';
Expand Down
4 changes: 3 additions & 1 deletion tstypes/language/kinds.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
*/
export const Kind: _Kind;

// @internal
/**
* @internal
*/
type _Kind = {
// Name
NAME: 'Name';
Expand Down
8 changes: 6 additions & 2 deletions tstypes/utilities/findBreakingChanges.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { DirectiveLocationEnum } from '../language/directiveLocation';

export const BreakingChangeType: _BreakingChangeType;

// @internal
/**
* @internal
*/
type _BreakingChangeType = {
TYPE_REMOVED: 'TYPE_REMOVED';
TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND';
Expand All @@ -25,7 +27,9 @@ type _BreakingChangeType = {

export const DangerousChangeType: _DangerousChangeType;

// @internal
/**
* @internal
*/
type _DangerousChangeType = {
VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM';
TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION';
Expand Down
4 changes: 3 additions & 1 deletion tstypes/validation/rules/KnownArgumentNames.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import { ASTVisitor } from '../../language/visitor';
*/
export function KnownArgumentNames(context: ValidationContext): ASTVisitor;

// @internal
/**
* @internal
*/
export function KnownArgumentNamesOnDirectives(
context: ValidationContext | SDLValidationContext,
): ASTVisitor;
4 changes: 3 additions & 1 deletion tstypes/validation/rules/ProvidedRequiredArguments.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export function ProvidedRequiredArguments(
context: ValidationContext,
): ASTVisitor;

// @internal
/**
* @internal
*/
export function ProvidedRequiredArgumentsOnDirectives(
context: ValidationContext | SDLValidationContext,
): ASTVisitor;
8 changes: 5 additions & 3 deletions tstypes/validation/specifiedRules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { UniqueDirectivesPerLocation } from './rules/UniqueDirectivesPerLocation
// Spec Section: "Argument Names"
import {
KnownArgumentNames,
KnownArgumentNamesOnDirectives, // @internal
KnownArgumentNamesOnDirectives,
} from './rules/KnownArgumentNames';

// Spec Section: "Argument Uniqueness"
Expand All @@ -72,7 +72,7 @@ import { ValuesOfCorrectType } from './rules/ValuesOfCorrectType';
// Spec Section: "Argument Optionality"
import {
ProvidedRequiredArguments,
ProvidedRequiredArgumentsOnDirectives, // @internal
ProvidedRequiredArgumentsOnDirectives,
} from './rules/ProvidedRequiredArguments';

// Spec Section: "All Variable Usages Are Allowed"
Expand All @@ -94,5 +94,7 @@ export const specifiedRules: ReadonlyArray<ValidationRule>;

import { LoneSchemaDefinition } from './rules/LoneSchemaDefinition';

// @internal
/**
* @internal
*/
export const specifiedSDLRules: ReadonlyArray<SDLValidationRule>;
4 changes: 3 additions & 1 deletion tstypes/validation/validate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export function validate(
options?: { maxErrors?: number },
): ReadonlyArray<GraphQLError>;

// @internal
/**
* @internal
*/
export function validateSDL(
documentAST: DocumentNode,
schemaToExtend?: Maybe<GraphQLSchema>,
Expand Down

0 comments on commit 5eb7c4d

Please sign in to comment.