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

Type Name Overhaul #9

Merged
merged 14 commits into from Nov 27, 2023
Merged

Type Name Overhaul #9

merged 14 commits into from Nov 27, 2023

Conversation

zac
Copy link
Member

@zac zac commented Mar 8, 2021

I've gone through the types we use in Endpoints and wanted to unify some naming and clarify some usages.

The biggest change is the renaming of RequestType to Endpoint and the Endpoint type to Definition. So now you create a type conforming to Endpoint which includes a static propertyDefinition and the data and components that plugs into the definition. That felt more appropriate given the name of the library, but open to suggestions for other conventions.

Other renames include:

  • Parameters and HeaderValues to ParameterComponents and HeaderComponents respectively. The idea with this change was to name all the data that gets defined in the Endpoint with the suffix 'components' since they are pieces that plug into the Definition
  • EmptyResponse to EmptyCodable. This was to resolve some confusion since EmptyResponse is used as the Body by default... which isn't a response at all.
  • Headers to Header since it represents a single header.

Still weighing some alternatives though:

  • Empty could be better named EmptyCodable since that's basically what it is (I went ahead and made this change)
  • ErrorDecoder could be ErrorResponseDecoder to match other decoder type names
  • In other places I've removed the Type suffix from protocols, but not for the EnvironmentType case. Could shorten that to just Environment, but that might interfere with SwiftUI annoyingly in some projects. Perhaps we should use a completely different name? Or ServerEnvironment? EndpointEnvironment?

I tried to update the documentation to match, but let me know if you see any issues!

@zac zac marked this pull request as ready for review June 24, 2021 18:34
@zac zac force-pushed the feature/endpoint-type-renaming branch from 628bc0e to 5810ab3 Compare December 19, 2022 19:06
Copy link
Member

@weilikuo weilikuo left a comment

Choose a reason for hiding this comment

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

👍

I'll create a task on Acrylic to migrate to the updated Endpoints

@zac zac merged commit 8bdedd5 into master Nov 27, 2023
@zac zac deleted the feature/endpoint-type-renaming branch November 27, 2023 23:01
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.

None yet

2 participants