paperclip-rs / paperclip

WIP OpenAPI tooling for Rust.
Apache License 2.0
873 stars 115 forks source link

Set refresh_url to an empty string #484

Closed wzzrd closed 1 year ago

wzzrd commented 1 year ago

The previous value of refresh_url (None) translated into 'null' in the spec, which is not accepted as a proper value, as refresh_url is supposed to have a string value.

To see an example of how this goes wrong, you can create a spec with the old code (i.e. with refresh_url: None) and paste it into editor.swagger.io. You'll get an error. Now generate a spec using this new code (i.e. with refresh_url: "") and the error goes away.

tiagolobocastro commented 1 year ago

@wzzrd seems like this should be raised against the openapiv3 crate if an Option is not a valid type to use here?

wzzrd commented 1 year ago

Fair point. I just looked into why None doesn't result into the refresh_url being omitted for serialization and it looks like the skip_serializing_if option was only added to this field a couple of months ago, in a yet to be tagged version of their crate.

I've asked the team of the openapiv3 crate to tag a release that includes that fix. Hopefully you can release a new paperclip version that pulls in that new update? Thanks for this awesome crate, btw! :)

wzzrd commented 1 year ago

I'll close this PR and open a new one when openapiv3 releases a fixed version of their crate

tiagolobocastro commented 1 year ago

Fair point. I just looked into why None doesn't result into the refresh_url being omitted for serialization and it looks like the skip_serializing_if option was only added to this field a couple of months ago, in a yet to be tagged version of their crate.

I've asked the team of the openapiv3 crate to tag a release that includes that fix. Hopefully you can release a new paperclip version that pulls in that new update? Thanks for this awesome crate, btw! :)

Absolutely, once the PR gets merged I'll create a release. Thanks but props goes for @wafflespeanut! :)

wzzrd commented 1 year ago

Brilliant, the openapiv3 team already released v1.0.2: https://github.com/glademiller/openapiv3/commit/bdd22f046d2bc19ede257504645d31f835545222

That should hopefully fix the refresh_url problem.

@tiagolobocastro thanks!