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 #136

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CrushedPixel
Copy link
Contributor

This PR adds support and tests for unmarshalling of attributes that have custom types, for example:

type CustomIntType int
type CustomFloatType float64
type CustomStringType string

type CustomAttributeTypes struct {
	ID string `jsonapi:"primary,customtypes"`

	Int        CustomIntType  `jsonapi:"attr,int"`
	IntPtr     *CustomIntType `jsonapi:"attr,intptr"`
	IntPtrNull *CustomIntType `jsonapi:"attr,intptrnull"`

	Float  CustomFloatType  `jsonapi:"attr,float"`
	String CustomStringType `jsonapi:"attr,string"`
}

Previously, unmarshalling a valid JSON API payload into this struct would result in the error data is not a jsonapi representation of *CustomAttributeTypes.

@svanharmelen
Copy link

@shwoodard and @aren55555 it would be great if this PR could get a review. It seems this PR would make a lot of people happy and would possibly close issues/PR's #114/#115, #123/#124.

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