Skip to content

feat(allowlist): add GraphQL (.graphql/.gql) support#491

Merged
lizhengfeng101 merged 2 commits into
alibaba:mainfrom
chethanuk:fix/issue-488-featallowlist-add-graphql-support
Jul 24, 2026
Merged

feat(allowlist): add GraphQL (.graphql/.gql) support#491
lizhengfeng101 merged 2 commits into
alibaba:mainfrom
chethanuk:fix/issue-488-featallowlist-add-graphql-support

Conversation

@chethanuk

Copy link
Copy Markdown
Contributor

Summary

Adds GraphQL support as a language-group contribution under tracking issue #470 / sub-issue #488.

.graphql and .gql files were skipped by both review paths because they were missing from the extension allowlist. This PR:

  1. Allows .graphql / .gql (case-insensitive) via supported_file_types.json
  2. Maps **/*.{graphql,gql} → a dedicated graphql.md rule doc (schema-first and query/client focus)
  3. Adds table-driven unit tests for allowlist + rule resolution

No Go production logic changes. No exclude patterns (GraphQL has no standard test-file convention per #470 / issue discussion).

Why

diff / scan path
  → user include/exclude
  → allowedext.IsAllowedExt(ext)   ← .graphql/.gql returned false → ExcludeExtension
  → SystemRule.Resolve             ← unmapped → default.md

After this PR:

api/schema.graphql / queries/user.gql
  → IsAllowedExt = true
  → Resolve(**/*.{graphql,gql}) → rule_docs/graphql.md  (Breaking Changes + ops sections)

Changes

File Change
internal/config/allowlist/supported_file_types.json append .graphql, .gql
internal/config/allowlist/allowed_ext_test.go case-insensitive allowlist cases
internal/config/rules/system_rules.json "**/*.{graphql,gql}": "graphql.md"
internal/config/rules/rule_docs/graphql.md new — schema evolution, naming, SDL design, operations, security
internal/config/rules/system_rules_test.go Resolve cases for .graphql / .gql

Rule doc focus

  • Schema evolution / breaking changes (nullability, required args, deprecation reasons)
  • Naming conventions (graphql-eslint aligned)
  • Schema-first SDL pitfalls (pagination/limit on lists, unreachable types)
  • Query/client operations (deprecated fields, fragment cycles, depth in operation text)
  • Security only when observable in the reviewed schema/operation file

Test plan

  • RED unit tests first, then GREEN config
  • go test ./internal/config/allowlist/ ./internal/config/rules/
  • make test
  • make check
  • grep -l "Breaking Changes" rule_docs/* → only graphql.md

Out of scope

Closes #488
Part of #470

…a#488)

Add .graphql/.gql allowlist rows and .graphql/.gql rule-resolution rows
asserting a GraphQL rule doc, both RED before the config lands.
Allow .graphql and .gql through the extension allowlist and map them to a
dedicated GraphQL review rule covering schema evolution, breaking changes,
naming, and schema-visible resource limits.

Part of alibaba#470.
@github-actions

Copy link
Copy Markdown
Contributor

OpenCodeReview: No comments generated. Looks good to me.

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lizhengfeng101
lizhengfeng101 merged commit 483e1b2 into alibaba:main Jul 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(allowlist): add GraphQL support

2 participants