tailcallhq / tailcall

High Performance GraphQL Runtime
https://tailcall.run
Apache License 2.0
1.26k stars 237 forks source link

[draft] bug: `[Int]!` Validation Works for List but `[Int!]` Validation Fails for Inner Elements #2549

Closed laststylebender14 closed 5 days ago

laststylebender14 commented 1 month ago

Current Behaviour:

The [Int]! validation works as expected, ensuring the list is non-null and allowing nullable items within it. The [Int!] validation does not enforce the non-null constraint on the elements within the list, allowing null values.

Expected behaviour:

Validation should enforce that:

For [Int]!, the list must be non-null, and its elements can be nullable. For [Int!], the list can be null but list is present then all elements within the list must be non-null.

laststylebender14 commented 1 month ago

use following test case to reproduce the issue.

schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") {
  query: Query
}

union SearchResult = User | Post

type Query {
  foo: [Foo]! @http(path: "/foos")
  fooInner: [Foo!] @http(path: "/foos-inner")
}

type Foo {
  id: Int
}
- request:
    method: GET
    url: http://jsonplaceholder.typicode.com/foos
  response:
    status: 200
    body: null

- request:
    method: GET
    url: http://jsonplaceholder.typicode.com/foos-inner
  response:
    status: 200
    body: [null, null]
- method: POST
  url: http://localhost:8080/graphql
  body:
    query: >
      query {
        foo {
            id
        }
      }

- method: POST
  url: http://localhost:8080/graphql
  body:
    query: >
      query {
        fooInner {
            id
        }
      }
github-actions[bot] commented 1 week ago

Action required: Issue inactive for 30 days. Status update or closure in 7 days.

github-actions[bot] commented 5 days ago

Issue closed after 7 days of inactivity.