Skip to content

Add new APIs for overriding Rule - #764

Open
hoangpn wants to merge 2 commits into
line:masterfrom
hoangpn:feature/override_rule_api
Open

Add new APIs for overriding Rule#764
hoangpn wants to merge 2 commits into
line:masterfrom
hoangpn:feature/override_rule_api

Conversation

@hoangpn

@hoangpn hoangpn commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
  • Replace Rule's copy_to() by override() function, providing greater flexibility in usage.
  • Create new APIs for overriding Rules for Service and Project based on the newly created function.

@hoangpn
hoangpn force-pushed the feature/override_rule_api branch 3 times, most recently from edaae0a to 95b1206 Compare August 13, 2026 09:39
We have replaced the copy_to() function of the Rule model with a newly created override() function.
The new function allows for the creation of a new Rule by copying the original Rule and also
overriding its attributes at the time of creation, providing greater flexibility in usage.
We have added a new function to the RuleMixin class. Consequently, new APIs have been generated
that allow users to create a new Rule for a Service or Project by overriding an existing Rule.
These APIs require the original Rule ID and optionally accept other Rule attributes as the
overridden fields. There are constraints for these APIs:
- An overridden Service Rule must inherit from a Site Rule.
- An overridden Project Rule must inherit from a Site Rule or its parent Service Rule.

Although the SiteViewSet also inherits from the RuleMixin class, we disable this API for the
SiteViewSet because we cannot create any Site Rules as overridden Rules.
@hoangpn
hoangpn force-pushed the feature/override_rule_api branch from 95b1206 to de03875 Compare August 13, 2026 09:44
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