diff --git a/.gitignore b/.gitignore index 5dc5c1bd..dcf7035f 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ tags Icon? ehthumbs.db Thumbs.db +*.sqlite3 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..b48fe610 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: ruby + +sudo: false + +cache: + directories: + - vendor/bundle + +script: + - true diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..aabf26a6 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,11 @@ +version: 1.0.{build}-{branch} + +skip_tags: true + +cache: + - vendor/bundle + +test_script: + - true + +build: off diff --git a/benchmarks/serialization_libraries/benchmark.rb b/benchmarks/serialization_libraries/benchmark.rb index 7d6830e8..6793a17a 100644 --- a/benchmarks/serialization_libraries/benchmark.rb +++ b/benchmarks/serialization_libraries/benchmark.rb @@ -3,6 +3,8 @@ Bundler.require(*Rails.groups) ActiveRecord::Base.logger = nil ActiveModelSerializers.logger = nil +ActiveModelSerializers.config.adapter = :json_api +ActiveModelSerializers.config.key_transform = :unaltered require './support/rails' require './support/bench_helper' @@ -22,6 +24,8 @@ GC.disable %i[ips memory].each do |bench| BenchHelper.clear_data BenchHelper.seed_data + BenchHelper.validate_render(:ams) + BenchHelper.validate_render(:jsonapi_rb) Benchmark.send(bench) do |x| x.config(time: 10, warmup: 5, stats: :bootstrap, confidence: 95) if x.respond_to?(:config) diff --git a/benchmarks/serialization_libraries/compare.sh b/benchmarks/serialization_libraries/compare.sh new file mode 100755 index 00000000..334b0649 --- /dev/null +++ b/benchmarks/serialization_libraries/compare.sh @@ -0,0 +1,222 @@ +#!/usr/bin/env bash +# +# Looks for significant differences between jsonapi-rb vs. ams serialization. +# +# Strategy: +# 1. The data being serialized is the same every time. +# i.e. All ids and timestamps or otherwise variable fields being serialized +# are always the same. +# 2. Compare the data in a way that accounts for the order different resources are included. +# 1. Compare the .data members, sort keys. +# 2. Compare the .included posts, sort keys. +# 3. Compare the .included comments, sort keys. +# 4. Confirm the included members are all either posts or comments. +# +# Depends on: +# jq: installed via npm +# diff: installed on system +# +# Usage: +# ./compare.sh +# +# Example output (abridged): +# +# -------------------------------------data (user) +# { { +# "attributes": { "attributes": { +# "birthday": "2017-07-01 05:00:00 UTC", "birthday": "2017-07-01 05:00:00 UTC", +# "created_at": "2017-07-01 05:00:00 UTC", "created_at": "2017-07-01 05:00:00 UTC", +# "first_name": "Diana", "first_name": "Diana", +# "last_name": "Prince", "last_name": "Prince", +# "updated_at": "2017-07-01 05:00:00 UTC" "updated_at": "2017-07-01 05:00:00 UTC" +# }, }, +# "id": "1", "id": "1", +# "relationships": { "relationships": { +# "posts": { "posts": { +# "data": [ "data": [ +# { { +# "id": "2", "id": "2", +# "type": "posts" "type": "posts" +# }, }, +# { { +# "id": "5", "id": "5", +# "type": "posts" "type": "posts" +# } } +# ] ] +# } } +# }, }, +# "type": "users" "type": "users" +# } } +# -------------------------------------included posts +# { { +# "attributes": { "attributes": { +# "body": "awesome content", "body": "awesome content", +# "created_at": "2017-07-01 05:00:00 UTC", "created_at": "2017-07-01 05:00:00 UTC", +# "title": "Some Post", "title": "Some Post", +# "updated_at": "2017-07-01 05:00:00 UTC" "updated_at": "2017-07-01 05:00:00 UTC" +# }, }, +# "id": "2", "id": "2", +# "relationships": { "relationships": { +# "comments": { "comments": { +# "data": [ "data": [ +# { { +# "id": "3", "id": "3", +# "type": "comments" "type": "comments" +# }, }, +# { { +# "id": "4", "id": "4", +# "type": "comments" "type": "comments" +# } } +# ] ] +# }, }, +# "user": { "user": { +# "meta": { | "data": { +# "included": false | "id": "1", +# > "type": "users" +# } } +# } } +# }, }, +# "type": "posts" "type": "posts" +# } } +# { { +# "attributes": { "attributes": { +# "body": "awesome content", "body": "awesome content", +# "created_at": "2017-07-01 05:00:00 UTC", "created_at": "2017-07-01 05:00:00 UTC", +# "title": "Some Post", "title": "Some Post", +# "updated_at": "2017-07-01 05:00:00 UTC" "updated_at": "2017-07-01 05:00:00 UTC" +# }, }, +# "id": "5", "id": "5", +# "relationships": { "relationships": { +# "comments": { "comments": { +# "data": [ "data": [ +# { { +# "id": "6", "id": "6", +# "type": "comments" "type": "comments" +# }, }, +# { { +# "id": "7", "id": "7", +# "type": "comments" "type": "comments" +# } } +# ] ] +# }, }, +# "user": { "user": { +# "meta": { | "data": { +# "included": false | "id": "1", +# > "type": "users" +# } } +# } } +# }, }, +# "type": "posts" "type": "posts" +# } } +# -------------------------------------included comments +# { { +# "attributes": { "attributes": { +# "author": "me", "author": "me", +# "comment": "nice blog" "comment": "nice blog" +# }, }, +# "id": "3", "id": "3", +# "relationships": { "relationships": { +# "post": { "post": { +# "meta": { | "data": { +# "included": false | "id": "2", +# > "type": "posts" +# } } +# } } +# }, }, +# "type": "comments" "type": "comments" +# } } +# { { +# "attributes": { "attributes": { +# "author": "me", "author": "me", +# "comment": "nice blog" "comment": "nice blog" +# }, }, +# "id": "4", "id": "4", +# "relationships": { "relationships": { +# "post": { "post": { +# "meta": { | "data": { +# "included": false | "id": "2", +# > "type": "posts" +# } } +# } } +# }, }, +# "type": "comments" "type": "comments" +# } } +# { { +# "attributes": { "attributes": { +# "author": "me", "author": "me", +# "comment": "nice blog" "comment": "nice blog" +# }, }, +# "id": "6", "id": "6", +# "relationships": { "relationships": { +# "post": { "post": { +# "meta": { | "data": { +# "included": false | "id": "5", +# > "type": "posts" +# } } +# } } +# }, }, +# "type": "comments" "type": "comments" +# } } +# { { +# "attributes": { "attributes": { +# "author": "me", "author": "me", +# "comment": "nice blog" "comment": "nice blog" +# }, }, +# "id": "7", "id": "7", +# "relationships": { "relationships": { +# "post": { "post": { +# "meta": { | "data": { +# "included": false | "id": "5", +# > "type": "posts" +# } } +# } } +# }, }, +# "type": "comments" "type": "comments" +# } } +# -------------------------------------included types: ams +# "comments" +# "posts" +# -------------------------------------included types: jsonapi_rb +# "comments" +# "posts" + +set -o pipefail + +DEBUG="${DEBUG:-false}" + +if ! command -v jq &>/dev/null; then + npm install -g jq +fi + +get_for_file() { + local path + path="$1" + result="$(cat ${path})" + echo "$result" +} + +compare_files() { + local actual + local expected + local pattern + actual="$1" + expected="$2" + pattern="$3" + + if [ "$DEBUG" = "true" ]; then get_for_file "${expected}" >&2; fi + diff --side-by-side \ + <(jq "${pattern}" -S <(get_for_file "${expected}")) \ + <(jq "${pattern}" -S <(get_for_file "${actual}")) +} +echo + +echo "-------------------------------------data (user)" +compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".data" +echo "-------------------------------------included posts" +compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".included | .[] | select(.type == \"posts\")" +echo "-------------------------------------included comments" +compare_files support/json_document-ams.json support/json_document-jsonapi_rb.json ".included | .[] | select(.type == \"comments\")" +echo "-------------------------------------included types: ams" +jq '.included | .[] | .type' -S < support/json_document-ams.json | sort -u +echo "-------------------------------------included types: jsonapi_rb" +jq '.included | .[] | .type' -S < support/json_document-jsonapi_rb.json | sort -u diff --git a/benchmarks/serialization_libraries/support/bench.sqlite3 b/benchmarks/serialization_libraries/support/bench.sqlite3 deleted file mode 100644 index a886ae03..00000000 Binary files a/benchmarks/serialization_libraries/support/bench.sqlite3 and /dev/null differ diff --git a/benchmarks/serialization_libraries/support/bench_helper.rb b/benchmarks/serialization_libraries/support/bench_helper.rb index 9ad2ab8c..2ef10ed7 100644 --- a/benchmarks/serialization_libraries/support/bench_helper.rb +++ b/benchmarks/serialization_libraries/support/bench_helper.rb @@ -13,16 +13,54 @@ module BenchHelper posts: 20 } - u = User.create(first_name: 'Diana', last_name: 'Prince', birthday: 3000.years.ago) + anchor_time = Time.new(2017,7,1).utc + id = 1 + user = User.create!(id: id, first_name: 'Diana', last_name: 'Prince', birthday: anchor_time, created_at: anchor_time, updated_at: anchor_time) + id += 1 data_config[:posts].times do - p = Post.create(user_id: u.id, title: 'Some Post', body: 'awesome content') + post = Post.create!(id: id, user_id: user.id, title: 'Some Post', body: 'awesome content', created_at: anchor_time, updated_at: anchor_time) + id += 1 data_config[:comments_per_post].times do - Comment.create(author: 'me', comment: 'nice blog', post_id: p.id) + Comment.create!(id: id, author: 'me', comment: 'nice blog', post_id: post.id, created_at: anchor_time, updated_at: anchor_time) + id += 1 end end end + def validate_render(render_gem) + expected_json_file = File.join("support", "json_document-#{render_gem}.json") + json_document = test_render(render_gem) + assert_equal_json("[#{render_gem}] :test_render", expected_json_file, json_document) + json_document = test_manual_eagerload(render_gem) + assert_equal_json("[#{render_gem}] :test_manual_eagerload", expected_json_file, json_document) + end + + require "fileutils" + def assert_equal_json(description, expected_json_file, actual_json_document) + # 1. in tmp/ + temp_dir = "tmp" + FileUtils.mkdir_p(temp_dir) + # 2. write pretty actual json doc + actual_json_file = File.join(temp_dir, "actual--#{File.basename(expected_json_file)}") + actual_json_document = JSON.pretty_generate(actual_json_document) + File.write(actual_json_file, actual_json_document) + # 3. if expected json doc missing, copy actual to expected + unless File.exist?(expected_json_file) + FileUtils.cp(actual_json_file, expected_json_file) + end + # 4. Check for differences + cmd = "diff --suppress-common-lines --side-by-side #{expected_json_file} #{actual_json_file}" + diff = `#{cmd}`.chomp + # 5. If none, 'true', they are equal + # else make a full diff for later review + return true if diff.empty? + cmd = "diff --side-by-side #{expected_json_file} #{actual_json_file} > #{File.join(temp_dir, "actual--#{File.basename(expected_json_file)}")}.diff" + system(cmd) + # 6. abort run, print brief diff + abort "#{description}. Invalid JSON document.\nDiff:\n#{diff}}" + end + def test_render(render_gem) render_data( User.first, @@ -37,10 +75,14 @@ module BenchHelper ) end - def render_data(data, render_gem) - return render_with_ams(data) if render_gem == :ams + # protected - render_with_jsonapi_rb(data) + def render_data(data, render_gem) + case render_gem + when :ams then render_with_ams(data) + when :jsonapi_rb then render_with_jsonapi_rb(data) + else fail ArgumentError, "Cannot render unknown gem '#{render_gem.inspect}'" + end end def render_with_ams(data) diff --git a/benchmarks/serialization_libraries/support/json_document-ams.json b/benchmarks/serialization_libraries/support/json_document-ams.json new file mode 100644 index 00000000..f1f060eb --- /dev/null +++ b/benchmarks/serialization_libraries/support/json_document-ams.json @@ -0,0 +1,1341 @@ +{ + "data": { + "id": "1", + "type": "users", + "attributes": { + "first_name": "Diana", + "last_name": "Prince", + "birthday": "2017-07-01 05:00:00 UTC", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "posts": { + "data": [ + { + "id": "2", + "type": "posts" + }, + { + "id": "5", + "type": "posts" + }, + { + "id": "8", + "type": "posts" + }, + { + "id": "11", + "type": "posts" + }, + { + "id": "14", + "type": "posts" + }, + { + "id": "17", + "type": "posts" + }, + { + "id": "20", + "type": "posts" + }, + { + "id": "23", + "type": "posts" + }, + { + "id": "26", + "type": "posts" + }, + { + "id": "29", + "type": "posts" + }, + { + "id": "32", + "type": "posts" + }, + { + "id": "35", + "type": "posts" + }, + { + "id": "38", + "type": "posts" + }, + { + "id": "41", + "type": "posts" + }, + { + "id": "44", + "type": "posts" + }, + { + "id": "47", + "type": "posts" + }, + { + "id": "50", + "type": "posts" + }, + { + "id": "53", + "type": "posts" + }, + { + "id": "56", + "type": "posts" + }, + { + "id": "59", + "type": "posts" + } + ] + } + } + }, + "included": [ + { + "id": "2", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "3", + "type": "comments" + }, + { + "id": "4", + "type": "comments" + } + ] + } + } + }, + { + "id": "3", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "2", + "type": "posts" + } + } + } + }, + { + "id": "4", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "2", + "type": "posts" + } + } + } + }, + { + "id": "5", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "6", + "type": "comments" + }, + { + "id": "7", + "type": "comments" + } + ] + } + } + }, + { + "id": "6", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "5", + "type": "posts" + } + } + } + }, + { + "id": "7", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "5", + "type": "posts" + } + } + } + }, + { + "id": "8", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "9", + "type": "comments" + }, + { + "id": "10", + "type": "comments" + } + ] + } + } + }, + { + "id": "9", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "8", + "type": "posts" + } + } + } + }, + { + "id": "10", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "8", + "type": "posts" + } + } + } + }, + { + "id": "11", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "12", + "type": "comments" + }, + { + "id": "13", + "type": "comments" + } + ] + } + } + }, + { + "id": "12", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "11", + "type": "posts" + } + } + } + }, + { + "id": "13", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "11", + "type": "posts" + } + } + } + }, + { + "id": "14", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "15", + "type": "comments" + }, + { + "id": "16", + "type": "comments" + } + ] + } + } + }, + { + "id": "15", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "14", + "type": "posts" + } + } + } + }, + { + "id": "16", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "14", + "type": "posts" + } + } + } + }, + { + "id": "17", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "18", + "type": "comments" + }, + { + "id": "19", + "type": "comments" + } + ] + } + } + }, + { + "id": "18", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "17", + "type": "posts" + } + } + } + }, + { + "id": "19", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "17", + "type": "posts" + } + } + } + }, + { + "id": "20", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "21", + "type": "comments" + }, + { + "id": "22", + "type": "comments" + } + ] + } + } + }, + { + "id": "21", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "20", + "type": "posts" + } + } + } + }, + { + "id": "22", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "20", + "type": "posts" + } + } + } + }, + { + "id": "23", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "24", + "type": "comments" + }, + { + "id": "25", + "type": "comments" + } + ] + } + } + }, + { + "id": "24", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "23", + "type": "posts" + } + } + } + }, + { + "id": "25", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "23", + "type": "posts" + } + } + } + }, + { + "id": "26", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "27", + "type": "comments" + }, + { + "id": "28", + "type": "comments" + } + ] + } + } + }, + { + "id": "27", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "26", + "type": "posts" + } + } + } + }, + { + "id": "28", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "26", + "type": "posts" + } + } + } + }, + { + "id": "29", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "30", + "type": "comments" + }, + { + "id": "31", + "type": "comments" + } + ] + } + } + }, + { + "id": "30", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "29", + "type": "posts" + } + } + } + }, + { + "id": "31", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "29", + "type": "posts" + } + } + } + }, + { + "id": "32", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "33", + "type": "comments" + }, + { + "id": "34", + "type": "comments" + } + ] + } + } + }, + { + "id": "33", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "32", + "type": "posts" + } + } + } + }, + { + "id": "34", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "32", + "type": "posts" + } + } + } + }, + { + "id": "35", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "36", + "type": "comments" + }, + { + "id": "37", + "type": "comments" + } + ] + } + } + }, + { + "id": "36", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "35", + "type": "posts" + } + } + } + }, + { + "id": "37", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "35", + "type": "posts" + } + } + } + }, + { + "id": "38", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "39", + "type": "comments" + }, + { + "id": "40", + "type": "comments" + } + ] + } + } + }, + { + "id": "39", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "38", + "type": "posts" + } + } + } + }, + { + "id": "40", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "38", + "type": "posts" + } + } + } + }, + { + "id": "41", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "42", + "type": "comments" + }, + { + "id": "43", + "type": "comments" + } + ] + } + } + }, + { + "id": "42", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "41", + "type": "posts" + } + } + } + }, + { + "id": "43", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "41", + "type": "posts" + } + } + } + }, + { + "id": "44", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "45", + "type": "comments" + }, + { + "id": "46", + "type": "comments" + } + ] + } + } + }, + { + "id": "45", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "44", + "type": "posts" + } + } + } + }, + { + "id": "46", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "44", + "type": "posts" + } + } + } + }, + { + "id": "47", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "48", + "type": "comments" + }, + { + "id": "49", + "type": "comments" + } + ] + } + } + }, + { + "id": "48", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "47", + "type": "posts" + } + } + } + }, + { + "id": "49", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "47", + "type": "posts" + } + } + } + }, + { + "id": "50", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "51", + "type": "comments" + }, + { + "id": "52", + "type": "comments" + } + ] + } + } + }, + { + "id": "51", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "50", + "type": "posts" + } + } + } + }, + { + "id": "52", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "50", + "type": "posts" + } + } + } + }, + { + "id": "53", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "54", + "type": "comments" + }, + { + "id": "55", + "type": "comments" + } + ] + } + } + }, + { + "id": "54", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "53", + "type": "posts" + } + } + } + }, + { + "id": "55", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "53", + "type": "posts" + } + } + } + }, + { + "id": "56", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "57", + "type": "comments" + }, + { + "id": "58", + "type": "comments" + } + ] + } + } + }, + { + "id": "57", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "56", + "type": "posts" + } + } + } + }, + { + "id": "58", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "56", + "type": "posts" + } + } + } + }, + { + "id": "59", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "data": { + "id": "1", + "type": "users" + } + }, + "comments": { + "data": [ + { + "id": "60", + "type": "comments" + }, + { + "id": "61", + "type": "comments" + } + ] + } + } + }, + { + "id": "60", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "59", + "type": "posts" + } + } + } + }, + { + "id": "61", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "data": { + "id": "59", + "type": "posts" + } + } + } + } + ] +} \ No newline at end of file diff --git a/benchmarks/serialization_libraries/support/json_document-jsonapi_rb.json b/benchmarks/serialization_libraries/support/json_document-jsonapi_rb.json new file mode 100644 index 00000000..a4ea1106 --- /dev/null +++ b/benchmarks/serialization_libraries/support/json_document-jsonapi_rb.json @@ -0,0 +1,1281 @@ +{ + "data": { + "id": "1", + "type": "users", + "attributes": { + "first_name": "Diana", + "last_name": "Prince", + "birthday": "2017-07-01 05:00:00 UTC", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "posts": { + "data": [ + { + "type": "posts", + "id": "2" + }, + { + "type": "posts", + "id": "5" + }, + { + "type": "posts", + "id": "8" + }, + { + "type": "posts", + "id": "11" + }, + { + "type": "posts", + "id": "14" + }, + { + "type": "posts", + "id": "17" + }, + { + "type": "posts", + "id": "20" + }, + { + "type": "posts", + "id": "23" + }, + { + "type": "posts", + "id": "26" + }, + { + "type": "posts", + "id": "29" + }, + { + "type": "posts", + "id": "32" + }, + { + "type": "posts", + "id": "35" + }, + { + "type": "posts", + "id": "38" + }, + { + "type": "posts", + "id": "41" + }, + { + "type": "posts", + "id": "44" + }, + { + "type": "posts", + "id": "47" + }, + { + "type": "posts", + "id": "50" + }, + { + "type": "posts", + "id": "53" + }, + { + "type": "posts", + "id": "56" + }, + { + "type": "posts", + "id": "59" + } + ] + } + } + }, + "included": [ + { + "id": "2", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "3" + }, + { + "type": "comments", + "id": "4" + } + ] + } + } + }, + { + "id": "5", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "6" + }, + { + "type": "comments", + "id": "7" + } + ] + } + } + }, + { + "id": "8", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "9" + }, + { + "type": "comments", + "id": "10" + } + ] + } + } + }, + { + "id": "11", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "12" + }, + { + "type": "comments", + "id": "13" + } + ] + } + } + }, + { + "id": "14", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "15" + }, + { + "type": "comments", + "id": "16" + } + ] + } + } + }, + { + "id": "17", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "18" + }, + { + "type": "comments", + "id": "19" + } + ] + } + } + }, + { + "id": "20", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "21" + }, + { + "type": "comments", + "id": "22" + } + ] + } + } + }, + { + "id": "23", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "24" + }, + { + "type": "comments", + "id": "25" + } + ] + } + } + }, + { + "id": "26", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "27" + }, + { + "type": "comments", + "id": "28" + } + ] + } + } + }, + { + "id": "29", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "30" + }, + { + "type": "comments", + "id": "31" + } + ] + } + } + }, + { + "id": "32", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "33" + }, + { + "type": "comments", + "id": "34" + } + ] + } + } + }, + { + "id": "35", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "36" + }, + { + "type": "comments", + "id": "37" + } + ] + } + } + }, + { + "id": "38", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "39" + }, + { + "type": "comments", + "id": "40" + } + ] + } + } + }, + { + "id": "41", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "42" + }, + { + "type": "comments", + "id": "43" + } + ] + } + } + }, + { + "id": "44", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "45" + }, + { + "type": "comments", + "id": "46" + } + ] + } + } + }, + { + "id": "47", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "48" + }, + { + "type": "comments", + "id": "49" + } + ] + } + } + }, + { + "id": "50", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "51" + }, + { + "type": "comments", + "id": "52" + } + ] + } + } + }, + { + "id": "53", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "54" + }, + { + "type": "comments", + "id": "55" + } + ] + } + } + }, + { + "id": "56", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "57" + }, + { + "type": "comments", + "id": "58" + } + ] + } + } + }, + { + "id": "59", + "type": "posts", + "attributes": { + "title": "Some Post", + "body": "awesome content", + "created_at": "2017-07-01 05:00:00 UTC", + "updated_at": "2017-07-01 05:00:00 UTC" + }, + "relationships": { + "user": { + "meta": { + "included": false + } + }, + "comments": { + "data": [ + { + "type": "comments", + "id": "60" + }, + { + "type": "comments", + "id": "61" + } + ] + } + } + }, + { + "id": "3", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "4", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "6", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "7", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "9", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "10", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "12", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "13", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "15", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "16", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "18", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "19", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "21", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "22", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "24", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "25", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "27", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "28", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "30", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "31", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "33", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "34", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "36", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "37", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "39", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "40", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "42", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "43", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "45", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "46", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "48", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "49", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "51", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "52", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "54", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "55", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "57", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "58", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "60", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + }, + { + "id": "61", + "type": "comments", + "attributes": { + "author": "me", + "comment": "nice blog" + }, + "relationships": { + "post": { + "meta": { + "included": false + } + } + } + } + ] +} \ No newline at end of file diff --git a/benchmarks/serialization_libraries/support/rails.rb b/benchmarks/serialization_libraries/support/rails.rb index 94ef7cda..eef52abb 100644 --- a/benchmarks/serialization_libraries/support/rails.rb +++ b/benchmarks/serialization_libraries/support/rails.rb @@ -36,14 +36,17 @@ class ApplicationRecord < ActiveRecord::Base end class Comment < ApplicationRecord + default_scope { order(:id) } belongs_to :post end class Post < ApplicationRecord + default_scope { order(:id) } has_many :comments belongs_to :user end class User < ApplicationRecord + default_scope { order(:id) } has_many :posts end