Title: Do not allow top_level to be a child of another subclass · Issue #285 · networktocode/diffsync · GitHub
Open Graph Title: Do not allow top_level to be a child of another subclass · Issue #285 · networktocode/diffsync
X Title: Do not allow top_level to be a child of another subclass · Issue #285 · networktocode/diffsync
Description: Environment DiffSync version: 2.1 Proposed Functionality Do not allow top_level models to be a child of another subclass. For example, when: class Site(DiffSyncModel): _modelname = "site" _identifiers = ("resource_id",) class Location(Di...
Open Graph Description: Environment DiffSync version: 2.1 Proposed Functionality Do not allow top_level models to be a child of another subclass. For example, when: class Site(DiffSyncModel): _modelname = "site" _identifi...
X Description: Environment DiffSync version: 2.1 Proposed Functionality Do not allow top_level models to be a child of another subclass. For example, when: class Site(DiffSyncModel): _modelname = "site"...
Opengraph URL: https://github.com/networktocode/diffsync/issues/285
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Do not allow top_level to be a child of another subclass","articleBody":"### Environment\r\n* DiffSync version: \u003c!-- Example: 1.0.0 --\u003e\r\n2.1\r\n\r\n\u003c!--\r\n Describe in detail the new functionality you are proposing.\r\n--\u003e\r\n### Proposed Functionality\r\nDo not allow `top_level` models to be a child of another subclass.\r\n\r\nFor example, when:\r\n\r\n```\r\nclass Site(DiffSyncModel):\r\n _modelname = \"site\"\r\n _identifiers = (\"resource_id\",)\r\n\r\nclass Location(DiffSyncModel):\r\n _modelname = \"location\"\r\n _identifiers = (\"resource_id\",)\r\n _children = {\"site\": \"sites\"}\r\n```\r\n\r\nAnd the DiffSync implementation includes:\r\n```\r\nclass MyDiffSync(DiffSync):\r\n top_level = [\"location\", \"site\"]\r\n\r\n location = Location\r\n site = Site\r\n```\r\n\r\nThis configuration causes duplication of site models during diff and sync operations, as they are treated both as independent top-level models and as children of location.\r\n\r\n\u003c!-- Convey an example use case for your proposed feature. Write from the perspective of a user who would benefit from the proposed functionality and describe how. --\u003e\r\n\r\nUse Case\r\nUsers who define complex hierarchies in their DiffSync models would benefit from this feature by avoiding duplication in diff and sync results. This would improve data consistency and ensure that models have clear and non-overlapping roles.\r\n\r\nFor example, if Site is both a top-level model and a child of Location, performing a diff might result in Site objects being reported twice: once as part of the top-level site model and again as part of the location hierarchy. Disallowing this configuration ensures clean and predictable behavior for synchronization processes.\r\n","author":{"url":"https://github.com/daveshm","@type":"Person","name":"daveshm"},"datePublished":"2024-12-11T06:00:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/285/diffsync/issues/285"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6358a2c9-bfde-1b7c-c38a-fa251a2df39d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DD50:1DF7:47123A:5823BA:6991032F |
| html-safe-nonce | b853db8d3a83d7cad157d29073e48ad14e5140f55d2c81888c506025efc2f279 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDUwOjFERjc6NDcxMjNBOjU4MjNCQTo2OTkxMDMyRiIsInZpc2l0b3JfaWQiOiI0MDE3MDcwOTkwODkwNjk3NTIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3ca00111f862a3a6783bfb59cd4c065d489af73f7775d07e5a64c961a6e1b009 |
| hovercard-subject-tag | issue:2731906863 |
| github-keyboard-shortcuts | repository,issues,network-graph,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/networktocode/diffsync/285/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8a88285623267e06646fb94e670231142a82fc77aeb876b29e4d8fb2b01cae2b/networktocode/diffsync/issues/285 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8a88285623267e06646fb94e670231142a82fc77aeb876b29e4d8fb2b01cae2b/networktocode/diffsync/issues/285 |
| og:image:alt | Environment DiffSync version: 2.1 Proposed Functionality Do not allow top_level models to be a child of another subclass. For example, when: class Site(DiffSyncModel): _modelname = "site" _identifi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | daveshm |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/networktocode/diffsync git https://github.com/networktocode/diffsync.git |
| octolytics-dimension-user_id | 13106404 |
| octolytics-dimension-user_login | networktocode |
| octolytics-dimension-repository_id | 292296974 |
| octolytics-dimension-repository_nwo | networktocode/diffsync |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 292296974 |
| octolytics-dimension-repository_network_root_nwo | networktocode/diffsync |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width