-
Notifications
You must be signed in to change notification settings - Fork 3
Add Feature Detection #893
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
Conversation
#[derive(Debug, Deserialize)] | ||
pub struct OptionStringVecOrString { | ||
#[serde(deserialize_with = "deserialize_string_vec_or_string_as_option")] | ||
#[serde(default)] |
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.
I don't really like that we need this line, but I couldn't think of an easy way to avoid it.
eadb4d3
to
6df7ae7
Compare
#[serde(deserialize_with = "deserialize_string_vec_or_string_as_option")] | ||
#[serde(default)] | ||
pub r#type: Option<Vec<String>>, | ||
pub r#enum: Option<Vec<String>>, |
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.
What does the r#
mean?
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.
type
and enum
are reserved terms, so you need to do this to use them as field names
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.
6df7ae7
to
71376df
Compare
Adds the ability to detect namespace and endpoint registration. This makes it possible for applications to answer questions like:
I debated whether to implement something like
ApiDetails::supports(WpSiteFeature::ApplicationPasswords)
but this seems like an application-level concern, not a library one. That means some code duplication, but I think it's preferable, because an application will have a better idea of what features it cares about.This PR spawned Automattic/jetpack#45186