Skip to content

Comments

feat: add nodes field to relay connections#471

Merged
nicolerenee merged 1 commit intoinfratographer:mainfrom
nicolerenee:add_nodes_to_connection
Jul 30, 2025
Merged

feat: add nodes field to relay connections#471
nicolerenee merged 1 commit intoinfratographer:mainfrom
nicolerenee:add_nodes_to_connection

Conversation

@nicolerenee
Copy link
Member

This adds a nodes field to relay connections. With this added it allows GraphQL queries like this:

  location(id: $id) {
    id
    name
    devices {
      nodes {
        id
        name
      }
    }
  }

Which makes it easier to loop through results instead of having to loop through the edges and then node to get the actual list of nodes. This is similar to how GitHub and other public GraphQL APIs provide things through the relay connection.

This is entirely based off of ent/contrib#602 and can be removed once we are on a release that includes that PR.

Signed-off-by: Nicole Hubbard <code@nicole.dev>
@nicolerenee nicolerenee requested a review from a team as a code owner July 29, 2025 21:26
Copy link
Contributor

@mikemrm mikemrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks alright. Thanks

missingField := false
for _, f := range t.Fields {
if !slices.Contains(existingFields, f.Name) {
missingField = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really a huge improvement, but we could break after setting this.

Copy link
Member Author

@nicolerenee nicolerenee Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, but given there should be only 3 fields on a Connection I wasn't to worried about it.

@nicolerenee nicolerenee added this pull request to the merge queue Jul 30, 2025
Merged via the queue into infratographer:main with commit 5fe44de Jul 30, 2025
8 checks passed
@nicolerenee nicolerenee deleted the add_nodes_to_connection branch July 30, 2025 05:49
github-merge-queue bot pushed a commit that referenced this pull request Jul 30, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.13.0](v0.12.0...v0.13.0)
(2025-07-30)


### Features

* add nodes field to relay connections
([#471](#471))
([5fe44de](5fe44de))


### Bug Fixes

* **deps:** update module github.com/99designs/gqlgen to v0.17.78
([#467](#467))
([efc9ba4](efc9ba4))
* **deps:** update module github.com/cenkalti/backoff/v5 to v5.0.3
([#466](#466))
([4b26fc9](4b26fc9))
* **deps:** update module github.com/nats-io/nats.go to v1.44.0
([#470](#470))
([d07d7e1](d07d7e1))
* **deps:** update module github.com/zsais/go-gin-prometheus to v1.0.1
([#464](#464))
([763fa9a](763fa9a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: Infratographer Robot <github-robot@infratographer.com>
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