Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants