Describe the bug
Currently when providing the GraphQL parser with either multiple schemas or a directory containing multiple schemas, each schema is parsed in isolation, this is not the common behavior of GraphQL tools. Normally when multiple schemas are provided they are merged together before parsing, allowing cross references between types defined in different files. I believe this is the expected behavior here as well.
To Reproduce
We have a directory called schemas/
apples.graphql:
type Apple {
color: String!
}
applesplus.graphql:
extend type Apple {
taste: String!
}
Used commandline:
$ datamodel-codegen --input ./schemas --input-file-type graphql --output ./output
Current behavior
TypeError: Cannot extend type 'Apple' because it is not defined.
Expected behavior
We expect a single Apple model to be generated with both color and taste fields.
Version:
- OS: MacOS 26.2
- Python version: 3.13.9
- datamodel-code-generator version: 507c33f
Describe the bug
Currently when providing the GraphQL parser with either multiple schemas or a directory containing multiple schemas, each schema is parsed in isolation, this is not the common behavior of GraphQL tools. Normally when multiple schemas are provided they are merged together before parsing, allowing cross references between types defined in different files. I believe this is the expected behavior here as well.
To Reproduce
We have a directory called schemas/
apples.graphql:
applesplus.graphql:
Used commandline:
Current behavior
TypeError: Cannot extend type 'Apple' because it is not defined.Expected behavior
We expect a single
Applemodel to be generated with bothcolorandtastefields.Version: