avro_turf 1.18.0 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.github/workflows/ruby.yml +20 -11
 - data/CHANGELOG.md +10 -0
 - data/Gemfile +6 -1
 - data/README.md +1 -1
 - data/Rakefile +2 -1
 - data/avro_turf.gemspec +17 -17
 - data/lib/avro_turf/cached_confluent_schema_registry.rb +9 -8
 - data/lib/avro_turf/cached_schema_registry.rb +3 -1
 - data/lib/avro_turf/confluent_schema_registry.rb +35 -22
 - data/lib/avro_turf/core_ext/date.rb +2 -0
 - data/lib/avro_turf/core_ext/enumerable.rb +2 -0
 - data/lib/avro_turf/core_ext/false_class.rb +2 -0
 - data/lib/avro_turf/core_ext/hash.rb +4 -2
 - data/lib/avro_turf/core_ext/nil_class.rb +2 -0
 - data/lib/avro_turf/core_ext/numeric.rb +2 -0
 - data/lib/avro_turf/core_ext/string.rb +2 -0
 - data/lib/avro_turf/core_ext/symbol.rb +2 -0
 - data/lib/avro_turf/core_ext/time.rb +2 -0
 - data/lib/avro_turf/core_ext/true_class.rb +2 -0
 - data/lib/avro_turf/core_ext.rb +12 -10
 - data/lib/avro_turf/disk_cache.rb +13 -12
 - data/lib/avro_turf/in_memory_cache.rb +2 -0
 - data/lib/avro_turf/messaging.rb +31 -16
 - data/lib/avro_turf/mutable_schema_store.rb +25 -4
 - data/lib/avro_turf/schema_registry.rb +3 -1
 - data/lib/avro_turf/schema_store.rb +3 -2
 - data/lib/avro_turf/schema_to_avro_patch.rb +14 -12
 - data/lib/avro_turf/test/fake_confluent_schema_registry_server.rb +24 -23
 - data/lib/avro_turf/test/fake_prefixed_confluent_schema_registry_server.rb +12 -10
 - data/lib/avro_turf/test/fake_schema_registry_server.rb +3 -1
 - data/lib/avro_turf/version.rb +3 -1
 - data/lib/avro_turf.rb +15 -13
 - data/perf/encoding_size.rb +4 -2
 - data/perf/encoding_speed.rb +4 -2
 - data/spec/avro_turf_spec.rb +24 -23
 - data/spec/cached_confluent_schema_registry_spec.rb +9 -7
 - data/spec/confluent_schema_registry_spec.rb +31 -10
 - data/spec/core_ext/date_spec.rb +2 -0
 - data/spec/core_ext/enumerable_spec.rb +2 -0
 - data/spec/core_ext/false_class_spec.rb +2 -0
 - data/spec/core_ext/hash_spec.rb +3 -1
 - data/spec/core_ext/nil_class_spec.rb +2 -0
 - data/spec/core_ext/numeric_spec.rb +2 -0
 - data/spec/core_ext/string_spec.rb +2 -0
 - data/spec/core_ext/symbol_spec.rb +2 -0
 - data/spec/core_ext/time_spec.rb +2 -0
 - data/spec/core_ext/true_class_spec.rb +2 -0
 - data/spec/disk_cached_confluent_schema_registry_spec.rb +23 -21
 - data/spec/messaging_spec.rb +171 -86
 - data/spec/mutable_schema_store_spec.rb +134 -0
 - data/spec/schema_store_spec.rb +23 -21
 - data/spec/schema_to_avro_patch_spec.rb +8 -7
 - data/spec/spec_helper.rb +9 -9
 - data/spec/support/authorized_fake_confluent_schema_registry_server.rb +4 -2
 - data/spec/support/authorized_fake_prefixed_confluent_schema_registry_server.rb +4 -2
 - data/spec/support/confluent_schema_registry_context.rb +32 -30
 - data/spec/test/fake_confluent_schema_registry_server_spec.rb +97 -94
 - metadata +15 -33
 
| 
         @@ -1,175 +1,178 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "rack/test"
         
     | 
| 
       2 
4 
     | 
    
         | 
| 
       3 
5 
     | 
    
         
             
            describe FakeConfluentSchemaRegistryServer do
         
     | 
| 
       4 
6 
     | 
    
         
             
              include Rack::Test::Methods
         
     | 
| 
       5 
7 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
              def app 
     | 
| 
      
 8 
     | 
    
         
            +
              def app
         
     | 
| 
      
 9 
     | 
    
         
            +
                AuthorizedFakeConfluentSchemaRegistryServer
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
       7 
11 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
              describe  
     | 
| 
       9 
     | 
    
         
            -
                it  
     | 
| 
       10 
     | 
    
         
            -
                  post  
     | 
| 
      
 12 
     | 
    
         
            +
              describe "POST /subjects/:subject/versions" do
         
     | 
| 
      
 13 
     | 
    
         
            +
                it "returns the same schema ID when invoked with same schema and same subject" do
         
     | 
| 
      
 14 
     | 
    
         
            +
                  post "/subjects/person/versions", {schema: schema(name: "person")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
       11 
15 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                  expected_id = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 16 
     | 
    
         
            +
                  expected_id = JSON.parse(last_response.body).fetch("id")
         
     | 
| 
       13 
17 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                  post  
     | 
| 
      
 18 
     | 
    
         
            +
                  post "/subjects/person/versions", {schema: schema(name: "person")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
       15 
19 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                  expect(JSON.parse(last_response.body).fetch( 
     | 
| 
      
 20 
     | 
    
         
            +
                  expect(JSON.parse(last_response.body).fetch("id")).to eq expected_id
         
     | 
| 
       17 
21 
     | 
    
         
             
                end
         
     | 
| 
       18 
22 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                it  
     | 
| 
       20 
     | 
    
         
            -
                  post  
     | 
| 
      
 23 
     | 
    
         
            +
                it "returns the same schema ID when invoked with same schema and different subject" do
         
     | 
| 
      
 24 
     | 
    
         
            +
                  post "/subjects/person/versions", {schema: schema(name: "person")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
       21 
25 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                  original_id = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 26 
     | 
    
         
            +
                  original_id = JSON.parse(last_response.body).fetch("id")
         
     | 
| 
       23 
27 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                  post  
     | 
| 
      
 28 
     | 
    
         
            +
                  post "/subjects/happy-person/versions", {schema: schema(name: "person")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
       25 
29 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
                  expect(JSON.parse(last_response.body).fetch( 
     | 
| 
      
 30 
     | 
    
         
            +
                  expect(JSON.parse(last_response.body).fetch("id")).to eq original_id
         
     | 
| 
       27 
31 
     | 
    
         
             
                end
         
     | 
| 
       28 
32 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                it  
     | 
| 
       30 
     | 
    
         
            -
                  post  
     | 
| 
      
 33 
     | 
    
         
            +
                it "returns a different schema ID when invoked with a different schema" do
         
     | 
| 
      
 34 
     | 
    
         
            +
                  post "/subjects/person/versions", {schema: schema(name: "person")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
       31 
35 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                  original_id = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 36 
     | 
    
         
            +
                  original_id = JSON.parse(last_response.body).fetch("id")
         
     | 
| 
       33 
37 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
                  post  
     | 
| 
      
 38 
     | 
    
         
            +
                  post "/subjects/person/versions", {schema: schema(name: "other")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
       35 
39 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                  expect(JSON.parse(last_response.body).fetch( 
     | 
| 
      
 40 
     | 
    
         
            +
                  expect(JSON.parse(last_response.body).fetch("id")).to_not eq original_id
         
     | 
| 
       37 
41 
     | 
    
         
             
                end
         
     | 
| 
       38 
42 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                context  
     | 
| 
      
 43 
     | 
    
         
            +
                context "with a clean registry" do
         
     | 
| 
       40 
44 
     | 
    
         
             
                  before do
         
     | 
| 
       41 
45 
     | 
    
         
             
                    FakeConfluentSchemaRegistryServer.clear
         
     | 
| 
       42 
46 
     | 
    
         
             
                  end
         
     | 
| 
       43 
47 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                  it  
     | 
| 
       45 
     | 
    
         
            -
                    post  
     | 
| 
       46 
     | 
    
         
            -
                    schema1_id = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 48 
     | 
    
         
            +
                  it "assigns same schema id for different schemas in different contexts" do
         
     | 
| 
      
 49 
     | 
    
         
            +
                    post "/subjects/:.context1:cats/versions", {schema: schema(name: "name1")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 50 
     | 
    
         
            +
                    schema1_id = JSON.parse(last_response.body).fetch("id") # Original cats schema
         
     | 
| 
       47 
51 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
                    post  
     | 
| 
       49 
     | 
    
         
            -
                    schema2_id = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 52 
     | 
    
         
            +
                    post "/subjects/:.context2:dogs/versions", {schema: schema(name: "name2")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 53 
     | 
    
         
            +
                    schema2_id = JSON.parse(last_response.body).fetch("id") # Original cats schema
         
     | 
| 
       50 
54 
     | 
    
         | 
| 
       51 
55 
     | 
    
         
             
                    expect(schema1_id).to eq(schema2_id)
         
     | 
| 
       52 
56 
     | 
    
         
             
                  end
         
     | 
| 
       53 
57 
     | 
    
         
             
                end
         
     | 
| 
       54 
58 
     | 
    
         
             
              end
         
     | 
| 
       55 
59 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
              describe  
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
      
 60 
     | 
    
         
            +
              describe "GET /schemas/ids/:id/versions" do
         
     | 
| 
       58 
61 
     | 
    
         
             
                it "returns array containing subjects and versions for given schema id" do
         
     | 
| 
       59 
62 
     | 
    
         
             
                  schema1 = schema(name: "name1")
         
     | 
| 
       60 
63 
     | 
    
         
             
                  schema2 = schema(name: "name2")
         
     | 
| 
       61 
64 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
                  post "/subjects/cats/versions", { 
     | 
| 
       63 
     | 
    
         
            -
                  schema1_id = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 65 
     | 
    
         
            +
                  post "/subjects/cats/versions", {schema: schema1}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 66 
     | 
    
         
            +
                  schema1_id = JSON.parse(last_response.body).fetch("id") # Original cats schema
         
     | 
| 
       64 
67 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
                  post "/subjects/dogs/versions", { 
     | 
| 
       66 
     | 
    
         
            -
                  post "/subjects/cats/versions", { 
     | 
| 
       67 
     | 
    
         
            -
                  schema2_id = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 68 
     | 
    
         
            +
                  post "/subjects/dogs/versions", {schema: schema2}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 69 
     | 
    
         
            +
                  post "/subjects/cats/versions", {schema: schema2}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 70 
     | 
    
         
            +
                  schema2_id = JSON.parse(last_response.body).fetch("id") # Changed cats schema == Original Dogs schema
         
     | 
| 
       68 
71 
     | 
    
         | 
| 
       69 
72 
     | 
    
         
             
                  get "/schemas/ids/#{schema1_id}/versions"
         
     | 
| 
       70 
73 
     | 
    
         
             
                  result = JSON.parse(last_response.body)
         
     | 
| 
       71 
74 
     | 
    
         | 
| 
       72 
75 
     | 
    
         
             
                  expect(result).to eq [{
         
     | 
| 
       73 
     | 
    
         
            -
                     
     | 
| 
       74 
     | 
    
         
            -
                     
     | 
| 
      
 76 
     | 
    
         
            +
                    "subject" => "cats",
         
     | 
| 
      
 77 
     | 
    
         
            +
                    "version" => 1
         
     | 
| 
       75 
78 
     | 
    
         
             
                  }]
         
     | 
| 
       76 
79 
     | 
    
         | 
| 
       77 
80 
     | 
    
         
             
                  get "/schemas/ids/#{schema2_id}/versions"
         
     | 
| 
       78 
81 
     | 
    
         
             
                  result = JSON.parse(last_response.body)
         
     | 
| 
       79 
82 
     | 
    
         | 
| 
       80 
     | 
    
         
            -
                  expect(result).to include( 
     | 
| 
       81 
     | 
    
         
            -
                     
     | 
| 
       82 
     | 
    
         
            -
                     
     | 
| 
      
 83 
     | 
    
         
            +
                  expect(result).to include({
         
     | 
| 
      
 84 
     | 
    
         
            +
                    "subject" => "cats",
         
     | 
| 
      
 85 
     | 
    
         
            +
                    "version" => 2
         
     | 
| 
       83 
86 
     | 
    
         
             
                  }, {
         
     | 
| 
       84 
     | 
    
         
            -
                     
     | 
| 
       85 
     | 
    
         
            -
                     
     | 
| 
      
 87 
     | 
    
         
            +
                    "subject" => "dogs",
         
     | 
| 
      
 88 
     | 
    
         
            +
                    "version" => 1
         
     | 
| 
       86 
89 
     | 
    
         
             
                  })
         
     | 
| 
       87 
90 
     | 
    
         
             
                end
         
     | 
| 
       88 
91 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                describe  
     | 
| 
       90 
     | 
    
         
            -
                  it  
     | 
| 
       91 
     | 
    
         
            -
                     
     | 
| 
       92 
     | 
    
         
            -
                     
     | 
| 
      
 92 
     | 
    
         
            +
                describe "schema registry contexts" do
         
     | 
| 
      
 93 
     | 
    
         
            +
                  it "allows different schemas to have same schema version", :aggregate_failures do
         
     | 
| 
      
 94 
     | 
    
         
            +
                    pet_schema = schema(name: "pet_cat")
         
     | 
| 
      
 95 
     | 
    
         
            +
                    animal_schema = schema(name: "animal_cat")
         
     | 
| 
       93 
96 
     | 
    
         | 
| 
       94 
     | 
    
         
            -
                    post  
     | 
| 
       95 
     | 
    
         
            -
                    pet_id = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 97 
     | 
    
         
            +
                    post "/subjects/:.pets:cats/versions", {schema: pet_schema}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 98 
     | 
    
         
            +
                    pet_id = JSON.parse(last_response.body).fetch("id") # Context1 cats schema
         
     | 
| 
       96 
99 
     | 
    
         | 
| 
       97 
     | 
    
         
            -
                    post  
     | 
| 
       98 
     | 
    
         
            -
                    animal_id = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 100 
     | 
    
         
            +
                    post "/subjects/:.animals:cats/versions", {schema: animal_schema}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 101 
     | 
    
         
            +
                    animal_id = JSON.parse(last_response.body).fetch("id") # Context2 cats schema
         
     | 
| 
       99 
102 
     | 
    
         | 
| 
       100 
103 
     | 
    
         
             
                    get "/schemas/ids/#{pet_id}/versions?subject=:.pets:"
         
     | 
| 
       101 
104 
     | 
    
         
             
                    result = JSON.parse(last_response.body)
         
     | 
| 
       102 
105 
     | 
    
         | 
| 
       103 
106 
     | 
    
         
             
                    expect(result).to eq [{
         
     | 
| 
       104 
     | 
    
         
            -
                       
     | 
| 
       105 
     | 
    
         
            -
                       
     | 
| 
      
 107 
     | 
    
         
            +
                      "subject" => ":.pets:cats",
         
     | 
| 
      
 108 
     | 
    
         
            +
                      "version" => 1
         
     | 
| 
       106 
109 
     | 
    
         
             
                    }]
         
     | 
| 
       107 
110 
     | 
    
         | 
| 
       108 
111 
     | 
    
         
             
                    get "/schemas/ids/#{animal_id}/versions?subject=:.animals:"
         
     | 
| 
       109 
112 
     | 
    
         
             
                    result = JSON.parse(last_response.body)
         
     | 
| 
       110 
113 
     | 
    
         | 
| 
       111 
114 
     | 
    
         
             
                    expect(result).to eq [{
         
     | 
| 
       112 
     | 
    
         
            -
                       
     | 
| 
       113 
     | 
    
         
            -
                       
     | 
| 
      
 115 
     | 
    
         
            +
                      "subject" => ":.animals:cats",
         
     | 
| 
      
 116 
     | 
    
         
            +
                      "version" => 1
         
     | 
| 
       114 
117 
     | 
    
         
             
                    }]
         
     | 
| 
       115 
118 
     | 
    
         
             
                  end
         
     | 
| 
       116 
119 
     | 
    
         
             
                end
         
     | 
| 
       117 
120 
     | 
    
         
             
              end
         
     | 
| 
       118 
121 
     | 
    
         | 
| 
       119 
     | 
    
         
            -
              describe  
     | 
| 
       120 
     | 
    
         
            -
                it  
     | 
| 
       121 
     | 
    
         
            -
                   
     | 
| 
      
 122 
     | 
    
         
            +
              describe "GET /schemas/ids/:schema_id" do
         
     | 
| 
      
 123 
     | 
    
         
            +
                it "returns schema by id", :aggregate_failures do
         
     | 
| 
      
 124 
     | 
    
         
            +
                  pet_schema = schema(name: "pet_ferret")
         
     | 
| 
       122 
125 
     | 
    
         | 
| 
       123 
     | 
    
         
            -
                  post  
     | 
| 
       124 
     | 
    
         
            -
                  pet_id = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 126 
     | 
    
         
            +
                  post "/subjects/ferret/versions", {schema: pet_schema}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 127 
     | 
    
         
            +
                  pet_id = JSON.parse(last_response.body).fetch("id")
         
     | 
| 
       125 
128 
     | 
    
         | 
| 
       126 
129 
     | 
    
         
             
                  get "/schemas/ids/#{pet_id}"
         
     | 
| 
       127 
130 
     | 
    
         
             
                  result = JSON.parse(last_response.body)
         
     | 
| 
       128 
131 
     | 
    
         | 
| 
       129 
     | 
    
         
            -
                  expect(result[ 
     | 
| 
      
 132 
     | 
    
         
            +
                  expect(result["schema"]).to eq(pet_schema)
         
     | 
| 
       130 
133 
     | 
    
         | 
| 
       131 
134 
     | 
    
         
             
                  get "/schemas/ids/#{pet_id}?subject=:.:"
         
     | 
| 
       132 
135 
     | 
    
         
             
                  default_context_result = JSON.parse(last_response.body)
         
     | 
| 
       133 
136 
     | 
    
         | 
| 
       134 
     | 
    
         
            -
                  expect(default_context_result[ 
     | 
| 
      
 137 
     | 
    
         
            +
                  expect(default_context_result["schema"]).to eq(pet_schema)
         
     | 
| 
       135 
138 
     | 
    
         
             
                end
         
     | 
| 
       136 
139 
     | 
    
         | 
| 
       137 
     | 
    
         
            -
                it  
     | 
| 
       138 
     | 
    
         
            -
                   
     | 
| 
      
 140 
     | 
    
         
            +
                it "returns schema by id from a non default context" do
         
     | 
| 
      
 141 
     | 
    
         
            +
                  pet_schema = schema(name: "pet_ferret_too")
         
     | 
| 
       139 
142 
     | 
    
         | 
| 
       140 
     | 
    
         
            -
                  post  
     | 
| 
       141 
     | 
    
         
            -
                  pet_id = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 143 
     | 
    
         
            +
                  post "/subjects/:.pets:ferret/versions", {schema: pet_schema}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 144 
     | 
    
         
            +
                  pet_id = JSON.parse(last_response.body).fetch("id")
         
     | 
| 
       142 
145 
     | 
    
         | 
| 
       143 
146 
     | 
    
         
             
                  get "/schemas/ids/#{pet_id}?subject=:.pets:"
         
     | 
| 
       144 
147 
     | 
    
         
             
                  result = JSON.parse(last_response.body)
         
     | 
| 
       145 
148 
     | 
    
         | 
| 
       146 
     | 
    
         
            -
                  expect(result[ 
     | 
| 
      
 149 
     | 
    
         
            +
                  expect(result["schema"]).to eq(pet_schema)
         
     | 
| 
       147 
150 
     | 
    
         
             
                end
         
     | 
| 
       148 
151 
     | 
    
         
             
              end
         
     | 
| 
       149 
152 
     | 
    
         | 
| 
       150 
     | 
    
         
            -
              describe  
     | 
| 
       151 
     | 
    
         
            -
                context  
     | 
| 
      
 153 
     | 
    
         
            +
              describe "GET /subjects" do
         
     | 
| 
      
 154 
     | 
    
         
            +
                context "with a clean registry" do
         
     | 
| 
       152 
155 
     | 
    
         
             
                  before do
         
     | 
| 
       153 
156 
     | 
    
         
             
                    FakeConfluentSchemaRegistryServer.clear
         
     | 
| 
       154 
157 
     | 
    
         
             
                  end
         
     | 
| 
       155 
158 
     | 
    
         | 
| 
       156 
159 
     | 
    
         
             
                  it "returns subjects from all contexts", :aggregate_failures do
         
     | 
| 
       157 
     | 
    
         
            -
                    post  
     | 
| 
       158 
     | 
    
         
            -
                    post  
     | 
| 
      
 160 
     | 
    
         
            +
                    post "/subjects/ferret/versions", {schema: schema(name: "ferret")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 161 
     | 
    
         
            +
                    post "/subjects/:.pets:cat/versions", {schema: schema(name: "pet_cat")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
       159 
162 
     | 
    
         | 
| 
       160 
163 
     | 
    
         
             
                    get "/subjects"
         
     | 
| 
       161 
164 
     | 
    
         
             
                    result = JSON.parse(last_response.body)
         
     | 
| 
       162 
165 
     | 
    
         | 
| 
       163 
     | 
    
         
            -
                    expect(result).to include( 
     | 
| 
       164 
     | 
    
         
            -
                    expect(result).to include( 
     | 
| 
      
 166 
     | 
    
         
            +
                    expect(result).to include("ferret")
         
     | 
| 
      
 167 
     | 
    
         
            +
                    expect(result).to include(":.pets:cat")
         
     | 
| 
       165 
168 
     | 
    
         
             
                  end
         
     | 
| 
       166 
169 
     | 
    
         
             
                end
         
     | 
| 
       167 
170 
     | 
    
         
             
              end
         
     | 
| 
       168 
171 
     | 
    
         | 
| 
       169 
     | 
    
         
            -
              describe  
     | 
| 
       170 
     | 
    
         
            -
                it  
     | 
| 
       171 
     | 
    
         
            -
                  post  
     | 
| 
       172 
     | 
    
         
            -
                  post  
     | 
| 
      
 172 
     | 
    
         
            +
              describe "GET /subjects/:subject/versions" do
         
     | 
| 
      
 173 
     | 
    
         
            +
                it "returns versions of the schema" do
         
     | 
| 
      
 174 
     | 
    
         
            +
                  post "/subjects/gerbil/versions", {schema: schema(name: "v1")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 175 
     | 
    
         
            +
                  post "/subjects/gerbil/versions", {schema: schema(name: "v2")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
       173 
176 
     | 
    
         | 
| 
       174 
177 
     | 
    
         
             
                  get "/subjects/gerbil/versions"
         
     | 
| 
       175 
178 
     | 
    
         
             
                  result = JSON.parse(last_response.body)
         
     | 
| 
         @@ -178,9 +181,9 @@ describe FakeConfluentSchemaRegistryServer do 
     | 
|
| 
       178 
181 
     | 
    
         
             
                  expect(result).to include(2)
         
     | 
| 
       179 
182 
     | 
    
         
             
                end
         
     | 
| 
       180 
183 
     | 
    
         | 
| 
       181 
     | 
    
         
            -
                it  
     | 
| 
       182 
     | 
    
         
            -
                  post  
     | 
| 
       183 
     | 
    
         
            -
                  post  
     | 
| 
      
 184 
     | 
    
         
            +
                it "returns does not see versions ion another context" do
         
     | 
| 
      
 185 
     | 
    
         
            +
                  post "/subjects/gerbil/versions", {schema: schema(name: "v1")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 186 
     | 
    
         
            +
                  post "/subjects/:.test:gerbil/versions", {schema: schema(name: "v2")}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
       184 
187 
     | 
    
         | 
| 
       185 
188 
     | 
    
         
             
                  get "/subjects/:.test:gerbil/versions"
         
     | 
| 
       186 
189 
     | 
    
         
             
                  result = JSON.parse(last_response.body)
         
     | 
| 
         @@ -189,29 +192,29 @@ describe FakeConfluentSchemaRegistryServer do 
     | 
|
| 
       189 
192 
     | 
    
         
             
                end
         
     | 
| 
       190 
193 
     | 
    
         
             
              end
         
     | 
| 
       191 
194 
     | 
    
         | 
| 
       192 
     | 
    
         
            -
              describe  
     | 
| 
       193 
     | 
    
         
            -
                it  
     | 
| 
       194 
     | 
    
         
            -
                  schema1 = schema(name:  
     | 
| 
       195 
     | 
    
         
            -
                  post  
     | 
| 
       196 
     | 
    
         
            -
                  id1 = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 195 
     | 
    
         
            +
              describe "GET /subjects/:subject/versions/:version", :aggregate_failures do
         
     | 
| 
      
 196 
     | 
    
         
            +
                it "returns the schema by version" do
         
     | 
| 
      
 197 
     | 
    
         
            +
                  schema1 = schema(name: "v1")
         
     | 
| 
      
 198 
     | 
    
         
            +
                  post "/subjects/gerbil/versions", {schema: schema1}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 199 
     | 
    
         
            +
                  id1 = JSON.parse(last_response.body).fetch("id")
         
     | 
| 
       197 
200 
     | 
    
         | 
| 
       198 
     | 
    
         
            -
                  schema2 = schema(name:  
     | 
| 
       199 
     | 
    
         
            -
                  post  
     | 
| 
       200 
     | 
    
         
            -
                  id2 = JSON.parse(last_response.body).fetch( 
     | 
| 
      
 201 
     | 
    
         
            +
                  schema2 = schema(name: "v2")
         
     | 
| 
      
 202 
     | 
    
         
            +
                  post "/subjects/gerbil/versions", {schema: schema2}.to_json, "CONTENT_TYPE" => "application/vnd.schemaregistry+json"
         
     | 
| 
      
 203 
     | 
    
         
            +
                  id2 = JSON.parse(last_response.body).fetch("id")
         
     | 
| 
       201 
204 
     | 
    
         | 
| 
       202 
     | 
    
         
            -
                  get  
     | 
| 
      
 205 
     | 
    
         
            +
                  get "/subjects/gerbil/versions/1"
         
     | 
| 
       203 
206 
     | 
    
         
             
                  result = JSON.parse(last_response.body)
         
     | 
| 
       204 
     | 
    
         
            -
                  expect(result[ 
     | 
| 
       205 
     | 
    
         
            -
                  expect(result[ 
     | 
| 
       206 
     | 
    
         
            -
                  expect(result[ 
     | 
| 
       207 
     | 
    
         
            -
                  expect(result[ 
     | 
| 
      
 207 
     | 
    
         
            +
                  expect(result["subject"]).to eq("gerbil")
         
     | 
| 
      
 208 
     | 
    
         
            +
                  expect(result["version"]).to eq(1)
         
     | 
| 
      
 209 
     | 
    
         
            +
                  expect(result["id"]).to eq(id1)
         
     | 
| 
      
 210 
     | 
    
         
            +
                  expect(result["schema"]).to eq(schema1)
         
     | 
| 
       208 
211 
     | 
    
         | 
| 
       209 
     | 
    
         
            -
                  get  
     | 
| 
      
 212 
     | 
    
         
            +
                  get "/subjects/gerbil/versions/2"
         
     | 
| 
       210 
213 
     | 
    
         
             
                  result = JSON.parse(last_response.body)
         
     | 
| 
       211 
     | 
    
         
            -
                  expect(result[ 
     | 
| 
       212 
     | 
    
         
            -
                  expect(result[ 
     | 
| 
       213 
     | 
    
         
            -
                  expect(result[ 
     | 
| 
       214 
     | 
    
         
            -
                  expect(result[ 
     | 
| 
      
 214 
     | 
    
         
            +
                  expect(result["subject"]).to eq("gerbil")
         
     | 
| 
      
 215 
     | 
    
         
            +
                  expect(result["version"]).to eq(2)
         
     | 
| 
      
 216 
     | 
    
         
            +
                  expect(result["id"]).to eq(id2)
         
     | 
| 
      
 217 
     | 
    
         
            +
                  expect(result["schema"]).to eq(schema2)
         
     | 
| 
       215 
218 
     | 
    
         
             
                end
         
     | 
| 
       216 
219 
     | 
    
         
             
              end
         
     | 
| 
       217 
220 
     | 
    
         | 
| 
         @@ -220,7 +223,7 @@ describe FakeConfluentSchemaRegistryServer do 
     | 
|
| 
       220 
223 
     | 
    
         
             
                  type: "record",
         
     | 
| 
       221 
224 
     | 
    
         
             
                  name: name,
         
     | 
| 
       222 
225 
     | 
    
         
             
                  fields: [
         
     | 
| 
       223 
     | 
    
         
            -
                    { 
     | 
| 
      
 226 
     | 
    
         
            +
                    {name: "name", type: "string"}
         
     | 
| 
       224 
227 
     | 
    
         
             
                  ]
         
     | 
| 
       225 
228 
     | 
    
         
             
                }.to_json
         
     | 
| 
       226 
229 
     | 
    
         
             
              end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: avro_turf
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.20.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Daniel Schierbeck
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
         
     | 
| 
       9 
8 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
9 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 10 
     | 
    
         
            +
            date: 1980-01-02 00:00:00.000000000 Z
         
     | 
| 
       12 
11 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
12 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
13 
     | 
    
         
             
              name: avro
         
     | 
| 
         @@ -34,16 +33,22 @@ dependencies: 
     | 
|
| 
       34 
33 
     | 
    
         
             
              name: excon
         
     | 
| 
       35 
34 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       36 
35 
     | 
    
         
             
                requirements:
         
     | 
| 
       37 
     | 
    
         
            -
                - - " 
     | 
| 
      
 36 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       38 
37 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       39 
38 
     | 
    
         
             
                    version: '0.104'
         
     | 
| 
      
 39 
     | 
    
         
            +
                - - "<"
         
     | 
| 
      
 40 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 41 
     | 
    
         
            +
                    version: '2'
         
     | 
| 
       40 
42 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       41 
43 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       42 
44 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       43 
45 
     | 
    
         
             
                requirements:
         
     | 
| 
       44 
     | 
    
         
            -
                - - " 
     | 
| 
      
 46 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       45 
47 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       46 
48 
     | 
    
         
             
                    version: '0.104'
         
     | 
| 
      
 49 
     | 
    
         
            +
                - - "<"
         
     | 
| 
      
 50 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 51 
     | 
    
         
            +
                    version: '2'
         
     | 
| 
       47 
52 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       48 
53 
     | 
    
         
             
              name: bundler
         
     | 
| 
       49 
54 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -90,14 +95,14 @@ dependencies: 
     | 
|
| 
       90 
95 
     | 
    
         
             
              name: fakefs
         
     | 
| 
       91 
96 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       92 
97 
     | 
    
         
             
                requirements:
         
     | 
| 
       93 
     | 
    
         
            -
                - - " 
     | 
| 
      
 98 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       94 
99 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       95 
100 
     | 
    
         
             
                    version: '3'
         
     | 
| 
       96 
101 
     | 
    
         
             
              type: :development
         
     | 
| 
       97 
102 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       98 
103 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       99 
104 
     | 
    
         
             
                requirements:
         
     | 
| 
       100 
     | 
    
         
            -
                - - " 
     | 
| 
      
 105 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       101 
106 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       102 
107 
     | 
    
         
             
                    version: '3'
         
     | 
| 
       103 
108 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
         @@ -170,7 +175,6 @@ dependencies: 
     | 
|
| 
       170 
175 
     | 
    
         
             
                - - ">="
         
     | 
| 
       171 
176 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       172 
177 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       173 
     | 
    
         
            -
            description: 
         
     | 
| 
       174 
178 
     | 
    
         
             
            email:
         
     | 
| 
       175 
179 
     | 
    
         
             
            - dasch@zendesk.com
         
     | 
| 
       176 
180 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -233,6 +237,7 @@ files: 
     | 
|
| 
       233 
237 
     | 
    
         
             
            - spec/core_ext/true_class_spec.rb
         
     | 
| 
       234 
238 
     | 
    
         
             
            - spec/disk_cached_confluent_schema_registry_spec.rb
         
     | 
| 
       235 
239 
     | 
    
         
             
            - spec/messaging_spec.rb
         
     | 
| 
      
 240 
     | 
    
         
            +
            - spec/mutable_schema_store_spec.rb
         
     | 
| 
       236 
241 
     | 
    
         
             
            - spec/schema_store_spec.rb
         
     | 
| 
       237 
242 
     | 
    
         
             
            - spec/schema_to_avro_patch_spec.rb
         
     | 
| 
       238 
243 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
         @@ -268,31 +273,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       268 
273 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       269 
274 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       270 
275 
     | 
    
         
             
            requirements: []
         
     | 
| 
       271 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       272 
     | 
    
         
            -
            signing_key: 
         
     | 
| 
      
 276 
     | 
    
         
            +
            rubygems_version: 3.6.9
         
     | 
| 
       273 
277 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       274 
278 
     | 
    
         
             
            summary: A library that makes it easier to use the Avro serialization format from
         
     | 
| 
       275 
279 
     | 
    
         
             
              Ruby
         
     | 
| 
       276 
     | 
    
         
            -
            test_files:
         
     | 
| 
       277 
     | 
    
         
            -
            - spec/avro_turf_spec.rb
         
     | 
| 
       278 
     | 
    
         
            -
            - spec/cached_confluent_schema_registry_spec.rb
         
     | 
| 
       279 
     | 
    
         
            -
            - spec/confluent_schema_registry_spec.rb
         
     | 
| 
       280 
     | 
    
         
            -
            - spec/core_ext/date_spec.rb
         
     | 
| 
       281 
     | 
    
         
            -
            - spec/core_ext/enumerable_spec.rb
         
     | 
| 
       282 
     | 
    
         
            -
            - spec/core_ext/false_class_spec.rb
         
     | 
| 
       283 
     | 
    
         
            -
            - spec/core_ext/hash_spec.rb
         
     | 
| 
       284 
     | 
    
         
            -
            - spec/core_ext/nil_class_spec.rb
         
     | 
| 
       285 
     | 
    
         
            -
            - spec/core_ext/numeric_spec.rb
         
     | 
| 
       286 
     | 
    
         
            -
            - spec/core_ext/string_spec.rb
         
     | 
| 
       287 
     | 
    
         
            -
            - spec/core_ext/symbol_spec.rb
         
     | 
| 
       288 
     | 
    
         
            -
            - spec/core_ext/time_spec.rb
         
     | 
| 
       289 
     | 
    
         
            -
            - spec/core_ext/true_class_spec.rb
         
     | 
| 
       290 
     | 
    
         
            -
            - spec/disk_cached_confluent_schema_registry_spec.rb
         
     | 
| 
       291 
     | 
    
         
            -
            - spec/messaging_spec.rb
         
     | 
| 
       292 
     | 
    
         
            -
            - spec/schema_store_spec.rb
         
     | 
| 
       293 
     | 
    
         
            -
            - spec/schema_to_avro_patch_spec.rb
         
     | 
| 
       294 
     | 
    
         
            -
            - spec/spec_helper.rb
         
     | 
| 
       295 
     | 
    
         
            -
            - spec/support/authorized_fake_confluent_schema_registry_server.rb
         
     | 
| 
       296 
     | 
    
         
            -
            - spec/support/authorized_fake_prefixed_confluent_schema_registry_server.rb
         
     | 
| 
       297 
     | 
    
         
            -
            - spec/support/confluent_schema_registry_context.rb
         
     | 
| 
       298 
     | 
    
         
            -
            - spec/test/fake_confluent_schema_registry_server_spec.rb
         
     | 
| 
      
 280 
     | 
    
         
            +
            test_files: []
         
     |