Generate google.protobuf.FieldMask paths from a GraphQL resolve info object. Version 0.2.1 (as of early 2025), limited release history. Converts the requested GraphQL fields into a list of dot-notation paths that can be used with FieldMask. Supports custom field name mapping (e.g., camelCase to snake_case), custom scalars (e.g., Date fields expanded to day/month/year), extra dependent fields, and abstract types (e.g., oneof). Integrates with ProtoNexus for protobuf-aware GraphQL schemas. Requires GraphQL ^15.0.0 || ^16.0.0 as a peer dependency. Ships TypeScript definitions.
npm install graphql-field-maskNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to extract FieldMask paths from a GraphQL resolve info object and log them. Run with ts-node or similar.
Ensure the typeName matches the exact GraphQL type name (case-sensitive) of the resolving field.
Always return a string or string[] from getFieldName. Use null to exclude the field.
Return an empty array if no extra fields are needed. The library does not deduplicate paths.
Stay updated with the library's releases.
Ensure getFieldName always returns a string, array of strings, or null/undefined to skip the field. Check that the function handles all field cases.
Verify that you are using the function inside a GraphQL resolver with a valid info argument, and typeName matches the type's name exactly.
Run npm install graphql-field-mask (ensure graphql is also installed as a peer dependency).