Skip to content

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
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
JSONAPI Suite Documentation
Graphiti Documentation
==========

This is a static website generated by [jekyll](https://jekyllrb.com). To
Expand Down
20 changes: 20 additions & 0 deletions _layouts/blog.html
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>

31 changes: 31 additions & 0 deletions _posts/2019-03-31-graphiti-1-0.md
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 />
38 changes: 38 additions & 0 deletions _posts/2019-05-08-graphiti-1-1.md
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 />
40 changes: 40 additions & 0 deletions _posts/2019-05-20-graphiti-1-2.md
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 />
12 changes: 12 additions & 0 deletions _sass/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -914,3 +914,15 @@ img[alt=glimmer_logo] {
}
}
}

.blog {
h2 a {
color: white;

&:hover {
&:before {
display: none;
}
}
}
}
57 changes: 57 additions & 0 deletions blog.md
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 />
31 changes: 30 additions & 1 deletion guides/graphiti-rails-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor Author

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.

* Add `include Graphiti::Rails::Responders` from `ApplicationController`
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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`
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy