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

Add resourceConfig.generateId to disable automatic ID generation. #320

Merged
merged 2 commits into from
Nov 14, 2017

Conversation

wolfgang42
Copy link
Contributor

Closes #259.

@paparomeo
Copy link
Contributor

I'm open to merging this, since there are a number of arguments for it. However, I will need some test coverage to go with the code changes.

@wolfgang42
Copy link
Contributor Author

Of course! I made this change a long time ago and had completely forgotten that it was missing tests. I'll add them in the next couple of days and update the PR.

@wolfgang42
Copy link
Contributor Author

Added tests & documentation.

@championswimmer
Copy link
Contributor

@wolfgang42
I have started maintaining a fork of this https://github.com/coding-blocks/jsonapi-server with primarily the concern of using integer autoincrement ids in my mind. The "id" field is hardcoded all over the place in this implementation, so I did a complete overhaul and changed all mentions to number instead of string/uuid.
You might want to take a look at it.

@wolfgang42
Copy link
Contributor Author

@championswimmer I considered overriding the data type, but the JSON-API spec says:

The values of the id and type members MUST be strings.

In the interests of maintaining a properly conformant API I therefore cast them to strings when they come out of the database and the rest of the code treats them as such; when I put them back in the server handles the casting automatically. Since they're IDs everything else just treats them as opaque anyway.

@paparomeo
Copy link
Contributor

paparomeo commented Oct 31, 2017

@wolfgang42 is correct. I should have time this week to merge this work.

@championswimmer
Copy link
Contributor

@paparomeo @pmcnr-hx @wolfgang42

I have added support for generateId flag in relationaldb too
holidayextras/jsonapi-store-relationaldb#90

Copy link
Contributor

@pmcnr-hx pmcnr-hx left a comment

Choose a reason for hiding this comment

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

👍 Looks great. Thanks again for the contribution. Merging!

@pmcnr-hx pmcnr-hx merged commit bbe97cf into holidayextras:master Nov 14, 2017
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.

4 participants