Skip to content

feat: add typed discriminated union models for audit event attributes#31

Merged
kaincenteno merged 1 commit into
mainfrom
audit-events
May 18, 2026
Merged

feat: add typed discriminated union models for audit event attributes#31
kaincenteno merged 1 commit into
mainfrom
audit-events

Conversation

@kaincenteno
Copy link
Copy Markdown
Owner

  • Replaces the flat AuditEvent.Attributes model (with _warn_extra warning validator) with a fully-typed Pydantic discriminated union keyed on eventDataPropertyKey
  • Adds AuditEventCommonAttributes base class with all 11 shared fields
  • Adds 33 concrete *Attributes subclasses — one per audit event type — each with a Literal discriminator and its corresponding typed payload field
  • Adds 33 inner event data models (AuditEventAccountDeleted, -AuditEventDeviceRemovedFromOrg, etc.) covering all payload shapes documented by the Apple Business API, including the AuditEventAccountRoleLocation sub-object
  • Removes unused logging import and model_validator now that _warn_extra is gone

- Replaces the flat AuditEvent.Attributes model (with _warn_extra warning validator) with a fully-typed Pydantic discriminated union keyed on eventDataPropertyKey
- Adds AuditEventCommonAttributes base class with all 11 shared fields
- Adds 33 concrete *Attributes subclasses — one per audit event type — each with a Literal discriminator and its corresponding typed payload field
- Adds 33 inner event data models (AuditEventAccountDeleted, -AuditEventDeviceRemovedFromOrg, etc.) covering all payload shapes documented by the Apple Business API, including the AuditEventAccountRoleLocation sub-object
- Removes unused logging import and model_validator now that _warn_extra is gone
@kaincenteno kaincenteno merged commit 593c7e8 into main May 18, 2026
1 check passed
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.

1 participant