Skip to content

Commit

Permalink
The AST node won't get fixed unless a field mapper is specified (#174)
Browse files Browse the repository at this point in the history
Co-authored-by: Neeraj Joseph <njoseph@poppulo.com>
  • Loading branch information
joseph-neeraj and njoseph-poppulo committed Dec 2, 2022
1 parent 5169495 commit 7b4485c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/smart-brooms-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@n1ru4l/graphql-public-schema-filter": patch
---

fixed bug where the ast node was left unchanged after filtering the schema
4 changes: 4 additions & 0 deletions src/public-schema-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
DirectiveNode,
GraphQLFieldConfigArgumentMap,
isNonNullType,
GraphQLFieldConfig,
} from "graphql";
import { MapperKind, mapSchema } from "@graphql-tools/utils";
import { getWrappedType } from "./get-wrapped-type";
Expand Down Expand Up @@ -266,6 +267,9 @@ export const buildPublicSchema = (
config.fields = newFields;
return new GraphQLObjectType(config);
},
[MapperKind.OBJECT_FIELD]: (fieldConfig) => {
return fieldConfig;
},
[MapperKind.INPUT_OBJECT_TYPE]: (objectType) => {
const config = objectType.toConfig();
if (!publicTypeNames.has(config.name)) {
Expand Down

0 comments on commit 7b4485c

Please sign in to comment.