grape-entity
grape-entity copied to clipboard
`with_options` doesn't do deep merge
with_options documentation: {required: true, type: 'integer'} do
expose :posts_count, as: :posts, documentation: {example: 7}
expose :followers_count, as: :followers, documentation: {example: 105}
expose :following_count, as: :following, documentation: {example: 52}
expose :bookmarks_count, as: :bookmarks, documentation: {example: 22}
end
the example doesn't work, since documentation from nested attributes overrides parent's one.
I think they should be deep merged
I agree that this would be better behavior in this case, but isn't this with_options from ActiveSupport which is sadly not merging options? So it's rather a bug there. This behavior is outlined in the docs. See the first NOTE which goes like this NOTE: Each nesting level will merge inherited defaults in addition to their own. and the text after it.