magento / graphql-ce

[ARCHIVED] Please use magento/magento2 project
https://github.com/magento/magento2
Open Software License 3.0
131 stars 156 forks source link

#783 graphql playground integration #992

Closed dani97 closed 4 years ago

dani97 commented 5 years ago

Graphql Playground integration with magento 2. Accessible in default mode and developer mode.

Description (*)

  1. Graphql Playground integration with magento 2.
  2. Created a route with id graphiql (please suggest a better url, I couldn't think of better one)
  3. Accessible in default mode and developer mode as {BASE_URL/graphql} in modern browsers. In production mode, redirection to 404 page.
  4. Removed all default magento styles from the page.
  5. Implemented as independent module like swagger so can be removed or disabled in production.

Fixed Issues (if relevant)

  1. magento/graphql-ce#783: Integrate GraphQL Playground

Manual testing scenarios (*)

  1. In developer or default mode access {BASE_URL}/graphiql
  2. In Production mode same url will be redirected to 404 page.

Screenshot from 2019-10-08 20-24-16

Questions or comments

Contribution checklist (*)

dani97 commented 5 years ago

No idea how to fix the failing composer.json test.

TomashKhamlai commented 5 years ago

Hi, @dani97. May I perform manual functional testing now or it is still work in progress?

dani97 commented 5 years ago

@TomashKhamlai I have been fixing static tests failure. They are code style issues. I can hold on when you are testing. Thank you.

dani97 commented 5 years ago

@TomashKhamlai only composer static tests are failing with latest build, you can continue testing.

dani97 commented 5 years ago

@TomashKhamlai please update when you are done with manual testing, I will then update my PR for failing static tests. :)

TomashKhamlai commented 5 years ago

image Please, advise something.

I checked out your PR by id and switched to production mode in order to verify that schema is loading. Then I run

rm composer.lock && composer install php bin/magento setup:upgrade rm -rf var/ generated/ pub/static/* php bin/magento dep:mo:set developer php bin/magento s:d:c

dani97 commented 5 years ago

@TomashKhamlai can you check a js file and css loading from cdn.jsdelivr.net.

TomashKhamlai commented 5 years ago

image

TomashKhamlai commented 5 years ago

Please try doing this:

rm -rf var/* pub/static/*
php bin/magento setup:sta:dep -f

and then check again.

dani97 commented 5 years ago

@TomashKhamlai all working great now. can you check again. I will hold fixing the failing bundle tests failure until you are done. Thanks

TomashKhamlai commented 5 years ago

Please fix this

Uncaught TypeError: require.config is not a function
    at graphiql:66
(anonymous) @ graphiql:66
TomashKhamlai commented 5 years ago

In general, it works as a standalone application even when I brake the schema. Keep in mind that when you take a task without the label ready for dev it can take a lot of time for maintainers to get to your PR. Please, be patient.

dani97 commented 5 years ago

@TomashKhamlai Thanks I will wait.

dani97 commented 5 years ago

Please fix this

Uncaught TypeError: require.config is not a function
    at graphiql:66
(anonymous) @ graphiql:66

I followed the same way where in swagger removed unwanted js modules for the models. The same error is thrown there too on removing requirejs.

TomashKhamlai commented 5 years ago

I suggest checking what happens if you keep require-config.js instead of removing). I think that you will have a more effective conversation with code reviewers. Good luck and thank you for your contribution!

lenaorobei commented 5 years ago

@paliarush we need you review here as well.

lenaorobei commented 5 years ago

@dani97 could you please pull latest 2.3-develop and address review comments?

dani97 commented 5 years ago

@dani97 could you please pull latest 2.3-develop and address review comments?

@lenaorobei I have fixed most of the comments.I could not find the unminified version from graphql playground, have to dig more to find how they transpiled and minified the react components, so I will add map file.

TomashKhamlai commented 5 years ago

@dani97, one little note. When built-in GraphQL Playground opens, I see the store header present in the location bar of the built-in client. image I ask to change it. The expected behavior is that the header is set in the "HEADERS" section at the bottom of the page and nowhere else. More about accepting GraphQL headers in Magento can be read in the Documentation: Send Request #request-headers

dani97 commented 5 years ago

@dani97, one little note. When built-in GraphQL Playground opens, I see the store header present in the location bar of the built-in client. image I ask to change it. The expected behavior is that the header is set in the "HEADERS" section at the bottom of the page and nowhere else. More about accepting GraphQL headers in Magento can be read in the Documentation: Send Request #request-headers

Thanks for pointing out. Fixed it @TomashKhamlai

chalov-anton commented 4 years ago

Each time I try to Execute (Ctrl+Enter)an empty query, a "Syntax Error GraphQL request (2:1) Unexpected \n\n1: # Write your query or mutation here\n2: \n ^\n" appears in Wed Browser Console empty query_graphql_console

dani97 commented 4 years ago

@chalov-anton It is not a issue I believe, also graphql playground has this same behavior out of the box.

chalov-anton commented 4 years ago

Considering the PR Description https://github.com/magento/graphql-ce/pull/992#issue-325814054 the Graphql Playground integration should not be accessible from Production mode But now it is prod_mode_integration (The browser cache has been cleaned)

lenaorobei commented 4 years ago

As per conversation with @dani97 we agreed to open a new PR to https://github.com/magento/magento2 repo.

@dani97 thanks for understanding and collaboration!

ghost commented 4 years ago

Hi @dani97, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.