list query & id query having same args
amal-chandran opened this issue · comments
What version of GraphJin are you using? graphjin version
GraphJin 3.0.14
For documentation, visit https://graphjin.com
Commit SHA-1 : 2b7394f
Commit timestamp : 2023-03-25T05:54:45Z
Go version : go1.19.7
Licensed under the Apache Public License 2.0
Copyright 2019 Vikram Rangnekar
Have you tried reproducing the issue with the latest release?
Yes
What is the hardware spec (RAM, OS)?
Operating System: KDE neon 5.27
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.8
Kernel Version: 5.19.0-38-generic (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 5800H with Radeon Graphics
Memory: 27.3 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: LENOVO
Product Name: 82K2
System Version: IdeaPad Gaming 3 15ACH6
Docker version 23.0.3, build 3e7cbfd
Docker Compose version v2.17.2
Steps to reproduce the issue (config used to run GraphJin).
Config: dev.yml
---
app_name: Backend Development
host_port: 0.0.0.0:8080
web_ui: true
log_level: info
log_format: plain
http_compress: true
server_timing: true
production: false
auth_fail_block: false
enable_tracing: true
reload_on_config_change: true
migrations_path: "./migrations"
secret_key: supercalifajalistics
cors_allowed_origins:
- "*"
cors_allowed_headers: []
cors_debug: false
subs_poll_duration: 2s
default_limit: 20
set_user_id: false
default_block: false
debug: false
hot_deploy: false
admin_secret_key: blahblah
auth:
type: none
cookie: _backend_session
rails:
version: 5.2
secret_key_base: 0a248500a64c01184edb4d7ad3a805488f8097ac761b76aaa6c17c01dcb7af03a2f18ba61b2868134b9c7b79a122bc0dadff4367414a2d173297bfea92be5566
database:
type: postgres
host: 172.17.0.1
port: 5432
dbname: backend_development
user: postgres
password: postgres
ping_timeout: 1m
enable_tls: false
variables:
admin_account_id: sql:select id from users where admin = true limit 1
header_variables:
remote_ip: X-Forwarded-For
blocklist:
- ar_internal_metadata
- schema_migrations
- secret
- password
- encrypted
- token
tables:
- name: me
table: users
- name: users
order_by:
new_users:
- created_at desc
- id asc
id:
- id asc
roles:
- name: user
tables:
- name: me
query:
filters:
- "{ id: { _eq: $user_id } }"
-
create a new project
graphjin new backend
-
spin up pg with
docker compose up -d
-
since api service was failing with
FATAL open /config/dev.yml: permission denied
-
updated dev.yml & point pg host to docker localhost
-
create db and seed
graphjin db create
&graphjin db migrate up
&graphjin db seed
-
spin up dev server
graphjin serve
-
open graphql editor in browser
http://localhost:8080/?endpoint=/api/v1/graphql
' -
issue: when we open the explore we can see both users & userByID both are having same args
Expected behavior and actual result.
- for the users we don't need ID, since we have the where close
- for userByID we only need ID as an argument which is mandatory
- even though the query without the mandatory ID works for listing
- since the introspected schema is not correct we cannot use it with https://www.graphql-code-generator.com/
Yes, id
is required on the ByID
query and the resulting value is always a json object. When you use the selector without ByID
then id
is optional and the resulting value is always a list. Since ByID
was added latter and is useful for folks auto-generating clients the old behaviour of an optional id
on the normal selector had to be maintained for backward compatiblity.