Skip to content

Add GraphQL ID scalar and built-in name collision warning#69

Open
FionaBronwen wants to merge 2 commits intofionabronwen/graphql-mutation-engine-v2from
fionabronwen/graphql-scalar-id
Open

Add GraphQL ID scalar and built-in name collision warning#69
FionaBronwen wants to merge 2 commits intofionabronwen/graphql-mutation-engine-v2from
fionabronwen/graphql-scalar-id

Conversation

@FionaBronwen
Copy link

Summary

  • Add scalar ID extends string to the GraphQL library (lib/scalars.tsp), giving users a blessed way to express GraphQL's built-in ID type in TypeSpec (e.g., id: GraphQL.ID)
  • Teach the scalar mutation to recognize GraphQL.ID (and scalars extending it) as a built-in — rename to ID and strip
    baseScalar, so it emits as GraphQL's native ID type rather than a custom scalar definition
  • Warn when a user-defined scalar's sanitized name collides with any of the 5 GraphQL built-in scalar names (String,
    Int, Float, Boolean, ID)

Test plan

Added the following new tests:

  • Scalar extending GraphQL.ID is renamed to built-in ID
  • Multi-hop extends chain (SubId extends MyId extends GraphQL.ID) resolves to built-in ID
  • User-defined scalar Float extends string emits graphql-builtin-scalar-collision warning

All 106 existing + new tests pass

@FionaBronwen FionaBronwen marked this pull request as ready for review March 11, 2026 16:32
@FionaBronwen FionaBronwen removed the request for review from swatkatz March 11, 2026 16:32
@FionaBronwen FionaBronwen force-pushed the fionabronwen/graphql-mutation-engine-v2 branch from 70e7589 to 84b7764 Compare March 13, 2026 18:53
@FionaBronwen FionaBronwen force-pushed the fionabronwen/graphql-scalar-id branch from 82569eb to 621c9a7 Compare March 13, 2026 18:55
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.

1 participant