Skip to content

Conversation

@ddbeck
Copy link
Collaborator

@ddbeck ddbeck commented May 16, 2024

This is a Baseline 2023 feature, albeit a minor one.

A question here: should we have a fetch group? Or just let this be swept up by fetch snapshots?

This is a Baseline 2023 feature, albeit a minor one.
@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label May 16, 2024
Copy link
Collaborator

@foolip foolip left a comment

Choose a reason for hiding this comment

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

I am really on the fence about this addition. I think we'll have a hard time coming up with guidelines for notability that explains why this is a feature but for example MIDIOutput's clear() isn't.

@ddbeck if we had all of the tools to express composite features, subfeatures, feature evolution, etc., that we've been discussing, do you think this would still have its own identifier?

Comment on lines 1 to 2
name: Response.JSON()
description: The `Response.JSON()` static method creates a `Response` object from a JSON body.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
name: Response.JSON()
description: The `Response.JSON()` static method creates a `Response` object from a JSON body.
name: Response.json()
description: The `Response.json()` static method creates a `Response` object from a JSON body.

@ddbeck
Copy link
Collaborator Author

ddbeck commented May 16, 2024

I am really on the fence about this addition. I think we'll have a hard time coming up with guidelines for notability that explains why this is a feature but for example MIDIOutput's clear() isn't.

I was also on the fence about this one, but we have several other static method features. I think it's only been implied so far, but static methods seem somewhat special. If a static method was a new global method, it'd definitely become a new feature, right?

@ddbeck if we had all of the tools to express composite features, subfeatures, feature evolution, etc., that we've been discussing, do you think this would still have its own identifier?

If we had all of them? No, probably not. I'd probably be OK with this being a later addition on the main fetch feature, unless we had developer feedback that it was distinct (at which point I'd welcome feature composition or other relationships). Single-key features feel like a smell to me. Some probably merit a feature entry (e.g., new JS syntax, new CSS properties, etc.), but I'd prefer to not make them if there's an alternative open to me.

If you like, I can recast this as a later addition comment on fetch and maybe we could spend some time in the first or second week of June to put together a concrete "later additions" proposal (ideally, a PR).

@foolip
Copy link
Collaborator

foolip commented May 16, 2024

I am really on the fence about this addition. I think we'll have a hard time coming up with guidelines for notability that explains why this is a feature but for example MIDIOutput's clear() isn't.

I was also on the fence about this one, but we have several other static method features. I think it's only been implied so far, but static methods seem somewhat special. If a static method was a new global method, it'd definitely become a new feature, right?

A lot of global methods stand on their own, but some like createImageBitmap() are part of a larger feature. But I would say that whenever a global methods ships in isolation, it's almost certainly a new feature. There could be exceptions in principle, but I don't know of any so far.

Static methods more generally I think we can handle like any other API surface, be it constructors, instance methods, properties, or whatnot. CSS.registerProperty() is the entry point to registered custom properties and part of that feature, AudioEncoder.isConfigSupported() is part of WebCodecs, but others like URL.canParse() shipped in isolation and are either standalone features or "later additions". The tradeoff between when we do what is hard.

@ddbeck if we had all of the tools to express composite features, subfeatures, feature evolution, etc., that we've been discussing, do you think this would still have its own identifier?

If we had all of them? No, probably not. I'd probably be OK with this being a later addition on the main fetch feature, unless we had developer feedback that it was distinct (at which point I'd welcome feature composition or other relationships). Single-key features feel like a smell to me. Some probably merit a feature entry (e.g., new JS syntax, new CSS properties, etc.), but I'd prefer to not make them if there's an alternative open to me.

If you like, I can recast this as a later addition comment on fetch and maybe we could spend some time in the first or second week of June to put together a concrete "later additions" proposal (ideally, a PR).

I think adding this now won't have any long term ill effects, so I'm OK with adding it. But yes, I think it's a good case to figure out as part of a "later additions" model.

Copy link
Collaborator

@foolip foolip left a comment

Choose a reason for hiding this comment

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

Approving to leave the door open to landing this now, or waiting to figure out "later additions". I don't feel strongly enough to make a decision.

@ddbeck
Copy link
Collaborator Author

ddbeck commented Jun 13, 2024

I'm sitting on this until we get later additions. Switching to draft.

@ddbeck ddbeck marked this pull request as draft June 13, 2024 11:20
@ddbeck ddbeck changed the title Add Response.JSON() static method feature Add Response.json() static method feature Jul 2, 2024
@ddbeck ddbeck marked this pull request as ready for review July 2, 2024 11:39
@ddbeck
Copy link
Collaborator Author

ddbeck commented Jul 2, 2024

@foolip I've redone this as a later addition to fetch. What do you think?

@ddbeck ddbeck requested a review from foolip July 2, 2024 11:39
caniuse: fetch
status:
compute_from:
- api.fetch
Copy link
Collaborator

Choose a reason for hiding this comment

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

This single entry would be enough I think, but listing a few more doesn't change anything. We'll need some kind of guidance for what people should prefer, however.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was on the fence about this myself, but here's a possible heuristic:

I looked at the first few code samples on the MDN overview page for the feature. On some of the samples, Headers preceded fetch(), so I figured: where's the first place you're likely to hit a non-available feature? That should go in compute_from.

Though I guess now that I've said this, Response could probably be dropped. Feels… impure to leave just one interface out though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What's wrong with just compute_from: api.fetch?

- api.Response.url
- api.fetch

# baseline: low
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yay, dist grouping works!

@foolip foolip changed the title Add Response.json() static method feature Add Response.json() static method to Fetch Jul 5, 2024
@@ -1,7 +1,13 @@
name: Fetch (initial support)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ddbeck I changed the name here. I feel like we'll have very few "initial support" features left in the long term, but am not sure what the name guideline should be.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call on renaming this. Thank you!

@ddbeck ddbeck merged commit 0b13fa3 into web-platform-dx:main Jul 8, 2024
@ddbeck ddbeck deleted the response-json-static branch July 8, 2024 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature definition Creating or defining new features or groups of features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants