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

Use string constants for region names #32

Merged
merged 3 commits into from
Jan 9, 2019
Merged

Use string constants for region names #32

merged 3 commits into from
Jan 9, 2019

Conversation

dpgao
Copy link
Collaborator

@dpgao dpgao commented Jan 3, 2019

Currently region names are encoded as cases in an enum. This is not flexible enough for situations where custom S3-compatible services are used. This pull request changes them to be represented by constant strings.

/// name of the region, see RegionName
public let name: RegionName
/// name of the region, see Name
public let name: String
Copy link
Collaborator

Choose a reason for hiding this comment

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

this introduces a breaking change that won't bring much benefit to most users, could you please keep the original enum (it was Codable so you can store info about easily in a db for example) and just add .custom(String) as a case? I thought that's what was suggested on discord?

@dpgao
Copy link
Collaborator Author

dpgao commented Jan 3, 2019 via email

@rafiki270
Copy link
Collaborator

@dpgao so I have been thinking about this long and hard and think that we could create a new protocol called RegionConvertible: CustomStringConvertible which would any type which adheres to the protocol ... including string. The reason for this is that I am not a big fan of generalising custom typed properties to generic strings, ints, etc as it makes slightly less clear to the developer what should go in and what format ...

@dpgao
Copy link
Collaborator Author

dpgao commented Jan 8, 2019

The reason for this is that I am not a big fan of generalising custom typed properties to generic strings, ints, etc as it makes slightly less clear to the developer what should go in and what format ...

Why not make region type confirm to ExpressibleByStringLiteral? This way people can either use the property accessor notation (e.g. .usEast1) or just pass in a string literal, which would automatically be converted to have the region type.

@rafiki270
Copy link
Collaborator

I guess that would work for me too ... :)

@rafiki270
Copy link
Collaborator

@dpgao would you mind getting in touch on LiveUI Slack or Vapor Discord? I am @rafiki270 on both

@dpgao dpgao merged commit 528112a into LiveUI:master Jan 9, 2019
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.

2 participants