-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested Exposure attributes are flatten in documents #112
Comments
module API::Entities
class Contact < Grape::Entity
expose :name, documentation: { type: String }
expose :contact_info do
expose :phone, documentation: { type: String }
expose :email, documentation: { type: String }
end
end
end in rails c, {
"name": {
"type": "String"
},
"phone": {
"type": "String"
},
"email": {
"type": "String"
}
} |
just read source code, seems not very easy to fix. now i have to move nested exposures to another entity to make document right module API::Entities
class ContactInfo < Grape::Entity
expose :phone, documentation: { type: String }
expose :email, documentation: { type: String }
end
class Contact < Grape::Entity
expose :name, documentation: { type: String }
expose :object, as: :contact_info, using: API::Entities::ContactInfo,
documentation: { type: 'API::ContactInfo' }
end
end |
+1 |
1 similar comment
+1 |
The problem
But we cannot introduce this #151 fixes this flattening issue but now Maybe it's worth to introduce a |
I also think that for now nested exposures with |
This one reaches many goals at once: - Fixes ruby-grape#56: now `exposures` is not a hash table but an array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112 - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb` - Fixes ruby-grape#152 - Fixes ruby-grape#153 - Fixes ruby-grape#155 - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
This one reaches many goals at once: - Fixes ruby-grape#56: now `exposures` is not a hash table but an array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112 - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb` - Fixes ruby-grape#152 - Fixes ruby-grape#153 - Fixes ruby-grape#155 - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%. Version is bumbed to 0.5.0.
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%. Version is bumbed to 0.5.0.
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%. Version is bumbed to 0.5.0.
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 20-30%.
This one reaches many goals at once: - Fixes ruby-grape#56. - `exposures` hash table is removed and substituted with `root_exposures` array. - Due to previous point, tree structure `nested_exposures` based on flat hash table with keys like `root_node__node__node` is removed because now double exposures don't rewrite previously defined so such tree structure is simply incorrect. `NestingExposure` with an array of children is introduced instead. - Ones who want an old rewriting behavior should manually `unexpose`. - Fixes ruby-grape#112. - Fixes ruby-grape#149: runtime `options` are now wrapped in an `Options` object. - Fixes ruby-grape#150: see new `spec/grape_entity/exposure_spec.rb`. - Fixes ruby-grape#152. - Fixes ruby-grape#153. - Fixes ruby-grape#155. - Fixes ruby-grape#156. - All exposure configuration and exposing strategies are extracted to the separate classes. - `key_for`, `name_for` internal methods are removed. - Much of the overhead is gone so performance is increased by 15-30%.
the Nested Exposure generates incorrect documentation, all nested fields are flatten
it should generate (document)
but now it generates
The text was updated successfully, but these errors were encountered: