Skip to content

Deprecate Entity Apply#6305

Merged
armanbilge merged 1 commit into
http4s:mainfrom
diesalbla:avoid_entity_apply
Apr 14, 2023
Merged

Deprecate Entity Apply#6305
armanbilge merged 1 commit into
http4s:mainfrom
diesalbla:avoid_entity_apply

Conversation

@diesalbla

@diesalbla diesalbla commented Apr 17, 2022

Copy link
Copy Markdown
Contributor

Since Entity.Stream is not a good default, because of the overhead of dealing with streams, we deprecate the Entity.apply method in favour of a explicit stream constructor.

We also add a explicit string constructor for strict entities.

@satorg

satorg commented Apr 17, 2022

Copy link
Copy Markdown
Contributor

Agree. I am kind of 👍 for getting rid of over-use of apply methods in favor of explicitly named static ones.

@rossabaker rossabaker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 in principle, but I'm pro-deprecation.

Comment thread core/shared/src/main/scala/org/http4s/Entity.scala Outdated
@diesalbla diesalbla force-pushed the avoid_entity_apply branch 3 times, most recently from a19bec5 to ae5a922 Compare April 24, 2022 11:25
@mergify mergify Bot added the module:circe label Apr 24, 2022

@danicheg danicheg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Despite a few suggestions below, this is great 👍

Comment thread core/shared/src/main/scala/org/http4s/Entity.scala
Comment thread core/shared/src/main/scala/org/http4s/Entity.scala Outdated
@diesalbla diesalbla force-pushed the avoid_entity_apply branch 2 times, most recently from 0e1c072 to b4b8864 Compare May 10, 2022 11:27
@diesalbla diesalbla force-pushed the avoid_entity_apply branch 2 times, most recently from 4206bd4 to 2be91aa Compare December 17, 2022 17:57
@diesalbla diesalbla force-pushed the avoid_entity_apply branch 2 times, most recently from eb5a798 to 216c7ca Compare December 25, 2022 19:05
@diesalbla diesalbla marked this pull request as ready for review December 25, 2022 19:12
@diesalbla diesalbla force-pushed the avoid_entity_apply branch 2 times, most recently from dca8a3d to e9f9b51 Compare December 31, 2022 19:11
@diesalbla diesalbla changed the title Remove Entity Apply Deprecate Entity Apply Dec 31, 2022
Comment thread core/shared/src/main/scala/org/http4s/Entity.scala Outdated
Comment thread core/shared/src/main/scala/org/http4s/Entity.scala Outdated
@diesalbla diesalbla force-pushed the avoid_entity_apply branch 2 times, most recently from 230fce9 to 5492a1e Compare January 1, 2023 12:53

@danicheg danicheg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I want to drop out one bikeshedding about renaming Entity.Default -> Entity.Streamed (or any other that would highlight the streaming nature of that entity). Besides that, this PR makes sense to me!

Comment thread core/shared/src/main/scala/org/http4s/multipart/Part.scala Outdated
@danicheg danicheg requested a review from a team January 1, 2023 19:13
@danicheg

danicheg commented Jan 1, 2023

Copy link
Copy Markdown
Member

I advise getting one more like before getting this merged.

@rossabaker rossabaker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like it. But if this merges without a scalafix, providing one should be a separate ticket.

Comment thread core/shared/src/main/scala/org/http4s/Entity.scala Outdated
Comment thread core/shared/src/main/scala/org/http4s/Entity.scala
Since we may want to steer code away from the streamed entities as a
default, we should deprecate the Entity.apply method in favour of a
explicit `stream` constructor...

We also rename the Entity.Default class to Entity.Streamed.

Additionally, we add a couple of constructors for strict entities,
`string` and `utf8String`.
@armanbilge armanbilge merged commit 81ffaaa into http4s:main Apr 14, 2023
armanbilge added a commit that referenced this pull request Apr 14, 2023
armanbilge added a commit that referenced this pull request Apr 14, 2023
Fix semantic merge conflicts following #6305
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.

6 participants