Skip to content

New feature: schema can be passed pre-parsed to generate() function as GraphQLSchema#10601

Closed
ikusakov2 wants to merge 39 commits intodotansimha:master-nextfrom
ikusakov2:pass_parsed_schema_to_generate_cli
Closed

New feature: schema can be passed pre-parsed to generate() function as GraphQLSchema#10601
ikusakov2 wants to merge 39 commits intodotansimha:master-nextfrom
ikusakov2:pass_parsed_schema_to_generate_cli

Conversation

@ikusakov2
Copy link
Copy Markdown
Contributor

@ikusakov2 ikusakov2 commented Feb 23, 2026

Description

This PR allows GraphQLSchema to be passed directly to generate({schema: ...}) function.

Related # (issue)
#10591

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit testing

eddeee888 and others added 30 commits January 20, 2026 21:08
…#10504)

* Create standalone test

* Add Exact and set up test

* Remove Exact from typescript plugin

* Update tests that switch out Exact

* Update dev tests

* Add changeset

* Update test

* Add InputMaybe Scalars tests

* Fix schema in test

* Fix up examples tests

* Add result enum example
* [typescript-operations] Remove generation of InputMaybe and Scalars for variables

* Adding support for `config.scalars`, fixing intergation tests

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
…ring and getNodeComment to `visitor-plugin-common` (dotansimha#10520)

* Extract convertSchemaEnumToDeclarationBlockString and getNodeComment to visitor-plugin-common to re-use in next major version

* Create major breaking changeset for @graphql-codegen/visitor-plugin-common

* Fix naming

* Replace buildEnumValuesBlock method in base-types-visitor with a utility version

* Fix changeset

* Fix import path

* Fix getNodeComment import issue by moving to utils.ts
…les (dotansimha#10508)

* Collect used enums

* Use enum converter for Enum

* Add changeset

* Add doc

* Update dev tests

* Fix return type issue
…logic for standalone approach (dotansimha#10525)

* Add tests for enum

* Baselin tests

* Ensure correctness of enumValues import

* Split enum tests

* Abstract import printing functions

* Add missing enum tests

* Format to minimise conflict

* Add changeset
…ned+used input/enum types externally (dotansimha#10534)

* Draft importSchemaTypesFrom

* Minor test fixes

* Fix test name

* Update dev-tests

* Baseline dev-test for importSchemaTypesFrom

* Implement relative import paths correctly

* Update tests to handle outputDir correctly

* Add test for absolute importSchemaTypesFrom

* Remove unncessary files

* Add test about unused things

* Remove comment

* Add comments

* Add changeset
…tions with client preset (dotansimha#10540)

* Do not use typescript and its config in Client Preset

* Fix issue where enumValues are imported even if not used

* Split enum tests for client preset

* Update unit tests

* Update examples

* Generate Incremental utilty type

* Add changeset

* Rebase tests (with errors)
… conditional (dotansimha#10548)

* Fix types issues and put comments

* Handle avoidOptionals

* Update integration tests

* Add FIXME to pass test for now

* Add changeset
)

* input types, input/output enums are generated to the target files

* cleanup

* better code

* more tests

* cleanup

* better code

* better tests

* bugfixing for inner types and outer enums

* bugfixing after merge

* cleanup

* cleanup

* fix snapshots

* fix type errors in presets/client

* updated tests/examples

* Add standalone.input.spec.ts and update standalone tests to TDD

* Update operations/visitor.ts to satisfy tests

* Revert Client Preset changes

* Add oneOf directive for GraphQL 15

* Update changeset

* Refactor IIFE

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
Co-authored-by: Eddy Nguyen <github@eddeee888.me>
…otansimha#10552)

* Fix typename optionality and existence at Result root and types

* Update tests

* Update tests

* Stop allowing skipTypename into Client Preset and typescript-operations, and update tests

* Remove dependency on typescript plugin

* Add changeset
… on `typescript` plugin (`preResolveTypes: false`) (dotansimha#10556)

* Remove legacy selection set proccessor that depends on typescript plugin

* Remove obsolete tests

* Improve tests to be explicit
…nsimha#10560)

* Refactor utility function to match practice

* Fix config option inheritance

- addTypename/skipTypename: is only a types-visitor concern. This is moved to types-visitor from base-visitor
- nonOptionalTypename: is a documents-visitor and types-visitor concern. Moved from base-visitor there
- extractAllFieldsToTypes: is a documents-visitor concern. Moved from base-visitor there
- enumPrefix and enumSuffix: need to be in base-visitor as all 3 types of visitors need this to correctly sync the enum type names. This is moved to base visitor
- ignoreEnumValuesFromSchema: is a documents-visitor and types-visitor concern. Moved from base-visitor there.
- globalNamespace: is a documents-visitor concern. Moved from base-visitor there

Other changes:
- documents-visitor no longer extends types-visitor _option types_ as they have two distinct usages now. The types now extend base-visitor types. This is now consistent with documents-visitor extending base-visitor
- Classes now handle config parsing and types at the same level e.g. if typescript-operations plugin parses configOne, then the types for configOne must be in that class, rather than in base-documents-visitor

* Remove references and tests related to skipTypename in operations plugin

* Add changeset
* Fix missing dep

* chore(dependencies): updated changesets for modified dependencies

* Fix dev-tests

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Remove MakeOptional MakeMaybe MakeEmpty and Incremental utitlity types from typescript plugin because they were used for typescript-operations

* Fix unit tests

* Remove deprecated functions

* Add changeset
…lo-tooling), v2 (dotansimha#10568)

* add extractAllFieldsToTypesCompact config option

* adding changeset

* fixing duplication bug

* duplication bug fix

---------

Co-authored-by: Igor Kusakov <igor@kusakov.com>
…nsimha#10571)

* Remove extraneous test setup

* Do not generate Exact utility type of not used

* Add default test case to check that Exact is used for Mutation and Subscription variables

* Update dev-tests

* Add changeset

* Remove extraneous config for Exact test
…0566)

* Make default scalar unknown, instead of any

* Set up defaultScalarType tests

* Add changeset

* Revert unrelated null | undefined changes

* Fix test description

* Add a test case for custom scalar in dev-test
…ansimha#10572)

* Decouple TypeScriptOperationVariablesToObject from typescript plugin

* Add changeset

* Remove typescript plugin dep

* chore(dependencies): updated changesets for modified dependencies

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…types (dotansimha#10573)

* Shuffle methods to group things together, cleanup

* Wire up _inputMaybeValue and organise config

* Wire up inputMaybeValue

* Add inputMaybeValue test

* Update tests

* Add changeset
…en types are `any` and `unknown` (dotansimha#10574)

* Use printTypeScriptType to handle printing typescript types consistently, especially for any and unknown

* Update tests

* Add changeset

* Make printTypeScriptMaybeType scope smaller

* Update tests
…TypesFrom` (dotansimha#10575)

* Fix importing issue when using importSchemaTypesFrom

* Add dev-tests for usage with typescript plugin

* Update unit test

* Add changeset
ikusakov2 and others added 8 commits January 20, 2026 21:08
…perations (dotansimha#10565)

* integration test

* cleanups

* cleanups2

* fixed a bug with external fragments

* cleanup

* keep generated files, refactored visitorwq

* cleanup

* changeset

* adding missing dependency

* delete temporary files

* cleanup

* cleanups

* Adding back the integration tests + fix them

* merged + fixes

* cleanup

* cleanup

* patching near-operation-file preset

* cleanup

* adding duplicates case to integration tests

* Fixing bug with duplicates generated when using extractAllFieldsToTypesCompact

* cleanup

* prevent running prettier on generated code

* cleanups

* cleanup

* adding unit tests

* update changeset

* cleanups

* try resolving graphql 16 error

* remove unused deps

* remove unused deps

* cleanups

* Revert and apply minimal yarn.lock changes

---------

Co-authored-by: ikusakov <ikusakov@gxnfgqk426.y.yelp>
Co-authored-by: Igor Kusakov <igor@kusakov.com>
Co-authored-by: Eddy Nguyen <github@eddeee888.me>
Co-authored-by: Eddy Nguyen <ch@eddeee888.me>
* Enable TS test

* Add missing test for globalNamespace

* Ensure dev-test-apollo-tooling is private
…ject`, `inputValue` and `defaultValue` (+ minor drive-by fixes) (dotansimha#10579)

* Trim down avoidOptionals for client use case

* Add changeset

* Correctly ignore dev-test from changeset
…nals.variableValue` to better reflect the target (dotansimha#10582)

* Rename avoidOptionals.object -> avoidOptionals.variableValue to better reflect the target. Add tests.

* Add default input use cases
…ted (dotansimha#10584)

* Rename scalar test

* Refactor to move position of getEnumsImports to group methods

* Implement handling of external scalars

* Add (wrong) import scalar tests to work against

* Fix importing types wrongly count Scalar as part of types generated into shared type file

* Do not generate scalar imports if not needed

* Add changeset

* Cleanup

* Fix granularity of operation-file
Co-authored-by: Igor Kusakov <igor@kusakov.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 23, 2026

⚠️ No Changeset found

Latest commit: 86601c6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

}
return jsObjectIds.get(schema)!;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am hesitating - maybe put the jsObjectIds, jsObjectIdCounter and getJsObjectId outside this function - to the root level?

@eddeee888 eddeee888 force-pushed the master-next branch 2 times, most recently from 5d5df4a to 236c377 Compare March 3, 2026 12:52
@ikusakov2 ikusakov2 closed this Mar 5, 2026
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.

3 participants