-
Notifications
You must be signed in to change notification settings - Fork 362
include Playground IDE in graphql-kotlin-spring-server #377
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
include Playground IDE in graphql-kotlin-spring-server #377
Conversation
Codecov Report
@@ Coverage Diff @@
## master #377 +/- ##
============================================
+ Coverage 95.76% 97.61% +1.84%
+ Complexity 347 318 -29
============================================
Files 98 104 +6
Lines 1205 1215 +10
Branches 213 198 -15
============================================
+ Hits 1154 1186 +32
+ Misses 11 9 -2
+ Partials 40 20 -20
Continue to review full report at Codecov.
|
|
||
playground: | ||
enabled: true | ||
endpoint: "/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would also need to set the urls in the Playground html file. Not sure how we do this dynamically the best way
GraphQLPlayground.init(document.getElementById('root'), { | |
endpoint: '/graphql', | |
subscriptionEndpoint: '/subscriptions' | |
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh graphql-spqr
solves this issue like so. If we added that I think we can merge this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smyrick
Ahh, sorry I forgot to add that.
copy -> paste -> done :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets change the default to /playground
to avoid potential conflicts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright @dariuszkuc
wait
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now implementing (in progress) Graphql and Altair.. should I merge with this branch..
@dariuszkuc @smyrick
graphql:
ide:
- playground:
enabled: true
endpoin: "/playground"
- graphiql:
enabled: true
endpoin: "/graphiql"
- altair:
enabled: true
endpoin: "/altair"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for graphiql
or altair
. Lets be opinionated and include just playground
. Can you fix the Javadocs on the PlaygroundConfigurationProperties
(currently javadoc is specified on enabled
instead of endpoint
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright then.
oke wait
While Prisma GraphQL Playground is indeed very useful it is not required to start a valid GraphQL server. There are also a number of other IDEs that could be preferred to use instead such as GraphiQL or Altair. Therefore I am not sure whether we should be including it. |
hmmm, do we need to make separate module like SPQR do for this? |
fun playGroundRoute() = coRouter { | ||
GET(config.playground.endpoint) { | ||
ok().html().bodyAndAwait( | ||
playgroundHtml.file.readText() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are to do this then this should be done only once and not on every route hit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh I understand, wait I can solve this
graphql-kotlin-spring-server/src/main/resources/graphql-playground.html
Outdated
Show resolved
Hide resolved
...ing-server/src/main/kotlin/com/expediagroup/graphql/spring/GraphQLConfigurationProperties.kt
Outdated
Show resolved
Hide resolved
...spring-server/src/main/kotlin/com/expediagroup/graphql/spring/PlaygroundAutoConfiguration.kt
Outdated
Show resolved
Hide resolved
* Play ground configuration properties. | ||
*/ | ||
class PlayGroundConfigurationProperties { | ||
/** playground service endpoint, defaults to '/' */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment should be on endpoint
I believe. Let's make it explicit -> Prisma Labs Playground GraphQL IDE endpoint, defaults to "/"
wait travis CI can't found file inside: |
and return coRouter from inside reader
) Include [Prisma Labs Playground IDE](https://github.com/prisma-labs/graphql-playground) in `graphql-kotlin-spring-server` auto-configuration library. By default, playground will be enabled under `/playground` route. You can disable it by specifying `graphql.playground.enabled=false` property. Similarly default endpoint can be changed by setting new value to the `graphql.playground.endpoint` property.
📝 Description
graphql-kotlin-spring-server