-
Notifications
You must be signed in to change notification settings - Fork 29
Blog + Graphiti Rails #8
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="{{ page.lang | default: site.lang | default: "en" }}"> | ||
|
||
{% include head.html %} | ||
|
||
<body> | ||
<main class="page-content" aria-label="Content"> | ||
<div class="wrapper"> | ||
{% include header.html %} | ||
<div class="container"> | ||
<h1>{{ page.title }}</h1> | ||
{{ content }} | ||
</div> | ||
</div> | ||
</main> | ||
{% include footer.html %} | ||
{% include highlight.html %} | ||
</body> | ||
</html> | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
layout: blog | ||
author: Lee Richmond | ||
title: Graphiti 1.0 Released 🎉 | ||
--- | ||
|
||
This project has gone through a number of iterations over the past three years. I'm happy to say we've now released 1.0, committing to semantic versioning. Graphiti has now seen enough use, across a wide variety of scenarios, that we can commit to no backwards-incompatible changes for a long while, and a changelog for future releases. | ||
|
||
We'll be writing more in this blog about our future roadmap. Stay tuned! | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
layout: blog | ||
author: Lee Richmond | ||
title: Graphiti 1.1 Released | ||
--- | ||
|
||
Our first minor version bump centers around an important update: | ||
**better errors for clients**. This is the first phase of work to allow us to provide more actionable errors to API users who might not also be developers of the API itself. This was brought to us by Graphiti maintainer [Wade Tandy](https://github.com/wadetandy). | ||
|
||
Previously, when a client sent a bad write request to the server - | ||
unwritable attributes/relationships, or bad types - we would render the | ||
same generic 500 error JSON. We now render helpful error messages, so | ||
third-party clients know how to correct their requests. | ||
|
||
This is currently only affecting invalid writes, but the foundation laid | ||
will be extendable to reads as well. | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
layout: blog | ||
author: Lee Richmond | ||
title: Graphiti 1.2 Released | ||
--- | ||
|
||
I'm thrilled to announce much-needed, much-improved Rails integration, | ||
courtesy of the amazing [Peter Wagenet](https://github.com/wagenet) and | ||
the new [graphiti-rails](https://github.com/graphiti-api/graphiti-rails) gem. | ||
This gives us better error handling, tighter controllers, and a solid | ||
foundation for the codebase moving forward. | ||
|
||
You'll be especially happy about this release if you've ever tried to | ||
add error-handling middleware. Because prior versions of Graphiti used | ||
`rescue_from` in `ApplicationController`, we intercepted errors before | ||
other middleware had access to them. Now everything just works. | ||
|
||
As part of this upgrade, we're switching from `GraphitiErrors` to | ||
[RescueRegistry](https://github.com/wagenet/rescue_registry). Think of | ||
`RescueRegistry` as a well-refactored version of `GraphitiErrors`, available to | ||
even non-Graphiti developers. | ||
|
||
Though you don't have to do anything to upgrade to Graphiti 1.2, this release will start throwing deprecation notices around `ApplicationController`. Don't worry, the required changes are quite minor and spelled out in the [graphiti-rails migration guide]({{site.github.url}}/guides/graphiti-rails-migration). | ||
|
||
I'm quite happy with how this effort turned out. This release dramatically improves our integration with Rails internals, and I think everyone involved learned a lot. I'm honored to work with such talented developers in our open-source community ❤️ | ||
|
||
If you have any further questions, check out the `#dev` or `#rails` | ||
channels in our [Slack Chat](https://join.slack.com/t/graphiti-api/shared_invite/enQtMjkyMTA3MDgxNTQzLWVkMDM3NTlmNTIwODY2YWFkMGNiNzUzZGMzOTY3YmNmZjBhYzIyZWZlZTk4YmI1YTI0Y2M0OTZmZGYwN2QxZjg). | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -914,3 +914,15 @@ img[alt=glimmer_logo] { | |
} | ||
} | ||
} | ||
|
||
.blog { | ||
h2 a { | ||
color: white; | ||
|
||
&:hover { | ||
&:before { | ||
display: none; | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
layout: page | ||
--- | ||
|
||
<div markdown="1" class="toc col-md-3"> | ||
Blog | ||
==== | ||
|
||
{% for post in site.posts %} | ||
* [{{post.title}}]({{post.url}}) | ||
{% endfor %} | ||
|
||
</div> | ||
|
||
<div markdown="1" class="blog col-md-8"> | ||
|
||
> Here you can keep up-to-date with Graphiti, including updates, | ||
> deprecations, and our future roadmap. If there's anything you'd like | ||
> to read about, let us know [on Slack](https://join.slack.com/t/graphiti-api/shared_invite/enQtMjkyMTA3MDgxNTQzLWVkMDM3NTlmNTIwODY2YWFkMGNiNzUzZGMzOTY3YmNmZjBhYzIyZWZlZTk4YmI1YTI0Y2M0OTZmZGYwN2QxZjg). | ||
|
||
{% for post in site.posts %} | ||
<h2><a href="{{post.url}}">{{ post.title }}</a></h2> | ||
<blockquote>{{ post.excerpt }}</blockquote> | ||
{% endfor %} | ||
|
||
</div> | ||
|
||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,33 @@ layout: page | |
Migrating to graphiti-rails | ||
=========================== | ||
|
||
Coming Soon | ||
First, bump to Graphiti 1.2 - everything should work as-is, but you'll | ||
start seeing deprecation notices. | ||
|
||
Then add `graphiti-rails` to your `Gemfile`: | ||
|
||
```ruby | ||
gem 'graphiti-rails', '~> 0.1' | ||
``` | ||
|
||
You'll see slightly different deprecation notices at this point. To fix: | ||
|
||
* Remove `include Graphiti::Rails` from `ApplicationController` | ||
* Remove `include Graphiti::Responders` from `ApplicationController` | ||
* Remove the `register_exception` for `404` errors if you have one. | ||
* Add `include Graphiti::Rails::Responders` from `ApplicationController` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This, of course, assumes people are using Responders. I could probably auto-detect that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* Remove the `rescue_from` block. | ||
|
||
Finally, if you were passing the `show_raw_error` option to | ||
`#handle_exception`, replace this with `#show_detailed_exceptions?`: | ||
|
||
```ruby | ||
def show_detailed_exceptions? | ||
current_user.admin? | ||
end | ||
``` | ||
|
||
> Keep in mind, we'll always show detailed exceptions in development | ||
> mode, per Rails conventions. If this is confusing or not desirable, | ||
> set `config.consider_all_requests_local = false` in | ||
> `config/environments/development.rb` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Unless it's something custom, but you don't need the vanilla one.