-
Notifications
You must be signed in to change notification settings - Fork 476
Use full entity name as a default (fixes #779) #786
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
Use full entity name as a default (fixes #779) #786
Conversation
I just wanted to resolve this: ``` - model.to_s.split('::').last + model.to_s ``` But I met a problem that it receives Class type in here https://github.com/ruby-grape/grape-swagger/blob/8abddd5f2ce5fe29238990b136625f34371b0be0/lib/grape-swagger/endpoint.rb#L354 But String type in the another place, where the type is generated. So, splitting and taking the last actually returns the same as `name` method of the class. That is very strange I think. Also, if we, for example, use such constructions, we end up with just `V1` and `V2` fron the `A::B` module as they are parsed first: ```ruby module A module B class V1 < Grape::Entity ... class V2 < Grape::Entity ... module A module C class V1 < Grape::Entity ... class V2 < Grape::Entity ... ``` This PR fixes this issue.
* [#786](https://github.com/ruby-grape/grape-swagger/pull/786): Use full entity name as a default - [@mrexox](https://github.com/mrexox) Generated by 🚫 danger |
3 similar comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add an upgrade entry, so the users know about the changes, thanks
will release it as 1.1.0
@LeFnord , added an upgrade entry. Does it look fine? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @mrexox
will release it tonight |
) * Use full entity name as a default (fixes ruby-grape#779) I just wanted to resolve this: ``` - model.to_s.split('::').last + model.to_s ``` But I met a problem that it receives Class type in here https://github.com/ruby-grape/grape-swagger/blob/8abddd5f2ce5fe29238990b136625f34371b0be0/lib/grape-swagger/endpoint.rb#L354 But String type in the another place, where the type is generated. So, splitting and taking the last actually returns the same as `name` method of the class. That is very strange I think. Also, if we, for example, use such constructions, we end up with just `V1` and `V2` fron the `A::B` module as they are parsed first: ```ruby module A module B class V1 < Grape::Entity ... class V2 < Grape::Entity ... module A module C class V1 < Grape::Entity ... class V2 < Grape::Entity ... ``` This PR fixes this issue. * Update CHANGELOG * Fix for old Ruby versions * Skip Representable:: prefix just like Entity:: * Add upgrade entry and move changelog entry from fixes to features scope
In this PR I just wanted to end with this:
But I met a problem that it receives Class type in here
grape-swagger/lib/grape-swagger/endpoint.rb
Line 354 in 8abddd5
But String type in the another place. So, splitting by
::
and taking the last word actually returns the same asname
method of the class. This is fine, but...For example, if we use such constructions, we end up with just
V1
andV2
from theA::B
module as it is parsed first:This PR fixes this issue.