media_types-serialization 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f668e10a02f800afc30da2c1438f99e4a50fb2b726cc829d490998f2f1997933
4
- data.tar.gz: f0d711b09c45a03c7cfbac9238ac6f1e6f6f24b701d631f236b1986f19d80ca2
3
+ metadata.gz: d53689a0c81861b7305fc606a2b73b7866e4b46915284a716951735926b5bb73
4
+ data.tar.gz: 29add50810aa2bf8b3792d38eebd50eca96570c716a33be6ef58a2f64813be81
5
5
  SHA512:
6
- metadata.gz: 9f6e2dec7c6409279f226dc0c6b3dff609273bd72330f055397c0e2f7be54eab5b032d33192590486f898d9cca3f8cedd69c6c1a519e104a56942a40ae4b2565
7
- data.tar.gz: bda722326eca550e19cc8ab656896423f092a8b8c14436a37b4e51c88f0c5191b85a3b682dc3ead1c9e38b277e5a233c4741eb6cddeff5af68b89c3ed0a22230
6
+ metadata.gz: 56db0c8b8f39b108e80d028459b0fc7e788bc9cbfd3b7a1e26dfbab993883d7b19735f2d638e8f17edfbcfb9837f610f30ea46ec61bf84c4c141f45000ae0c36
7
+ data.tar.gz: 2985c51bc0f5b59df56d11fe665dc5be479fa5cf494dbd8edf5e57961464bb5e413f82af8e9e867557bb15dd715542aa5f6f10cd9cd9fb12028899fa00d11bf8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.6
4
+
5
+ - 🐛 Fix issue with `override_detail` of `Problem`
6
+
3
7
  ## 1.3.5
4
8
 
5
9
  - 🐛 Upgrade media-types library so Ruby 2.5 and 2.6 work again
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- media_types-serialization (1.3.5)
4
+ media_types-serialization (1.3.6)
5
5
  actionpack (>= 4.0.0)
6
6
  activesupport (>= 4.0.0)
7
7
  media_types (>= 2.1.1, < 3.0.0)
@@ -75,7 +75,7 @@ GEM
75
75
  racc (~> 1.4)
76
76
  nokogiri (1.12.3-x86_64-linux)
77
77
  racc (~> 1.4)
78
- oj (3.13.2)
78
+ oj (3.13.4)
79
79
  racc (1.5.2)
80
80
  rack (2.2.3)
81
81
  rack-test (1.1.0)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MediaTypes::Serialization
2
2
 
3
- [![Build Status: master](https://travis-ci.com/XPBytes/media_types-serialization.svg)](https://travis-ci.com/XPBytes/media_types-serialization)
3
+ [![Build Status](https://github.com/XPBytes/media_types-serialization/actions/workflows/ci.yml/badge.svg)](https://github.com/XPBytes/media_types-serialization/actions/workflows/ci.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/media_types-serialization.svg)](https://badge.fury.io/rb/media_types-serialization)
5
5
  [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
6
6
 
@@ -16,11 +16,15 @@ gem 'media_types-serialization'
16
16
 
17
17
  And then execute:
18
18
 
19
- $ bundle
19
+ ```shell
20
+ bundle
21
+ ```
20
22
 
21
23
  Or install it yourself as:
22
24
 
23
- $ gem install media_types-serialization
25
+ ```shell
26
+ gem install media_types-serialization
27
+ ```
24
28
 
25
29
  ## Usage
26
30
 
@@ -221,7 +225,7 @@ BookSerializer.serialize(book, BookValidator.version(3), context: controller)
221
225
 
222
226
  There are convenience methods for serializing arrays of objects based on a template.
223
227
 
224
- #### Indexes
228
+ #### Indexes (index based collections)
225
229
 
226
230
  An index is a collection of urls that point to members of the array.
227
231
  The index method automatically generates it based on the `self` links defined in the default view (`view: nil`) of the given version.
@@ -266,7 +270,8 @@ BookSerializer.serialize([book], BookValidator.view(:index).version(3), context:
266
270
 
267
271
  ##### How to validate?
268
272
 
269
- The `index` dsl does _not_ exist in the validation gem. This is how you validate indices:
273
+ The `index` dsl does _not_ exist in the validation gem.
274
+ This is how you validate indices:
270
275
 
271
276
  ```ruby
272
277
  class BookValidator
@@ -283,7 +288,7 @@ class BookValidator
283
288
  version 3 do
284
289
  attribute :books do
285
290
  link :self
286
-
291
+
287
292
  collection :_index, allow_empty: true do
288
293
  attribute :href, String
289
294
  end
@@ -334,7 +339,7 @@ class BookValidator
334
339
  version 3 do
335
340
  attribute :books do
336
341
  link :self
337
-
342
+
338
343
  collection :_index, allow_empty: true do
339
344
  attribute :href, String
340
345
  attribute :isbn, AllowNil(String)
@@ -346,7 +351,7 @@ class BookValidator
346
351
  end
347
352
  ```
348
353
 
349
- #### Collections
354
+ #### Collections (embedding collections)
350
355
 
351
356
  A collection inlines the member objects.
352
357
  The collection method automatically generates it based on the default view of the same version.
@@ -403,7 +408,8 @@ BookSerializer.serialize([book], BookValidator.view(:collection).version(3), con
403
408
  # }
404
409
  ```
405
410
 
406
- The `collection` dsl is _not_ the same as the one in the validation gem. This is how you could validate collections:
411
+ The `collection` dsl is _not_ the same as the one in the validation gem.
412
+ This is how you could validate collections:
407
413
 
408
414
  ```ruby
409
415
  class BookValidator
@@ -420,7 +426,7 @@ class BookValidator
420
426
  version 3 do
421
427
  attribute :books do
422
428
  link :self
423
-
429
+
424
430
  collection :_embedded, allow_empty: true do
425
431
  link :self
426
432
 
@@ -567,7 +573,7 @@ end
567
573
  ### Remapping media type identifiers
568
574
 
569
575
  Sometimes you already have old clients using an `application/json` media type identifier when they do requests.
570
- While this is not a good practise as this makes it hard to add new fields or remove old ones, this library has support for migrating away:
576
+ While this is not a good practice as this makes it hard to add new fields or remove old ones, this library has support for migrating away:
571
577
 
572
578
  ```ruby
573
579
  class BookSerializer < MediaTypes::Serialization::Base
@@ -584,7 +590,7 @@ class BookSerializer < MediaTypes::Serialization::Base
584
590
  attribute :description, obj.description if version >= 2
585
591
  end
586
592
  end
587
-
593
+
588
594
  # applicaton/vnd.acme.book+json
589
595
  output version: nil do |obj, version, context|
590
596
  attribute :book do
@@ -605,7 +611,7 @@ class BookSerializer < MediaTypes::Serialization::Base
605
611
  # Make sure not to save here but only save in the controller
606
612
  book
607
613
  end
608
-
614
+
609
615
  # applicaton/vnd.acme.book.create+json
610
616
  input view: :create, version: nil do |json, version, context|
611
617
  book = Book.new
@@ -618,7 +624,8 @@ class BookSerializer < MediaTypes::Serialization::Base
618
624
  input_alias 'application/json', view: :create # maps application/json to to applicaton/vnd.acme.book.create+json
619
625
  ```
620
626
 
621
- Validation will be done using the remapped validator. Aliasses map to version `nil`. It is not possible to configure this version.
627
+ Validation will be done using the remapped validator. Aliasses map to version `nil`.
628
+ It is not possible to configure this version.
622
629
 
623
630
  ### HTML
624
631
 
@@ -699,12 +706,13 @@ class BookController < ActionController::API
699
706
  end
700
707
  ```
701
708
 
702
- The exception you specified will be rescued by the controller and will be displayed to the user along with a link to the shared wiki page for that error type. Feel free to add instructions there on how clients should solve this problem.
709
+ The exception you specified will be rescued by the controller and will be displayed to the user along with a link to the shared wiki page for that error type.
710
+ Feel free to add instructions there on how clients should solve this problem.
703
711
  You can find more information at: [https://docs.delftsolutions.nl/wiki/Error](https://docs.delftsolutions.nl/wiki/Error)
704
712
  If you want to override this url you can use the `problem_output.url(href)` function.
705
713
 
706
714
  By default the `message` property of the error is used to fill the `details` field.
707
- You can override this by using the `problem_output.override_details(description, lang:)` function.
715
+ You can override this by using the `problem_output.override_detail(description, lang:)` function.
708
716
 
709
717
  Custom attributes can be added using the `problem_output.attribute(name, value)` function.
710
718
 
@@ -31,7 +31,7 @@ module MediaTypes
31
31
 
32
32
  def override_detail(detail, lang:)
33
33
  raise 'Unable to override detail message without having a title in the same language.' unless translations[lang]
34
- translations[lang][:detail] = title
34
+ translations[lang][:detail] = detail
35
35
  end
36
36
 
37
37
  def attribute(name, value)
@@ -1,5 +1,5 @@
1
1
  module MediaTypes
2
2
  module Serialization
3
- VERSION = '1.3.5'.freeze
3
+ VERSION = '1.3.6'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: media_types-serialization
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derk-Jan Karrenbeld
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-08-19 00:00:00.000000000 Z
12
+ date: 2021-11-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack