tailcall
tailcall copied to clipboard
[draft] bug: raise duplicate field name validation error when config generator json/yml has duplicate field name.
When using the Tailcall configuration generator with the following configuration:
{
"inputs": [
{
"curl": {
"src": "https://jsonplaceholder.typicode.com/posts",
"fieldName": "posts"
}
},
{
"curl": {
"src": "https://jsonplaceholder.typicode.com/todos",
"fieldName": "posts"
}
}
],
"output": {
"path": "./output.graphql",
"format": "graphQL"
},
"schema": {
"query": "Query"
}
}
The generated GraphQL schema is:
type Query {
posts: [T2] @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/todos")
}
Problem:
The issue is that both https://jsonplaceholder.typicode.com/posts and https://jsonplaceholder.typicode.com/todos use the same fieldName, resulting in only one field being present in the Query type. This causes the field for https://jsonplaceholder.typicode.com/posts to be overwritten by the field for https://jsonplaceholder.typicode.com/todos, leading to incorrect or incomplete schema representation.
Expected Behavior:
If the fieldName is duplicated within the configuration, a validation error should be raised. This will ensure that each field name is unique and prevent incorrect or incomplete schema generation.