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 support for attributes of custom defined types #159

Merged
merged 8 commits into from
Oct 15, 2018

Conversation

shwoodard
Copy link
Contributor

@shwoodard shwoodard commented Oct 5, 2018

This is #136 rebased on top of current google/jsonapi master after merge of #99.

Small adjustments were made,

  1. Updated request.go to address change in structure of handle attribute block
  2. Changed inputs to test for custom types so that where primitives instead of complex values. Tests still pass.
  3. Added a test for type mismatch

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@shwoodard
Copy link
Contributor Author

@CrushedPixel Please confirm that you are ok with my changes to your CL and I will merge this.

@CrushedPixel
Copy link
Contributor

LGTM. Thanks for addressing this!

@shwoodard
Copy link
Contributor Author

@CrushedPixel I realized there're no docs for this. Can you send a PR to this branch with README and godoc comment updates for this functionality. Also, can you write tests for things like,

type MyCustomType map[string]interface{}

type MyCustomSliceType []map[string]interface{}

?

Sorry, I guess we have a little more to do on this.

@shwoodard
Copy link
Contributor Author

https://gist.github.com/shwoodard/9ea721936aee624f3f2f9e20db533961

This test fails. Adding values for the "slicemaptype" property breaks the parser.

Two options, we can fix the parser to support these cases, or we can document that this feature is only meant for types that extend builtins like int32, float64, bool, string, etc.

What do you think, @aren55555, @CrushedPixel?

@aren55555
Copy link
Contributor

In my opinion I think we should support all type permutations for these deep attribute fields/values.

If not, I can see documenting the supported types difficult. Not to mention we will be inundated by GH issues like "Why doesn't type X work as an attr?"

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