-
Notifications
You must be signed in to change notification settings - Fork 98
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
Make the "smallest working example" actually work, see #553 #663
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #663 +/- ##
============================================
- Coverage 95.72% 95.29% -0.44%
- Complexity 1773 1818 +45
============================================
Files 154 171 +17
Lines 4586 4841 +255
============================================
+ Hits 4390 4613 +223
- Misses 196 228 +32 ☔ View full report in Codecov by Sentry. |
…ne#553 This example had implicit-and-undocumented dependencies on composer.json, and explicit-but-unexplained dependencies on "a container" and "a cache", leaving the installation and configuring of these as an exercise to the reader. I have changed it so that the example code can be copy-pasted verbatim, and the user will end up with an example which runs, which I find much easier to learn from :) I'm still not actually sure if I'm doing this correctly, because thecodingmachine#553 mentioned loading classes via the PSR-4 autoloader, and I found that it only worked when I manually listed out my controller classes inside the PSR-11 container, but it works...
} | ||
}, | ||
"require": { | ||
"thecodingmachine/graphqlite": "^6", |
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.
I think we can use an asterisk, *
for the version here. We're now at 7.0 - no need to specify.
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.
Gah, when I upgrade to 7.0, this "working example" stops working again :(
6.2
$ curl -X POST -d '{"query":"{ hello(name: \"World\") }"}' -H "Content-Type: application/json" http://localhost:8080
{"data":{"hello":"Hello World"}}
7.0
$ curl -X POST -d '{"query":"{ hello(name: \"World\") }"}' -H "Content-Type: application/json" http://localhost:8080
{"errors":[{"message":"Cannot query field \"hello\" on type \"Query\".","locations":[{"line":1,"column":3}]}]}%
(I do wonder if it'd be worth having example code as actual code (either in an "examples" folder, or a "graphqlite-examples" respository), rather than random code snippets inside a markdown text file -- that way we can use eg github actions to run the code and ensure that it both works and stays working 🤔 ) |
Let's update this PR such that the docs direct the reader to the examples, instead of maintaining any code here. |
@shish ^^ |
Make the "smallest working example" actually work, see #553
This example had implicit-and-undocumented dependencies on composer.json, and explicit-but-unexplained dependencies on "a container" and "a cache", leaving the installation and configuring of these as an exercise to the reader. I have changed it so that the example code can be copy-pasted verbatim, and the user will end up with an example which runs, which I find much easier to learn from :)
I'm still not actually sure if I'm doing this correctly, because #553 mentioned loading classes via the PSR-4 autoloader, and I found that it only worked when I manually listed out my controller classes inside the PSR-11 container, but it works...