-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
organization node schema and fixes for lint and tests
Signed-off-by: Daniel Brauer <[email protected]>
- Loading branch information
Showing
6 changed files
with
97 additions
and
31 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
This schema does not handle the org's relationships. Those are handled by other schemas, for example: | ||
* GitHubTeamSchema defines (GitHubOrganization)-[RESOURCE]->(GitHubTeam) | ||
* GitHubUserSchema defines (GitHubUser)-[MEMBER_OF|UNAFFILIATED]->(GitHubOrganization) | ||
(There may be others, these are just two examples.) | ||
""" | ||
from dataclasses import dataclass | ||
|
||
from cartography.models.core.common import PropertyRef | ||
from cartography.models.core.nodes import CartographyNodeProperties | ||
from cartography.models.core.nodes import CartographyNodeSchema | ||
from cartography.models.core.relationships import CartographyRelProperties | ||
|
||
|
||
@dataclass(frozen=True) | ||
class GitHubOrganizationNodeProperties(CartographyNodeProperties): | ||
id: PropertyRef = PropertyRef('url') | ||
username: PropertyRef = PropertyRef('login', extra_index=True) | ||
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True) | ||
|
||
|
||
@dataclass(frozen=True) | ||
class GitHubUserToOrganizationRelProperties(CartographyRelProperties): | ||
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True) | ||
|
||
|
||
@dataclass(frozen=True) | ||
class GitHubOrganizationSchema(CartographyNodeSchema): | ||
label: str = 'GitHubOrganization' | ||
properties: GitHubOrganizationNodeProperties = GitHubOrganizationNodeProperties() | ||
other_relationships = None | ||
sub_resource_relationship = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters