Skip to content

Conversation

n1ru4l
Copy link
Collaborator

@n1ru4l n1ru4l commented May 23, 2023

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented May 23, 2023

🦋 Changeset detected

Latest commit: 4fc325f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 26 packages
Name Type
@graphql-tools/utils Patch
@graphql-tools/executor Patch
@graphql-tools/graphql-tag-pluck Patch
@graphql-tools/import Patch
@graphql-tools/links Patch
@graphql-tools/load Patch
@graphql-tools/merge Patch
@graphql-tools/mock Patch
@graphql-tools/node-require Patch
@graphql-tools/relay-operation-optimizer Patch
@graphql-tools/resolvers-composition Patch
@graphql-tools/schema Patch
@graphql-tools/apollo-engine-loader Patch
@graphql-tools/code-file-loader Patch
@graphql-tools/git-loader Patch
@graphql-tools/github-loader Patch
@graphql-tools/graphql-file-loader Patch
@graphql-tools/json-file-loader Patch
@graphql-tools/module-loader Patch
@graphql-tools/url-loader Patch
@graphql-tools/executor-apollo-link Patch
@graphql-tools/executor-envelop Patch
@graphql-tools/executor-legacy-ws Patch
@graphql-tools/executor-urql-exchange Patch
@graphql-tools/executor-yoga Patch
graphql-tools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

✅ Benchmark Results

     ✓ no_errors
     ✓ expected_result

     checks.........................: 100.00% ✓ 200     ✗ 0  
     data_received..................: 23 MB   2.3 MB/s
     data_sent......................: 86 kB   8.5 kB/s
     http_req_blocked...............: avg=16.5µs   min=2.6µs   med=3.9µs   max=1.24ms   p(90)=4.8µs    p(95)=5.2µs   
     http_req_connecting............: avg=11.86µs  min=0s      med=0s      max=1.18ms   p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=94.52ms  min=76.73ms med=89.31ms max=214.59ms p(90)=127.59ms p(95)=141.41ms
       { expected_response:true }...: avg=94.52ms  min=76.73ms med=89.31ms max=214.59ms p(90)=127.59ms p(95)=141.41ms
     http_req_failed................: 0.00%   ✓ 0       ✗ 100
     http_req_receiving.............: avg=223µs    min=146.6µs med=189.9µs max=426.5µs  p(90)=321.42µs p(95)=337.53µs
     http_req_sending...............: avg=140.99µs min=18.7µs  med=27.45µs max=3.9ms    p(90)=39.2µs   p(95)=647.81µs
     http_req_tls_handshaking.......: avg=0s       min=0s      med=0s      max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=94.16ms  min=76.39ms med=89.03ms max=214.14ms p(90)=127.37ms p(95)=141.21ms
     http_reqs......................: 100     9.95965/s
     iteration_duration.............: avg=100.32ms min=81.69ms med=94.6ms  max=221.09ms p(90)=132.48ms p(95)=146.29ms
     iterations.....................: 100     9.95965/s
     vus............................: 1       min=1     max=1
     vus_max........................: 1       min=1     max=1

@github-actions
Copy link
Contributor

github-actions bot commented May 23, 2023

💻 Website Preview

The latest changes are available as preview in: https://pr-5294.graphql-tools.pages.dev

Copy link
Contributor

coderabbitai bot commented Sep 24, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Built-in GraphQL scalar types are no longer mapped during schema transforms, preventing unintended changes to scalars like Boolean, String, Int, Float, and ID.
    • Ensures schema mapping skips specified scalars while continuing to process custom scalars and other types as before.
  • Tests

    • Added a test to verify scalar type handling during schema mapping.

Walkthrough

Patch updates utils mapSchema behavior to avoid mapping GraphQL built-in scalars. Imports adjusted to use specifiedScalarTypes. mapTypes now exempts built-in scalars from testFn-driven mapping. A new test covers scalar-type mapping. A changeset adds a patch note for @graphql-tools/utils.

Changes

Cohort / File(s) Summary
Release metadata
\.changeset/social-pots-grab.md
Adds patch changeset: note “Do not map builtin scalars” for @graphql-tools/utils.
Utils: schema mapping logic
packages/utils/src/mapSchema.ts
Imports GraphQLScalarType, specifiedScalarTypes; updates mapTypes to skip mapping for built-in scalars by exempting them from testFn filtering. No API signature changes.
Tests: mapSchema
packages/utils/tests/mapSchema.test.ts
Adds test "map scalar type" creating a Boolean scalar mapping via MapperKind.SCALAR_TYPE; validates mapping path without assertions on behavior change.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Caller
  participant MS as mapSchema
  participant MT as mapTypes
  participant TF as testFn
  participant ST as specifiedScalarTypes

  C->>MS: invoke mapSchema(schema, mapper)
  MS->>MT: iterate types with mapper
  MT->>TF: evaluate type against testFn
  note right of TF: New behavior: built-in scalars are exempt
  MT->>ST: is type in specifiedScalarTypes?
  alt Built-in scalar
    MT-->>MS: return original type (unchanged)
  else Non-builtin and testFn passes
    MT-->>MS: apply mapper transformation
  else Non-builtin and testFn fails
    MT-->>MS: skip/leave unchanged per existing logic
  end
  MS-->>C: return mapped schema
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I hop through types, so bright, so clear,
Skipping built-ins—no nibbling here!
Booleans bask, unchanged, serene,
While custom scalars preen and preen.
Patch-day breeze, a gentle tune—
Mapper’s steps now in rune.
Thump-thump! Shipped by noon. 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch map-scalar-name

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a6251d and 4fc325f.

📒 Files selected for processing (3)
  • .changeset/social-pots-grab.md (1 hunks)
  • packages/utils/src/mapSchema.ts (3 hunks)
  • packages/utils/tests/mapSchema.test.ts (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ardatan ardatan changed the title map scalars fix(utils/mapSchema): do not map builtin scalars Sep 24, 2025
@ardatan ardatan merged commit 3b99a9b into master Sep 24, 2025
9 of 16 checks passed
@ardatan ardatan deleted the map-scalar-name branch September 24, 2025 15:32
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.

2 participants