Launch: Obsidian 3.1

Justin McKay
3 min readJul 1, 2021

Team Obsidian and Open Source Labs are excited to announce the release of Obsidian 3.1. This latest release includes new core features & security updates.

What is Obsidian?

Obsidian is Deno’s first native GraphQL caching client and server module. Obsidian is equipped with lightning-fast normalized caching to support scalable, highly performant SSR React applications built with Deno. In other words, Apollo is to Node.js as Obsidian is to Deno.

What’s new in 3.1?

  1. GraphQL Variables

Obsidian now supports caching for dynamic GraphQL queries containing variables. Obsidian’s destructuring algorithm intelligently accounts for variables, substituting them with their corresponding values, and caches the modified query along with its result in order to optimize subsequent requests even further. Developers do not need to modify any existing code to benefit from this update, as the changes are passive & non-breaking.

2. GraphQL Directives

Obsidian now supports caching for dynamic GraphQL queries containing directives, providing a way to decorate queries with additional configuration such that Obsidian can perform custom logic before the query reaches the GraphQL executor. Obsidian accounts for single core GraphQL directives, namely @skip and @include, and decides whether to keep or omit the particular field based on variable values. Thereafter, the modified query along with its result is cached in order to optimize subsequent requests. Check out this snippet of code to see Obsidian in action.

Incoming Query with true or false directive.

// Query Variables Object:{
"episode": "2",
"withFriends": true
}
// Query String:query Hero($episode: Episode, $withFriends: Boolean!) {
hero (episode: $episode) {
name
friends @include(if: $withFriends) {
name
}
}
}

After parsing when ($withFriends = true).

// Query String:

query Hero($episode: Episode, $withFriends: true) {
hero (episode: $episode) {
name
friends {
name
}
}
}

After parsing when ($withFriends = false).

// Query String:query Hero($episode: Episode, $withFriends: false) {
hero (episode: $episode) {
name
}
}

3. Security: Query Depth Limiter

3.1 introduces the first security component to the Obsidian library. GraphQL has given developers a powerful tool for making requests to the backend, but also adds risk to the backend because nefarious clients may attempt to take advantage of the flexibility and power given to clients. Obsidian now supports the ability to limit query depth and prevent overly complex, nested queries from tying up your server resources. This effectively prevents DoS attacks in the form of recursively nested fields that become exponentially more complex with every level of nesting.

4. Semantic Versioning

As Obsidian’s feature set becomes more fully fleshed out, we’re transitioning to semantic versioning starting with today’s release. Obsidian 3.1.0 introduces new functionality with no breaking API changes and full backwards compatibility.

Get Started

To use Obsidian in your next project, you’ll find extensive documentation for getting started available at obsidian.land. Check out our interactive demo here.

Obsidian is an open-source product developed under tech accelerator OS Labs. To contribute and leave feedback, check out our GitHub. We are excited to see what the community will bring to Obsidian.

Co-authored by Team Obsidian:

Kyung Lee | GitHub | LinkedIn

Justin McKay| GitHub | LinkedIn

Raymond Ahn | GitHub | LinkedIn

Cameron Simmons | GitHub | LinkedIn

Patrick Sullivan | GitHub | LinkedIn

--

--