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

Fix optional type aliases #272

Merged
merged 4 commits into from
Dec 6, 2020
Merged

Conversation

omid
Copy link
Contributor

@omid omid commented Dec 5, 2020

Fix #257

@omid omid changed the title Fix type aliases Fix optional type aliases Dec 5, 2020
Comment on lines -782 to -784
if p.path.segments.len() == 1 && &ty.ident == "Option" {
is_required = false;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is certainly not what I expected in code. I guess you can't always remember how the code evolves.

@@ -312,6 +316,10 @@ impl<T> Apiv2Schema for Option<T> {
default fn security_scheme() -> Option<SecurityScheme> {
None
}

fn is_required() -> bool {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make this a constant? It's a primitive value after all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done :)

@wafflespeanut
Copy link
Collaborator

One last thing. Can you add/modify a test for it?

Copy link
Collaborator

@wafflespeanut wafflespeanut left a comment

Choose a reason for hiding this comment

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

Thanks!

@wafflespeanut wafflespeanut merged commit 2593987 into paperclip-rs:master Dec 6, 2020
@omid omid deleted the fix_type_aliases branch December 6, 2020 16:50
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.

Actix: type alias makes Option<T> required
2 participants