Skip to content

chore: Support anonymously embedded fields for audit diffs #5746

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

Merged
merged 4 commits into from
Jan 17, 2023

Conversation

Kira-Pilot
Copy link
Member

@Kira-Pilot Kira-Pilot commented Jan 17, 2023

PR adds support for anonymously embedded structs in audit diffs. Named nested structs are still not supported.

Anonymous structs can reasonably be recursively flattened to the top level struct. This is to support #5730.

The example type in question. It is easiest to anonymously embed the Group type that is auto generated with Sqlc. The Group type's fields should be treated as top level fields.

type AuditableGroup struct {
	Group
	Members []GroupMember `json:"members"`
}

@Kira-Pilot Kira-Pilot requested a review from Emyrk January 17, 2023 15:27
- Unit tests for anonymously embedded structs
- Add docs and refactor code around
@Emyrk Emyrk changed the title Nested anon struc pairing chore: Jan 17, 2023
@Emyrk Emyrk changed the title chore: chore: Support anonymously embedded fields for audit diffs Jan 17, 2023
@Emyrk Emyrk marked this pull request as ready for review January 17, 2023 16:21
@Emyrk
Copy link
Member

Emyrk commented Jan 17, 2023

@coadler What do you think about expanding anonymous fields like this?

I intentionally am avoiding using named nested structs, since that adds hierarchy complexity. Anonymous fields being expanded like this adds some convenience for the other PR linked in the description.

@Emyrk Emyrk requested a review from coadler January 17, 2023 16:23
Copy link
Contributor

@coadler coadler left a comment

Choose a reason for hiding this comment

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

I like the addition!

@Emyrk Emyrk merged commit f0eddba into main Jan 17, 2023
@Emyrk Emyrk deleted the nested-anon-struc-pairing branch January 17, 2023 18:13
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2023
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.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy