Skip to content

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