Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mermaid template #175

Merged
merged 2 commits into from
Oct 10, 2023

Conversation

jnschaeffer
Copy link
Contributor

This PR includes some light fixes to the mermaid template we have for generating graphs based on the schema.

It looks like this when rendered with the default (test) policy:

erDiagram
	role {
		id_prefix permrol
	}
	role }o--o{ subject : subject
	user {
		id_prefix idntusr
	}
	client {
		id_prefix idntcli
	}
	tenant {
		id_prefix tnntten
	}
	tenant }o--o{ tenant : parent
	loadbalancer {
		id_prefix loadbal
		action loadbalancer_get
		action loadbalancer_update
		action loadbalancer_delete
		owner_action loadbalancer_get
		owner_action loadbalancer_update
		owner_action loadbalancer_delete
	}
	loadbalancer }o--o{ resourceowner : owner
	subject {
	}
	subject ||--|| user : alias
	subject ||--|| client : alias
	resourceowner {
		action loadbalancer_create
		action loadbalancer_get
		action loadbalancer_update
		action loadbalancer_list
		action loadbalancer_delete
		parent_action loadbalancer_create
		parent_action loadbalancer_get
		parent_action loadbalancer_update
		parent_action loadbalancer_list
		parent_action loadbalancer_delete
	}
	resourceowner ||--|| tenant : alias
Loading

The mermaid template in the schema command wasn't showing relationship
actions for resources and showed one-to-many relationships between
resources. Technically, we don't keep track of constraints on number
of relationships, so to reflect that in the ER diagram this commit
updates the edges between nodes to reflect that. It also adds related
actions to union types.

Signed-off-by: John Schaeffer <[email protected]>
This commit renames "perm" to "action" in the mermaid template to make
the intent of the attribute a little clearer to consumers.

Signed-off-by: John Schaeffer <[email protected]>
@jnschaeffer jnschaeffer requested review from a team as code owners October 10, 2023 16:17
@jnschaeffer jnschaeffer merged commit 04a7a79 into infratographer:main Oct 10, 2023
4 checks passed
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