Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playground settings can only be &str #583

Closed
tim-maddison-rnf opened this issue Jul 22, 2021 · 1 comment · Fixed by #584
Closed

Playground settings can only be &str #583

tim-maddison-rnf opened this issue Jul 22, 2021 · 1 comment · Fixed by #584
Labels
bug Something isn't working

Comments

@tim-maddison-rnf
Copy link

Expected Behavior

Playground settings should be able to accept any JSON type (although maybe not Object or Array?).

Actual Behavior

with_setting can only accept a &str for the value, so any values passed are serialised into a JSON string. These then stay as a string while being inserted into the playground settings.

playground_source(
      GraphQLPlaygroundConfig::new("/admin/api/graphql")
          .with_setting("schema.polling.enable", "false"),
)

image

Specifications

  • Version: 2.9.9
  • Platform: Linux

I think this could be solved by changing GraphQLPlaygroundConfig's settings Hashmap into Hashmap<&'str, Value> and then changing with_setting to accept a Value.

I'd be happy to put a PR together for this, let me know if you think this is viable.

@tim-maddison-rnf tim-maddison-rnf added the bug Something isn't working label Jul 22, 2021
@sunli829
Copy link
Collaborator

Good idea,welcome to PR.👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants