ITADN

discriminator.mapping is always empty

#9095OpendimitriBouteille 创建于 2025-12-23
### Issue workflow progress <!-- PLEASE DO NOT REMOVE THIS SECTION --> _Progress of the issue based on the [Contributor Workflow](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md#a-typical-contributor-workflow)_ - [ ] 1. The issue provides a reproduction available on [Github](https://github.com/ardatan/graphql-mesh/tree/master/examples/hello-world), [Stackblitz](https://stackblitz.com/github/ardatan/graphql-mesh/tree/master/examples/hello-world) or [CodeSandbox](https://codesandbox.io/s/github/ardatan/graphql-mesh/tree/master/examples/hello-world) > Make sure to fork this template and run `yarn generate` in the terminal. > > Please make sure Mesh package versions under `package.json` matches yours. - [ ] 2. A failing test has been provided - [ ] 3. A local solution has been provided - [ ] 4. A pull request is pending review --- **Describe the bug** As described here https://github.com/ardatan/graphql-mesh/discussions/9088 , I try to use the discriminator to easily manage the `typename` in a union. I have well defined the properties `discriminator.propertyName` and `discriminator.mapping`, when I generate the schema, here is the result: ```graphql union Category @discriminator(subgraph: "UsersAPI", field: "template", mapping: []) @join__type(graph: USERS_API) @join__unionMember(graph: USERS_API, member: "CategoryCategoryRoot") @join__unionMember(graph: USERS_API, member: "CategoryDefault") @join__unionMember(graph: USERS_API, member: "CategoryCategoryListing") @join__unionMember(graph: USERS_API, member: "CategoryCategoryAtmosphere") @join__unionMember(graph: USERS_API, member: "CategoryCategorySuggestions") @join__unionMember(graph: USERS_API, member: "CategoryPillar") = CategoryCategoryRoot | CategoryDefault | CategoryCategoryListing | CategoryCategoryAtmosphere | CategoryCategorySuggestions | CategoryPillar ``` The `@discriminator` property is indeed present, but mapping is empty :( **To Reproduce** The bug is reproducible on the following repository: https://github.com/dimitriBouteille/mesh-discriminator **Expected behavior** The `discriminator.mapping` property must not be empty. **Environment:** - **@graphql-mesh/compose-cli** : 1.5.5 - **@omnigraph/json-schema** : 0.109.19
1 条评论