Skip to content

Convert more types to be exact objects #2231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/utilities/findBreakingChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,15 @@ export const DangerousChangeType = Object.freeze({
ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE',
});

export type BreakingChange = {
export type BreakingChange = {|
type: $Keys<typeof BreakingChangeType>,
description: string,
...
};
|};

export type DangerousChange = {
export type DangerousChange = {|
type: $Keys<typeof DangerousChangeType>,
description: string,
...
};
|};

/**
* Given two schemas, returns an Array containing descriptions of all the types
Expand Down
45 changes: 18 additions & 27 deletions src/utilities/getIntrospectionQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,25 +137,23 @@ export type IntrospectionInputType =
| IntrospectionEnumType
| IntrospectionInputObjectType;

export type IntrospectionScalarType = {
export type IntrospectionScalarType = {|
+kind: 'SCALAR',
+name: string,
+description?: ?string,
...
};
|};

export type IntrospectionObjectType = {
export type IntrospectionObjectType = {|
+kind: 'OBJECT',
+name: string,
+description?: ?string,
+fields: $ReadOnlyArray<IntrospectionField>,
+interfaces: $ReadOnlyArray<
IntrospectionNamedTypeRef<IntrospectionInterfaceType>,
>,
...
};
|};

export type IntrospectionInterfaceType = {
export type IntrospectionInterfaceType = {|
+kind: 'INTERFACE',
+name: string,
+description?: ?string,
Expand All @@ -166,50 +164,44 @@ export type IntrospectionInterfaceType = {
+possibleTypes: $ReadOnlyArray<
IntrospectionNamedTypeRef<IntrospectionObjectType>,
>,
...
};
|};

export type IntrospectionUnionType = {
export type IntrospectionUnionType = {|
+kind: 'UNION',
+name: string,
+description?: ?string,
+possibleTypes: $ReadOnlyArray<
IntrospectionNamedTypeRef<IntrospectionObjectType>,
>,
...
};
|};

export type IntrospectionEnumType = {
export type IntrospectionEnumType = {|
+kind: 'ENUM',
+name: string,
+description?: ?string,
+enumValues: $ReadOnlyArray<IntrospectionEnumValue>,
...
};
|};

export type IntrospectionInputObjectType = {
export type IntrospectionInputObjectType = {|
+kind: 'INPUT_OBJECT',
+name: string,
+description?: ?string,
+inputFields: $ReadOnlyArray<IntrospectionInputValue>,
...
};
|};

export type IntrospectionListTypeRef<
T: IntrospectionTypeRef = IntrospectionTypeRef,
> = {
> = {|
+kind: 'LIST',
+ofType: T,
...
};
|};

export type IntrospectionNonNullTypeRef<
T: IntrospectionTypeRef = IntrospectionTypeRef,
> = {
> = {|
+kind: 'NON_NULL',
+ofType: T,
...
};
|};

export type IntrospectionTypeRef =
| IntrospectionNamedTypeRef<IntrospectionType>
Expand Down Expand Up @@ -237,11 +229,10 @@ export type IntrospectionInputTypeRef =

export type IntrospectionNamedTypeRef<
T: IntrospectionType = IntrospectionType,
> = {
> = {|
+kind: $PropertyType<T, 'kind'>,
+name: string,
...
};
|};

export type IntrospectionField = {|
+name: string,
Expand Down