Skip to content

feat: V2 common metadata#1636

Merged
jsignell merged 2 commits intov2from
v2-common
Mar 11, 2026
Merged

feat: V2 common metadata#1636
jsignell merged 2 commits intov2from
v2-common

Conversation

@jsignell
Copy link
Member

@jsignell jsignell commented Jan 13, 2026

Related Issue(s):

  • test/v1/test_common_metadata.py passing

Description:

Start on common metadata fields. I am not sure if these should be on all objects or just the ones they are most useful on.

The main benefit is the code completion powered by the static typing on the properties. Right now there is no validation on these setters, but there could be custom validation if needed.

An alternative to this would be to use a pydantic model but that has a few downsides:

  • harder to use with this mixin class inheritance approach
  • harder to use the extra_fields dict as the backing for these common fields
  • adds a dependency on pydantic

PR Checklist:

  • Pre-commit hooks pass (run pre-commit run --all-files)
  • Tests pass (run pytest)
  • Documentation has been updated to reflect changes, if applicable
  • This PR maintains or improves overall codebase code coverage
  • This PR's title is formatted per conventional commits

@jsignell jsignell changed the base branch from main to v2 January 13, 2026 22:55
@gadomski gadomski self-requested a review January 13, 2026 23:06
@jsignell jsignell mentioned this pull request Jan 15, 2026
5 tasks
data = super().to_dict()
data["href"] = self.href
return data
return {"href": self.href, **data}
Copy link
Member Author

Choose a reason for hiding this comment

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

Put the href first in the dict

data["type"] = self.type
data["roles"] = self.roles
data["statistics"] = self.statistics.to_dict() or None
return {k: v for k, v in data.items() if v is not None}
Copy link
Member Author

Choose a reason for hiding this comment

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

I think the default behavior should be no null values in the output dict.

@jsignell jsignell force-pushed the v2-common branch 2 times, most recently from f3d2504 to 3adb93c Compare February 12, 2026 20:07
@jsignell jsignell marked this pull request as ready for review March 6, 2026 20:36
@jsignell
Copy link
Member Author

jsignell commented Mar 6, 2026

We could add some of these to collection and bands as well if you like the approach @gadomski

Copy link
Member

@gadomski gadomski 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 it a lot. While it's verbose, it's explicit, and should make changes/fixes easy while making it very clear what a data structure can do.

@jsignell jsignell merged commit a546576 into v2 Mar 11, 2026
14 checks passed
@jsignell jsignell deleted the v2-common branch March 11, 2026 14:00
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