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

YAML and LinkML auto-formatting and enumeration auto-describing #871

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .yamlfmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
formatter:
type: basic
include_document_start: true
max_line_length: 0
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,40 @@ examples/output: src/mixs/schema/mixs.yaml
--output-directory $@ \
--schema $< > $@/README.md

.PHONY: standardize-schema

# |\
# yamlfmt -in -conf .yamlfmt >

standardize-schema:
$(RUN) python src/scripts/describe_enums_by_slots_using.py \
sujaypatil96 marked this conversation as resolved.
Show resolved Hide resolved
--schema_file src/mixs/schema/mixs.yaml \
--output_file src/mixs/schema/mixs_with_enum_descriptions.yaml
$(RUN) gen-linkml \
--format yaml \
--no-mergeimports \
--no-materialize-attributes \
--materialize-patterns src/mixs/schema/mixs_with_enum_descriptions.yaml |\
yq eval '(.. | select(has("from_schema")) | .from_schema) style="" | del(.. | select(has("from_schema")).from_schema)' |\
yq eval '.classes[] |= select(has("annotations")).annotations |= map_values(.value)' |\
yq eval '.prefixes |= map_values(.prefix_reference)' |\
yq eval '.settings |= map_values(.setting_value)' |\
yq eval '.slots[] |= select(has("annotations")).annotations |= map_values(.value)' |\
yq eval 'del(.classes.[].name)' |\
yq eval 'del(.classes.[].slot_usage.[].name)' |\
yq eval 'del(.enums.[].name)' |\
yq eval 'del(.enums.[].permissible_values.[].text)' |\
yq eval 'del(.slots.[].domain)' |\
yq eval 'del(.slots.[].name)' |\
yq eval 'del(.source_file)' |\
yq eval 'del(.subsets.[].name)' | cat > src/mixs/schema/mixs_standardized.yaml
mv src/mixs/schema/mixs_standardized.yaml src/mixs/schema/mixs.yaml
rm -rf src/mixs/schema/mixs_standardized.yaml src/mixs/schema/mixs_with_enum_descriptions.yaml

test1:
echo $$PATH
yamlfmt -conf .yamlfmt src/mixs/schema/mixs.yaml > src/mixs/schema/mixs_standardized.yam

# Test documentation locally
serve: mkd-serve

Expand Down
Loading
Loading