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

Conversation

netramali
Copy link

NullableRelationship was added in this PR. This PR is to update the README.

Jira

omarismail and others added 30 commits April 20, 2021 11:16
These changes add the ability to unmarshal links members to
links-annotated struct fields.

The specification for links members can be found here:
https://jsonapi.org/format/#document-links

Note that this does not change the existing marshaling behavior of
links (the Linkable interface methods), though a fully fleshed out
implementation probably should - it's awkward that now interface methods
are used to marshal but struct fields for unmarshaling.

In other words, an implementation of links marshaling similar to the
implementation proposed in PR 58 of the canonical google/jsonapi
repository would be most appropriate to pair with these unmarshaling
changes. The actual implementation that was accepted is PR 57, utilizing
those Linkable/Metable interfaces.

From 57:

> After looking at both implementations, I think I'd like to vote for
this one because it feels flexible, and doesn't add any additional
fields to our structs. In general I don't think LINK and META objects
really have much to do with the resource objects themselves, they are
really more related to the context in which the object is used. This
approach keeps structs cleaner.

This is subjectively wrong, and assumes that this package is used in the
context of a server and not a client. In a client, links members can
contain information that is vital to the functionality of the resource
itself, so we add that here.
Co-authored-by: Cameron Stitt <[email protected]>
Unmarshal Links type to 'links' annotated struct fields
Allow attributes to be marshalled for relations
Creates a new annotation that invokes special handling for
the associated field, assigning exactly one of a selection
of models in an intermediate struct. (See README)
polyrelation fields are marshaled as JSON to the first non-nil field within a choice type
Adds test for nil hasOne polyrelation
mukeshjc and others added 28 commits November 19, 2024 11:26
Add CODEOWNERS file in .github/CODEOWNERS
…ted-relation

fix: handle deprecating relation for polyrelation
Unmarshaling an attribute that is a struct or struct pointer that is
decorated with jsonapi tags has historically worked as expected, but,
curiously, marshaling did not and required the use of `json` tags
instead, making struct reuse difficult for both input and output
object attributes.

Now, you can specify a struct or struct pointer as an attribute and
it will be marshaled into the correct keys.

Note that this implemenation does not yet support slices of structs or
struct pointers.
Support nested objects within attributes when Marshaling
Update CODEOWNERS, adding Core Cloud team as co-owners
Prior to release 1.4.0, nested object attributes
could be annotated with `json` tags. To maintain
compatibility, this change adds a detection during
marshaling to check for the presence of `jsonapi`
annotations before trying recursively marshal
those nested objects.
…_marshaling

Support nested object attributes with `json` annotations
…ackoverflow

Bug Fix: Avoid Stack Overflow when provided data model relationships are included and contain circular references
Co-authored-by: Chris Trombley <[email protected]>
Co-authored-by: Chris Trombley <[email protected]>
Co-authored-by: Chris Trombley <[email protected]>
…onship_handling

Revert circular relationship handling
Copy link

google-cla bot commented Apr 2, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@netramali netramali closed this Apr 2, 2025
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.