Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Feature request: Convert all IDs to v4 UUID #1

Closed
Joshfindit opened this issue Mar 17, 2017 · 5 comments
Closed

Feature request: Convert all IDs to v4 UUID #1

Joshfindit opened this issue Mar 17, 2017 · 5 comments

Comments

@Joshfindit
Copy link
Contributor

A pleasant surprise as an API, thank you.

UUIDs have the benefits of being globally unique, which means that if someone brings in data from an API that returns a UUID, they can use that UUID as the internal ID as well.

If IDs are returned sequentially, the API caller have to create a different ID internally and then map it to the external ID for later updates.

@janaipakos
Copy link
Owner

Thanks, that's interesting. I've never worked with UUID--what do you think is a good way to start converting the IDs? Get a series of random UUID and start plugging them in?

@Joshfindit
Copy link
Contributor Author

Yep. If you were going to convert in one fell swoop, just assign v4 (random) UUIDs to each entry in the database and accept those IDs in place of the numerical ones.
Then, when the database creates a new entry, generate and store the UUID for it.

UUIDs can be generated easily in any programming language I know of as well as linux with uuidgen (OSX has a uuidgen command, but it doesn't follow the spec), and sites like https://www.uuidgenerator.net

@Joshfindit
Copy link
Contributor Author

There's also a discussion going on here: phalt/swapi#74

If you're not concerned about existing integrations, the couple of code lines there look like they would switch the whole API to UUID instead of Integer id.

@Joshfindit
Copy link
Contributor Author

I just realized that ghibliapi doesn't have a database, so if you are willing to drop Integer ids, it's just a matter of changing the ids in the json file.

If that sounds ok to you and you say yes, I'll do up a pull request.

@janaipakos
Copy link
Owner

Sure, I'd appreciate it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants