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
The @source directive does not have the correct type value for openapi source handler after namingConvention and rename transforms are applied. The value against the type field is the name of the type before the transforms are applied.
The issue here seems to be stemming from type merging that is happening due to the rename. Because the old type does not exist anymore, the source directive is referencing a non-existent type that has merged into another existing type.
To Reproduce Steps to reproduce the behavior:
Use openapi schema to consume a OpenAPI spec compliant schema with a field type of enum.
Apply namingConvention transform followed by rename transform on the Mesh generated enum type name.
Generate the schema using compose-cli and then run Hive locally against the generated schema.
Go to the suggested Hive endpoing (localhost:4000 in my case) and observe the error telling you that the type described in the @source directive cannot be found:
Error: Type mutation_update_masking_job_by_id_job_type for field MaskingJob.jobType is not defined in the schema
Expected behavior
Generated enum type after transforms
"""The type of the Masking job."""
enum MaskingJobType @source(name: "query_get_masking_execution_metrics_report_items_items_masking_job_type", subgraph: "apigw-services") @join__type(graph: APIGW_SERVICES) {
STANDARD @join__enumValue(graph: APIGW_SERVICES)
HYPERSCALE @join__enumValue(graph: APIGW_SERVICES)
}
Thanks for creating the issue with details and the PR for the fix.
But could you provide a reproduction on CodeSandbox or in a PR?
So we can debug together and help you to finish the PR.
Issue workflow progress
Progress of the issue based on the Contributor Workflow
Describe the bug The
@source
directive does not have the correcttype
value foropenapi
source handler afternamingConvention
andrename
transforms are applied. The value against thetype
field is the name of the type before the transforms are applied.The issue here seems to be stemming from type merging that is happening due to the rename. Because the old type does not exist anymore, the source directive is referencing a non-existent type that has merged into another existing type.
To Reproduce Steps to reproduce the behavior:
namingConvention
transform followed byrename
transform on the Mesh generated enum type name.compose-cli
and then run Hive locally against the generated schema.@source
directive cannot be found:Expected behavior
Generated enum type after transforms
Incorrect mapping field
Error on Hive page
Environment:
@graphql-mesh/compose-cli
: 1.1.0@graphql-hive/gatewat
: 1.1.0Additional context I see in the
@graphql-mesh/compose-cli
source code that there is a TODO relating to some transform application: https://github.com/ardatan/graphql-mesh/blob/d46d31b62abacf1fd6fed8e8ad900b29426a8a05/packages/compose-cli/src/getComposedSchemaFromConfig.ts#L130Maybe that is to blame?