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
1111limitations under the License.
1212*/
1313
14- import { TypeDefinitionNode } from "graphql" ;
1514import { CodegenConfigWithDefaults } from "./build-config-with-defaults" ;
1615
17- export function shouldExcludeTypeDefinition (
18- node : TypeDefinitionNode ,
16+ export function shouldIncludeTypeDefinition (
17+ typeName : string ,
1918 config : CodegenConfigWithDefaults ,
2019) {
21- return config . onlyTypes && ! config . onlyTypes . includes ( node . name . value ) ;
20+ return ! config . onlyTypes || config . onlyTypes . includes ( typeName ) ;
2221}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ limitations under the License.
1414import { EnumTypeDefinitionNode , EnumValueDefinitionNode } from "graphql" ;
1515import { indentMultiline } from "@graphql-codegen/visitor-plugin-common" ;
1616import { buildAnnotations } from "../annotations/build-annotations" ;
17- import { shouldExcludeTypeDefinition } from "../config/should-exclude -type-definition" ;
17+ import { shouldIncludeTypeDefinition } from "../config/should-include -type-definition" ;
1818import { CodegenConfigWithDefaults } from "../config/build-config-with-defaults" ;
1919import { sanitizeName } from "../utils/sanitize-name" ;
2020import { GraphQLSchema } from "graphql" ;
@@ -24,7 +24,7 @@ export function buildEnumTypeDefinition(
2424 schema : GraphQLSchema ,
2525 config : CodegenConfigWithDefaults ,
2626) {
27- if ( shouldExcludeTypeDefinition ( node , config ) ) {
27+ if ( ! shouldIncludeTypeDefinition ( node . name . value , config ) ) {
2828 return "" ;
2929 }
3030
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ limitations under the License.
1212*/
1313
1414import { GraphQLSchema , InputObjectTypeDefinitionNode } from "graphql" ;
15- import { shouldExcludeTypeDefinition } from "../config/should-exclude -type-definition" ;
15+ import { shouldIncludeTypeDefinition } from "../config/should-include -type-definition" ;
1616import { buildTypeMetadata } from "../utils/build-type-metadata" ;
1717import { buildAnnotations } from "../annotations/build-annotations" ;
1818import { indent } from "@graphql-codegen/visitor-plugin-common" ;
@@ -25,7 +25,7 @@ export function buildInputObjectDefinition(
2525 schema : GraphQLSchema ,
2626 config : CodegenConfigWithDefaults ,
2727) {
28- if ( shouldExcludeTypeDefinition ( node , config ) ) {
28+ if ( ! shouldIncludeTypeDefinition ( node . name . value , config ) ) {
2929 return "" ;
3030 }
3131
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ limitations under the License.
1313
1414import { GraphQLSchema , InterfaceTypeDefinitionNode } from "graphql" ;
1515import { buildAnnotations } from "../annotations/build-annotations" ;
16- import { shouldExcludeTypeDefinition } from "../config/should-exclude -type-definition" ;
16+ import { shouldIncludeTypeDefinition } from "../config/should-include -type-definition" ;
1717import { buildInterfaceFieldDefinition } from "./field" ;
1818import { CodegenConfigWithDefaults } from "../config/build-config-with-defaults" ;
1919import { getDependentInterfaceNames } from "../utils/dependent-type-utils" ;
@@ -24,7 +24,7 @@ export function buildInterfaceDefinition(
2424 schema : GraphQLSchema ,
2525 config : CodegenConfigWithDefaults ,
2626) {
27- if ( shouldExcludeTypeDefinition ( node , config ) ) {
27+ if ( ! shouldIncludeTypeDefinition ( node . name . value , config ) ) {
2828 return "" ;
2929 }
3030
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import {
1818 ObjectTypeDefinitionNode ,
1919} from "graphql" ;
2020import { buildAnnotations } from "../annotations/build-annotations" ;
21- import { shouldExcludeTypeDefinition } from "../config/should-exclude -type-definition" ;
21+ import { shouldIncludeTypeDefinition } from "../config/should-include -type-definition" ;
2222import {
2323 getDependentInterfaceNames ,
2424 getDependentUnionsForType ,
@@ -37,7 +37,7 @@ export function buildObjectTypeDefinition(
3737 schema : GraphQLSchema ,
3838 config : CodegenConfigWithDefaults ,
3939) {
40- if ( shouldExcludeTypeDefinition ( node , config ) ) {
40+ if ( ! shouldIncludeTypeDefinition ( node . name . value , config ) ) {
4141 return "" ;
4242 }
4343
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ limitations under the License.
1212*/
1313
1414import { GraphQLSchema , UnionTypeDefinitionNode } from "graphql" ;
15- import { shouldExcludeTypeDefinition } from "../config/should-exclude -type-definition" ;
15+ import { shouldIncludeTypeDefinition } from "../config/should-include -type-definition" ;
1616import { CodegenConfigWithDefaults } from "../config/build-config-with-defaults" ;
1717import {
1818 buildAnnotations ,
@@ -25,7 +25,7 @@ export function buildUnionTypeDefinition(
2525 schema : GraphQLSchema ,
2626 config : CodegenConfigWithDefaults ,
2727) {
28- if ( shouldExcludeTypeDefinition ( node , config ) ) {
28+ if ( ! shouldIncludeTypeDefinition ( node . name . value , config ) ) {
2929 return "" ;
3030 }
3131 const annotations = buildAnnotations ( {
You can’t perform that action at this time.
0 commit comments