File tree Expand file tree Collapse file tree 6 files changed +13
-14
lines changed Expand file tree Collapse file tree 6 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,11 @@ See the License for the specific language governing permissions and
11
11
limitations under the License.
12
12
*/
13
13
14
- import { TypeDefinitionNode } from "graphql" ;
15
14
import { CodegenConfigWithDefaults } from "./build-config-with-defaults" ;
16
15
17
- export function shouldExcludeTypeDefinition (
18
- node : TypeDefinitionNode ,
16
+ export function shouldIncludeTypeDefinition (
17
+ typeName : string ,
19
18
config : CodegenConfigWithDefaults ,
20
19
) {
21
- return config . onlyTypes && ! config . onlyTypes . includes ( node . name . value ) ;
20
+ return ! config . onlyTypes || config . onlyTypes . includes ( typeName ) ;
22
21
}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ limitations under the License.
14
14
import { EnumTypeDefinitionNode , EnumValueDefinitionNode } from "graphql" ;
15
15
import { indentMultiline } from "@graphql-codegen/visitor-plugin-common" ;
16
16
import { buildAnnotations } from "../annotations/build-annotations" ;
17
- import { shouldExcludeTypeDefinition } from "../config/should-exclude -type-definition" ;
17
+ import { shouldIncludeTypeDefinition } from "../config/should-include -type-definition" ;
18
18
import { CodegenConfigWithDefaults } from "../config/build-config-with-defaults" ;
19
19
import { sanitizeName } from "../utils/sanitize-name" ;
20
20
import { GraphQLSchema } from "graphql" ;
@@ -24,7 +24,7 @@ export function buildEnumTypeDefinition(
24
24
schema : GraphQLSchema ,
25
25
config : CodegenConfigWithDefaults ,
26
26
) {
27
- if ( shouldExcludeTypeDefinition ( node , config ) ) {
27
+ if ( ! shouldIncludeTypeDefinition ( node . name . value , config ) ) {
28
28
return "" ;
29
29
}
30
30
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ limitations under the License.
12
12
*/
13
13
14
14
import { GraphQLSchema , InputObjectTypeDefinitionNode } from "graphql" ;
15
- import { shouldExcludeTypeDefinition } from "../config/should-exclude -type-definition" ;
15
+ import { shouldIncludeTypeDefinition } from "../config/should-include -type-definition" ;
16
16
import { buildTypeMetadata } from "../utils/build-type-metadata" ;
17
17
import { buildAnnotations } from "../annotations/build-annotations" ;
18
18
import { indent } from "@graphql-codegen/visitor-plugin-common" ;
@@ -25,7 +25,7 @@ export function buildInputObjectDefinition(
25
25
schema : GraphQLSchema ,
26
26
config : CodegenConfigWithDefaults ,
27
27
) {
28
- if ( shouldExcludeTypeDefinition ( node , config ) ) {
28
+ if ( ! shouldIncludeTypeDefinition ( node . name . value , config ) ) {
29
29
return "" ;
30
30
}
31
31
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ limitations under the License.
13
13
14
14
import { GraphQLSchema , InterfaceTypeDefinitionNode } from "graphql" ;
15
15
import { buildAnnotations } from "../annotations/build-annotations" ;
16
- import { shouldExcludeTypeDefinition } from "../config/should-exclude -type-definition" ;
16
+ import { shouldIncludeTypeDefinition } from "../config/should-include -type-definition" ;
17
17
import { buildInterfaceFieldDefinition } from "./field" ;
18
18
import { CodegenConfigWithDefaults } from "../config/build-config-with-defaults" ;
19
19
import { getDependentInterfaceNames } from "../utils/dependent-type-utils" ;
@@ -24,7 +24,7 @@ export function buildInterfaceDefinition(
24
24
schema : GraphQLSchema ,
25
25
config : CodegenConfigWithDefaults ,
26
26
) {
27
- if ( shouldExcludeTypeDefinition ( node , config ) ) {
27
+ if ( ! shouldIncludeTypeDefinition ( node . name . value , config ) ) {
28
28
return "" ;
29
29
}
30
30
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import {
18
18
ObjectTypeDefinitionNode ,
19
19
} from "graphql" ;
20
20
import { buildAnnotations } from "../annotations/build-annotations" ;
21
- import { shouldExcludeTypeDefinition } from "../config/should-exclude -type-definition" ;
21
+ import { shouldIncludeTypeDefinition } from "../config/should-include -type-definition" ;
22
22
import {
23
23
getDependentInterfaceNames ,
24
24
getDependentUnionsForType ,
@@ -37,7 +37,7 @@ export function buildObjectTypeDefinition(
37
37
schema : GraphQLSchema ,
38
38
config : CodegenConfigWithDefaults ,
39
39
) {
40
- if ( shouldExcludeTypeDefinition ( node , config ) ) {
40
+ if ( ! shouldIncludeTypeDefinition ( node . name . value , config ) ) {
41
41
return "" ;
42
42
}
43
43
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ limitations under the License.
12
12
*/
13
13
14
14
import { GraphQLSchema , UnionTypeDefinitionNode } from "graphql" ;
15
- import { shouldExcludeTypeDefinition } from "../config/should-exclude -type-definition" ;
15
+ import { shouldIncludeTypeDefinition } from "../config/should-include -type-definition" ;
16
16
import { CodegenConfigWithDefaults } from "../config/build-config-with-defaults" ;
17
17
import {
18
18
buildAnnotations ,
@@ -25,7 +25,7 @@ export function buildUnionTypeDefinition(
25
25
schema : GraphQLSchema ,
26
26
config : CodegenConfigWithDefaults ,
27
27
) {
28
- if ( shouldExcludeTypeDefinition ( node , config ) ) {
28
+ if ( ! shouldIncludeTypeDefinition ( node . name . value , config ) ) {
29
29
return "" ;
30
30
}
31
31
const annotations = buildAnnotations ( {
You can’t perform that action at this time.
0 commit comments