Skip to content
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

Avoid empty hashes #420

Merged
merged 1 commit into from
May 13, 2016
Merged

Avoid empty hashes #420

merged 1 commit into from
May 13, 2016

Conversation

kzaitsev
Copy link
Contributor

@kzaitsev kzaitsev commented May 11, 2016

Problem:

currently returned empty hash if model parser doesn't registered, swagger-ui doesn't check json object, for empty, and get a null, swagger-ui with swagger 2.0 spec doesn't support null's and not loaded.

Solution:

raise exception if parser for current model not registered or model parsing result contains empty hash, to specify this problem for developer

properties = parser.call unless parser.nil?

if parser.nil?
properties = { unsupported_model_parser: { type: :string, description: "No parser registed for #{model_name}" } }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is capitalized, it should be a full sentence, so ends with a period, please.

@dblock
Copy link
Member

dblock commented May 11, 2016

Seems a little weird to get an error inside the model's JSON output. Shouldn't it just fail and error out if developer action is required?

@kzaitsev
Copy link
Contributor Author

Seems a little weird to get an error inside the model's JSON output. Shouldn't it just fail and error out if developer action is required?

ok, im just add raise GrapeSwagger::Errors::SwaggerSpec, if something going wrong, ok?

@kzaitsev kzaitsev force-pushed the avoid-empty-hashes branch 3 times, most recently from 24d2094 to 67f4f7c Compare May 11, 2016 22:37
@kzaitsev
Copy link
Contributor Author

@dblock done, added two exceptions UnregistredParser and SwaggerSpec, this should helps developers to specify a problem if something going wrong.

Also added mock parser to passing tests without external parser library.

Thanks again, and excuse me for the lack of points in the end of sentences.

@@ -8,7 +8,8 @@
#### Fixes

* [#416](https://github.com/ruby-grape/grape-swagger/pull/416): Support recursive models - [@lest](https://github.com/lest).
* [#418](https://github.com/ruby-grape/grape-swagger/pull/418): Replaced github ref to rubygems for external gems - [@Bugagazavr](https://github.com/Bugagazavr).
* [#419](https://github.com/ruby-grape/grape-swagger/pull/419): Replaced github ref to rubygems for external gems - [@Bugagazavr](https://github.com/Bugagazavr).
* [#420](https://github.com/ruby-grape/grape-swagger/pull/420): Raise SwaggerSpec exception if swagger spec doesn't satified, when no parser for model registred or response model is empty - [@Bugagazavr](https://github.com/Bugagazavr).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling: satiSfied, say "isn't satisfied".

@dblock
Copy link
Member

dblock commented May 11, 2016

Very good. See comments. English is also my third language so no stress, you're doing great ;)

@kzaitsev
Copy link
Contributor Author

@dblock i'l merge this, ok?

@dblock dblock merged commit 218233e into ruby-grape:master May 13, 2016
@dblock
Copy link
Member

dblock commented May 13, 2016

Merged, looks good.

@stefan-kolb
Copy link
Contributor

The extraction of the parser and introducing the GrapeSwagger::Errors::UnregisteredParser breaks usage for every user. Don't you think this should have been at least a minor version increase not only a patch from 0.20.3 to 0.20.4? To be honest, currently everything seems to break for me with every minor version. You are moving really really fast here.

@stefan-kolb
Copy link
Contributor

stefan-kolb commented May 17, 2016

Inside the https://github.com/ruby-grape/grape-swagger/blob/master/UPGRADING.md it is also refered to as a change for 0.21.0

@kzaitsev
Copy link
Contributor Author

sorry, i forgot change upgrading guide.

@stefan-kolb
Copy link
Contributor

By the way to get me right, I don't think this is a good change for 0.20.3 -> 0.20.4. But it should instead be 0.21.0 as it breaks usage for customers!

@kzaitsev
Copy link
Contributor Author

Yes this is breaking changes.

@dblock should we yank this release and publish this changes as 0.21.0?

@dblock
Copy link
Member

dblock commented May 17, 2016

If you think it breaks everyone, yank it.

@LeFnord
Copy link
Member

LeFnord commented May 17, 2016

@Bugagazavr yeap, think it would be good to yank the release, not only of breaking changes, also the support for grape > 0.16.x was announced for 0.21.0 release, but before I want to fix most bugs, to have a (relatively) stable version, which works for most cases 😉

think, we should have a better coordination 😄

@kzaitsev
Copy link
Contributor Author

Agreed, sorry for this, I yank 0.20.4 soon as possible

Sent from my iPhone

On 17 May 2016, at 20:44, peter scholz notifications@github.com wrote:

@Bugagazavr yeap, think it would be good to yank the release, not only of breaking changes, also the support for grape > 0.16.x was announced for 0.21.0 release, but before I want to fix most bugs, to have a (relatively) stable version, which works for most cases 😉

think, we should have a better coordination 😄


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@LeFnord
Copy link
Member

LeFnord commented May 17, 2016

no problem

@dblock
Copy link
Member

dblock commented May 18, 2016

@LeFnord @Bugagazavr Feel free to improve the organizational aspects of this project in whichever way you see fit. However remember that the only thing we ask from contributors is their best effort, aka we ask nothing. Roadmaps tend to become commitments - I suggest replacing them with communicating intent via issues, READMEs and such instead.

@LeFnord
Copy link
Member

LeFnord commented May 18, 2016

@dblock this is meant with … the main goal should be that we go into the same direction 😉

LeFnord pushed a commit to LeFnord/grape-swagger that referenced this pull request Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants