Skip to content

[DRAFT] use integer ( maybe autoincrement on SQL) ids instead of UUID #328

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

Closed
wants to merge 9 commits into from

Conversation

championswimmer
Copy link
Contributor

this is not a "ready to merge" PR.

I took at look at #320 and it is not adequate to properly support integer IDs
This PR is the entire kitchen sink we need to be able to properly support integer IDs in both graphql and jsonapi.

I need some guidance on how best can this be integrated ? (using a possible resourceConfig.generatedId option)

Signed-off-by: Arnav Gupta <[email protected]>
Signed-off-by: Arnav Gupta <[email protected]>
@@ -34,7 +34,7 @@ createRoute.register = () => {
const theirs = request.params.data
theirResource = _.assign(
{
id: uuid.v4(),
id: 0,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is 0 here as a "DEFAULT" value.
Putting the onus on the store handler (relattionaldb) to treat 0 = DEFAULT and if the value is 0, then generate new id, if not 0, then use it like a client provided id.

see championswimmer/jsonapi-store-sequelize@ee0b9f0#diff-8004fa36f21fa5eeb3c49b89106f6942R9 for example implementation

@pmcnr-hx
Copy link
Contributor

Now that we've merged #320, and as explained there the spec requires the id to be a string, do we still need this PR @championswimmer, or can we close it?

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.

3 participants