-
-
Notifications
You must be signed in to change notification settings - Fork 884
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
Add skip_serialize_none to OAuth structs with option fields #5046
Changes from 5 commits
446ed54
82a954e
f34bb04
b981bc2
5e0fc4a
78d50c8
20468ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,8 @@ impl Serialize for PublicOAuthProvider { | |
} | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
#[skip_serializing_none] | ||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This struct and the one below arend used anywhere in the api so these derives are not needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ended up needing the derives for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no use for skip_serializing_none if the struct is not exposed in the api. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like its returned in the GetSiteResponse, so it does need it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It only uses OAuthProvider and PublicOAuthProvider, but Im talking about OAuthProviderInsertForm and OAuthProviderUpdateForm which dont need serde derives. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the update and insert form even supposed to be exposed to the API client? If not, I'll remove the ts export from them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No they are only used internally in Rust. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed I removed the TS export stuff from |
||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset, TS))] | ||
#[cfg_attr(feature = "full", diesel(table_name = oauth_provider))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
|
@@ -104,12 +105,13 @@ pub struct OAuthProviderInsertForm { | |
pub client_id: String, | ||
pub client_secret: String, | ||
pub scopes: String, | ||
pub auto_verify_email: bool, | ||
pub account_linking_enabled: bool, | ||
pub enabled: bool, | ||
pub auto_verify_email: Option<bool>, | ||
pub account_linking_enabled: Option<bool>, | ||
pub enabled: Option<bool>, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
#[skip_serializing_none] | ||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset, TS))] | ||
#[cfg_attr(feature = "full", diesel(table_name = oauth_provider))] | ||
#[cfg_attr(feature = "full", ts(export))] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ CREATE TABLE oauth_provider ( | |
scopes text NOT NULL, | ||
auto_verify_email boolean DEFAULT TRUE NOT NULL, | ||
account_linking_enabled boolean DEFAULT FALSE NOT NULL, | ||
enabled boolean DEFAULT FALSE NOT NULL, | ||
enabled boolean DEFAULT TRUE NOT NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if there's some reason this was default false, or if it was just an accident. @privacyguard |
||
published timestamp with time zone DEFAULT now() NOT NULL, | ||
updated timestamp with time zone | ||
); | ||
|
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.
Good catch, those are not null with default, so the insert should be optional.