From 4925ec1f43e78012adba8c2abcc70dd878fd9ad4 Mon Sep 17 00:00:00 2001 From: matthewpeterkort Date: Thu, 15 Aug 2024 12:05:10 -0700 Subject: [PATCH] Adds readme --- README.md | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index a4ff180..fb62238 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,39 @@ ## Setup To install, from root: + ``` go install . ``` ``` -jsonschemagraph Usage: jsonschemagraph [command] Available Commands: - completion Generate the autocompletion script for the specified shell - gen-graph Gen graph - help Help about any command - schema-graph Schema graph - schema-lint Schema lint + completion Generate the autocompletion script for the specified shell + data-validate Data Validate + gen-dir Generates edges and vertices from source directory and schema dir + gen-graph Generates edges and vertices from source data files and schemas + help Help about any command + schema-graph Generates a d2 file to visualize graph schema structure + schema-lint Checks a directory of yaml schemas for syntax errors Flags: -h, --help help for jsonschemagraph -Use "jsonschemagraph [command] --help" for more information about a command. +Use "jsonschemagraph [command] --help" for more information about a command ``` To test: + ``` cd cmds/gengraph go test ``` To install d2 graph description language used for schema-graph command: + ``` curl -fsSL https://d2lang.com/install.sh | sh -s -- ``` @@ -37,26 +41,32 @@ curl -fsSL https://d2lang.com/install.sh | sh -s -- Since some of the source data has keys that have null values some of these test cases will fail. This is expected. ## Expected Program Structure: + ```bash +. ├── README.md ├── cmd -│   ├── gengraph +│   ├── data_validate +│   │   └── main.go +│   ├── gen_dir +│   │   └── main.go +│   ├── gen_graph │   │   ├── main.go -│   │   └── main_test.go +│   │   ├── main_test.go +│   │   └── schema.json │   ├── root.go +│   ├── schema_graph +│   │   └── main.go │   └── schema_lint │   └── main.go -├── go.mod -├── go.sum ├── main.go -├── data/ -├── schemas/ -├── output/ └── util ├── delete_empty.go ├── generate.go ├── loader.go ├── methods.go + ├── read_file.go + ├── tools.go └── validate.go ``` @@ -67,10 +77,13 @@ Output is an example name of the directory that the edges and vertices will be o Schemas is the location of your schema files ## Example Commands + Generate edge and vertex files + ``` jsonschemagraph gen-graph [schema_directory_location] [data_file_location] [output_directory_location] [schema_class_name] ``` + SWAPI Example: jsonschemagraph gen-graph schemas/ data/swapi/swapi_character.json.gz output character BMEG Example: jsonschemagraph gen-graph schemas/bmeg_schemas data/ensembl_transcript.json.gz output Transcript @@ -80,13 +93,14 @@ FHIR Example: jsonschemagraph gen-graph schemas/all_fhir_schemas aced-data/actua Note: the fhir data used in the above example is an ndjson file of FHIR Observations Check to see if the schemas in a directory are valid + ``` jsonschemagraph schema-lint [schema_directory_location] ``` Generate a d2 graphical representation of a directory of graph schemas + ``` jsonschemagraph schema-graph [schema_directory_location] > in.d2 d2 --watch in.d2 out.svg ``` -