Skip to content

Conversation

jkmassel
Copy link
Contributor

Adds the ability to detect namespace and endpoint registration. This makes it possible for applications to answer questions like:

  1. Does this site support the Gutenberg Editor Manifest?
  2. Does this site support using Application Passwords for XML-RPC, or to fetch post previews?

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

@jkmassel jkmassel requested review from oguzkocer and crazytonyli and removed request for oguzkocer September 15, 2025 21:56
@jkmassel jkmassel self-assigned this Sep 15, 2025
#[derive(Debug, Deserialize)]
pub struct OptionStringVecOrString {
#[serde(deserialize_with = "deserialize_string_vec_or_string_as_option")]
#[serde(default)]
Copy link
Contributor Author

@jkmassel jkmassel Sep 15, 2025

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.

@jkmassel jkmassel force-pushed the add/feature-detection branch 2 times, most recently from eadb4d3 to 6df7ae7 Compare September 17, 2025 17:24
#[serde(deserialize_with = "deserialize_string_vec_or_string_as_option")]
#[serde(default)]
pub r#type: Option<Vec<String>>,
pub r#enum: Option<Vec<String>>,
Copy link
Contributor

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?

Copy link
Contributor Author

@jkmassel jkmassel Sep 18, 2025

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@jkmassel jkmassel force-pushed the add/feature-detection branch from 6df7ae7 to 71376df Compare September 18, 2025 21:39
@jkmassel jkmassel merged commit 620c549 into trunk Sep 22, 2025
22 checks passed
@jkmassel jkmassel deleted the add/feature-detection branch September 22, 2025 03:39
@jkmassel jkmassel mentioned this pull request Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants