Skip to content

Instantly share code, notes, and snippets.

Z zdne

Block or report user

Report or block zdne

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zdne
zdne / hal-embedding.md
Last active Jun 5, 2019
Explanation of HAL+JSON embedding
View hal-embedding.md

Embedding Related Resoruces in HAL

Often, I get questions about embedding resources with HAL http://stateless.co/hal_specification.html. Here is some of my recommendation illustrated on an example.

First of all, think of the _embedded as a courtesy of HAL so the API user does not have to make one more call to retrieve a resource that has a link relation with the current (self resource). Let's illustrate it on an example: A collection of applications and one application, where an application might have related, child applications. The link relations are as follow:

collection of applications resource ——application relation——> application resource

application resource ——child relation——> application resource

View keybase.md

Keybase proof

I hereby claim:

  • I am zdne on github.
  • I am zdenek (https://keybase.io/zdenek) on keybase.
  • I have a public key ASBe1huF1XGh7mDwe5wbzdbPAShqtgw56p1S0n22kXYAyQo

To claim this, I am signing this object:

View http2-comparison.md
View stuff.md
  1. Retrieve WeatherReport where address is Anchorage, Alaska
  2. Send Payment where the recipient is https://keybase.io/phil and currency is USD and amount is 40
  3. Send Message where the recipient is https://keybase.io/phil and text is Hey Phil ...
@zdne
zdne / schemaUtils.js
Created Jan 14, 2017 — forked from jarwol/schemaUtils.js
GraphQL diff() and merge() extensions
View schemaUtils.js
'use strict';
/**
* This module extends the graphql.js schema and types by adding diff and merge functions.
*/
(function () {
const GraphQLSchema = require('graphql/type/schema').GraphQLSchema,
GraphQLObjectType = require('graphql/type/definition').GraphQLObjectType,
GraphQLScalarType = require('graphql/type/definition').GraphQLScalarType,
GraphQLUnionType = require('graphql/type/definition').GraphQLUnionType,
View client.rb
# Using a terms from schema.org dictionary,
# find services that offers WeatherForecast.
services = apiRegistry.find(WeatherForecast, { vocabulary: "http://schema.org"})
# Query a service for WeatherForecast at GeoCoordinates.
forecast = service.retrieve(WeatherForecast, { GeoCoordinates: … })
# Display Temperature
print forecast(Temperature)
View keybase.md

Keybase proof

I hereby claim:

  • I am zdne on github.
  • I am zdenek (https://keybase.io/zdenek) on keybase.
  • I have a public key whose fingerprint is AAB0 458B 4299 95C4 5C9F 0CE0 1205 3F7F C8E6 F7A4

To claim this, I am signing this object:

View fizzbuzz.apib
# Fizz Buzz Solving API Blueprint
## Data Structures
## Main (array)
This only does 1 through 15.
### Members
- !map
- (array)
View collection.apib
# User [/users/{id}]
- Attributes (object)
- name: John
- email: john@apiary.io
## Retrieve [GET]
- Response 200 (application/json)
- Attributes (User)
## Remove [DELETE]
View version.apib
# API
## Globals Parameters
- version: 1.0 (string) - Version of the API
# Resource A [/{version}/some/path/to/a]
# Resource B [/{version}/some/path/to/b]
You can’t perform that action at this time.