Skip to content

Feat: Introduce dynamic property mixin and add dynamic props to native view#1366

Open
onefloid wants to merge 5 commits intomasterfrom
feat/dynamic-props-native-view
Open

Feat: Introduce dynamic property mixin and add dynamic props to native view#1366
onefloid wants to merge 5 commits intomasterfrom
feat/dynamic-props-native-view

Conversation

@onefloid
Copy link
Collaborator

What changed

  • Introduce dynamic property mixin
  • Add dynamic property support to native view

@onefloid onefloid added the release:patch Triggers patch version bump (e.g.: 1.4.9 → 1.4.10) label Mar 14, 2026
@MariusWirtz MariusWirtz requested a review from Copilot March 16, 2026 10:24
dynamic_props = self._filter_dynamic_properties(self._dynamic_properties)
if dynamic_props:
bottom_json += "," + json.dumps(dynamic_props, ensure_ascii=False)[1:-1]
bottom_json += "}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks a bit archaic, how we're constructing the JSON here via string concatenation.
This PR is a good opportunity to clean up this part of the code base.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought this was best practice and the project’s recommended approach for building JSON via string concatenation😉
Resolved in def6d56

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a shared mechanism to preserve “dynamic” (extra/unknown) REST properties on view objects and extends that support to NativeView, with accompanying unit/integration tests to validate round-tripping and REST retrieval.

Changes:

  • Added DynamicPropertiesMixin to centralize storage and filtering of extra REST properties via .dynamic_properties.
  • Updated MDXView and NativeView to use the mixin and include dynamic properties in (de)serialization.
  • Added tests covering dynamic properties defaults, constructor behavior, serialization, and REST create/get for native views.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Tests/ViewService_test.py Adds integration test that creates/retrieves/deletes a native view with dynamic properties.
Tests/NativeView_test.py Adds unit tests for NativeView.dynamic_properties defaults, serialization, and from-dict behavior.
TM1py/Services/ViewService.py Adjusts view retrieval to use shared dynamic property filtering for MDX/native views.
TM1py/Objects/NativeView.py Adds dynamic property support and serializes filtered dynamic properties into the request body.
TM1py/Objects/MDXView.py Refactors dynamic property handling to the shared mixin and shared filtering method.
TM1py/Objects/DynamicPropertiesMixin.py New mixin providing .dynamic_properties and _filter_dynamic_properties().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@onefloid onefloid force-pushed the feat/dynamic-props-native-view branch from a5a3924 to 2811513 Compare March 25, 2026 06:26
Replace string concatenation with dictionary-based approach using json.dumps().
This improves readability and maintainability.
seed deterministic cube data to avoid flaky update assertions
@onefloid onefloid force-pushed the feat/dynamic-props-native-view branch from 2811513 to cbb096e Compare March 25, 2026 06:31
@onefloid onefloid force-pushed the feat/dynamic-props-native-view branch from 3c42784 to 746e73b Compare March 25, 2026 06:35
@onefloid
Copy link
Collaborator Author

@MariusWirtz This PR is ready for another review. I cleaned up the commit history and separated refactoring, test fixes, and the feature. I also added explanations to the commits, so it would be great if they could be preserved.

@onefloid onefloid requested a review from MariusWirtz March 25, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:patch Triggers patch version bump (e.g.: 1.4.9 → 1.4.10)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants