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

Add support for the cf.image field in fetch() properties #351

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jakubadamw
Copy link
Contributor

Per the definition in https://github.com/cloudflare/workerd/blob/4fb4dbd88d30ff293267680d85a31ddef94fd9b6/types/defines/cf.d.ts#L171-L295.

This is based on the existing #233 authored by @seeekr, with some improvements and the completion of the set of properties supported.

@jakubadamw
Copy link
Contributor Author

@zebp any chance this could be reviewed? 🙂

Seems like there generally is a lot of outstanding PRs open and ready to be reviewed. I wonder what the best process of getting one's PR reviewed and merged is here? I think it would make sense to perhaps document the process in the README or, otherwise, external contributors may get discouraged from getting involved, seeing their contributions not picked up for review long after submission? (General observation, nothing personal!)

Copy link
Collaborator

@zebp zebp left a comment

Choose a reason for hiding this comment

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

Some minor changes needed, but looks like it's on the right track.

And yeah I think you hit the nail on the head about the PRs, there's definitely more that should be done to make sure PRs don't stack up and get reviewed in a more timely manner. I like the suggestion of documenting a process for contribution, but I also will start to be more active in reviewing and dealing with issues. In the future please feel free to ping me directly, my Github inbox is a mess but any direct pings give me a notification on my phone that I do check.

}
/// Configuration options for Cloudflare's image resizing feature:
/// <https://developers.cloudflare.com/images/image-resizing/>
#[derive(Clone, Default, serde::Serialize)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should just be Serialize to be consistent with other structs in the module.

pub enum RequestRedirect {
Error,
#[default]
Follow,
Manual,
}

impl From<RequestRedirect> for &str {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know these Into<&str> impls aren't necessary anymore, but it'd be nice to not introduce any breaking changes however unlikely they might actually be.


#[derive(Clone, Copy, Serialize)]
#[serde(rename_all = "kebab-case")]
pub enum ResizeFormat {
Copy link
Collaborator

Choose a reason for hiding this comment

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

/// Configuration options for Cloudflare's image resizing feature:
/// <https://developers.cloudflare.com/images/image-resizing/>
#[derive(Clone, Default, serde::Serialize)]
pub struct ResizeConfig {
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's some more properties defined in the TS types that aren't here like draw and it'd be really nice if these fields were documented as it can be a little overwhelming seeing such a big struct.

https://workers-types.pages.dev/#RequestInitCfPropertiesImage should be handy for porting

seeekr and others added 3 commits October 20, 2024 16:51
…riate Rust + bindgen representations; plus some remaining TODOs and a review comment on related code
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.

3 participants