-
Notifications
You must be signed in to change notification settings - Fork 261
Closed
Labels
Description
Discussed in #2466
Originally posted by angristan July 19, 2024
With this example:
schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") {
query: Query
}
type Query {
users: [User] @http(path: "/users")
}
type User {
id: Int!
name: String!
username: String!
email: String!
authorID: String
posts: [Post]
@http(
path: "/posts"
query: [{ key: "author_ids[]", value: "{{.value.authorID}}" }]
batchKey: ["author_ids[]"]
)
}
type Post {
id: Int!
title: String!
body: String!
}If authorID is not nil, it works as expected, however if it is nil, it calls /posts without any query param, thus returning unrelated posts.
Expected url
https://jsonplaceholder.typicode.com/posts?userId=
Actual url
https://jsonplaceholder.typicode.com/posts
By default this should be the behaviour
angristan