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

add mermaid generation to schema policy command #145

Merged
merged 1 commit into from
Jul 24, 2023

Conversation

mikemrm
Copy link
Contributor

@mikemrm mikemrm commented Jul 24, 2023

This adds the ability to generate a mermaid chart from the schema policy to help with visualizing the resource relationships.
Simply run permissions-api schema --mermaid or permissions-api schema --mermaid-markdown to output the diagram.

Example output of the default policy document:

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

This adds the ability to generate a mermaid chart from the schema policy
to help with visualizing the resource relationships.

Signed-off-by: Mike Mason <[email protected]>
@mikemrm mikemrm marked this pull request as ready for review July 24, 2023 13:49
@mikemrm mikemrm requested review from a team as code owners July 24, 2023 13:49
@mikemrm mikemrm merged commit b1835ab into infratographer:main Jul 24, 2023
@mikemrm mikemrm deleted the generate-mermaid-diagrams branch July 24, 2023 14:10
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