Skip to content

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

Merged

Conversation

aarestu
Copy link
Contributor

@aarestu aarestu commented Sep 25, 2019

📝 Description

  1. Make initialize project more simple by making playground service by default include in module graphql-kotlin-spring-server
  2. Make service playground be adjustable can be [enable/disable] and where endpoint service will use

@codecov-io
Copy link

codecov-io commented Sep 25, 2019

Codecov Report

Merging #377 into master will increase coverage by 1.84%.
The diff coverage is 83.33%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...iagroup/graphql/spring/GraphQLAutoConfiguration.kt 87.5% <ø> (ø) 6 <0> (ø) ⬇️
...p/graphql/spring/GraphQLConfigurationProperties.kt 100% <100%> (ø) 3 <0> (ø) ⬇️
...roup/graphql/spring/PlaygroundAutoConfiguration.kt 75% <75%> (ø) 2 <2> (?)
.../expediagroup/graphql/generator/SchemaGenerator.kt 100% <0%> (ø) 23% <0%> (ø) ⬇️
...group/graphql/exceptions/InvalidSchemaException.kt
.../extensions/GraphQLDirectiveContainerExtensions.kt 100% <0%> (ø) 0% <0%> (?)
...graphql/federation/validation/validateDirective.kt 90.9% <0%> (ø) 0% <0%> (?)
...aphql/federation/validation/validateKeySetField.kt 100% <0%> (ø) 0% <0%> (?)
...federation/validation/validateProvidesDirective.kt 100% <0%> (ø) 0% <0%> (?)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f2214c...e812918. Read the comment docs.


playground:
enabled: true
endpoint: "/"
Copy link
Contributor

@smyrick smyrick Sep 25, 2019

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'
})

Copy link
Contributor

@smyrick smyrick Sep 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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

Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright @dariuszkuc
wait

Copy link
Contributor Author

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"

Copy link
Collaborator

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)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright then.
oke wait

@smyrick smyrick added changes: patch Changes require a patch version type: enhancement New feature or request labels Sep 25, 2019
@dariuszkuc
Copy link
Collaborator

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.

@aarestu
Copy link
Contributor Author

aarestu commented Sep 26, 2019

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()
Copy link
Collaborator

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

Copy link
Contributor Author

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

* Play ground configuration properties.
*/
class PlayGroundConfigurationProperties {
/** playground service endpoint, defaults to '/' */
Copy link
Collaborator

@dariuszkuc dariuszkuc Sep 26, 2019

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 "/"

@aarestu
Copy link
Contributor Author

aarestu commented Sep 26, 2019

wait The Travis CI was failed what happened?
@dariuszkuc @smyrick

travis CI can't found file inside:
graphql-kotlin-spring-server-1.0.0-RC11-SNAPSHOT.jar!/graphql-playground.html

@dariuszkuc dariuszkuc changed the title [Proposal] Playground service include Playground IDE in graphql-kotlin-spring-server Sep 26, 2019
@dariuszkuc dariuszkuc merged commit b02bc91 into ExpediaGroup:master Sep 26, 2019
@aarestu aarestu deleted the feature/auto-config-playground-route branch September 26, 2019 15:30
dariuszkuc pushed a commit to dariuszkuc/graphql-kotlin that referenced this pull request Aug 5, 2022
)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes: patch Changes require a patch version type: enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

4 participants