hyperium / http

Rust HTTP types
Apache License 2.0
1.15k stars 285 forks source link

Rename UNPROCESSABLE_ENTITY to UNPROCESSABLE_CONTENT #692

Open Pi-Cla opened 6 months ago

Pi-Cla commented 6 months ago

Fix #664

seanmonstar commented 6 months ago

I believe this would be a breaking change, since an existing constant would no longer exist.

@obi1kenobi 👋 curious, is this something that the semver job should be able to notice?

Pi-Cla commented 6 months ago

Is there any way to have there be both a StatusCode:UNPROCESSABLE_ENTITY and a StatusCode:UNPROCESSABLE_CONTENT which point to the same error number? @seanmonstar

I tried to just copy the tuple so that now it looked like this:

/// 422 Unprocessable Content
/// [[RFC9110, Section 15.5.21](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.21)]
(422, UNPROCESSABLE_CONTENT, "Unprocessable Entity");
/// 422 Unprocessable Content
/// [[RFC9110, Section 15.5.21](https://datatracker.ietf.org/doc/html/rfc9110#section-15.5.21)]
(422, UNPROCESSABLE_ENTITY, "Unprocessable Entity");

but that resulted in an unreachable_patterns error up in canonical_reason

seanmonstar commented 6 months ago

I think another PR exists which modifies the macro to allow "aliases".

obi1kenobi commented 6 months ago

I believe this would be a breaking change, since an existing constant would no longer exist.

@obi1kenobi 👋 curious, is this something that the semver job should be able to notice?

Thanks for the ping, I appreciate it!

We currently have the equivalent lint for free (module-level) constants, but don't have the lint for constants inside a type's impl block yet: https://github.com/obi1kenobi/cargo-semver-checks/issues/366#issuecomment-1662820577

It's very easy to add, and we have a few contributors who are actively adding lints right now, so we can prioritize it without any trouble. It'll be in the next release for sure.

seanmonstar commented 6 months ago

Ya no worries, I know it's neverending work. Thanks so much!

obi1kenobi commented 6 months ago

Thank you for using it, and for the supportive feedback! It really helps me prioritize things.

If there are other things that would be useful, I'd love to hear about them! Either a GitHub issue or a 15min chat (and I can file issues as needed) would work. Ultimately a lot of things are funding-limited, but it helps me know what to say users want when I apply for OSS grants!

obi1kenobi commented 5 months ago

Just merged the lint that will catch issues like this going forward: https://github.com/obi1kenobi/cargo-semver-checks/pull/714

It'll be part of the next cargo-semver-checks release, planned for a day two after Rust 1.78 so ~first week of May.

One fewer breaking change that can sneak unnoticed into our crates!

obi1kenobi commented 5 months ago

I ended up cutting a new release earlier than originally planned: https://github.com/obi1kenobi/cargo-semver-checks/releases/tag/v0.31.0

The new inherent_associated_pub_const_missing lint will catch cases like this going forward. Thanks again for your patience and support, and for maintaining so many awesome crates! ❤️