Skip to content

Commit 4cf8a12

Browse files
authored
Merge pull request #674 from gilrrei/add_partial_schema
Add schema for partial 4C.yaml files
2 parents 47ea05a + 8ccd0f4 commit 4cf8a12

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

utilities/create_json_schema.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ def main(metadata_path, json_schema_path):
681681
metadata_path (str, pathlib.Path): 4C emitted metadata file path
682682
json_schema_path (str, pathlib.Path): JSON schema file path
683683
"""
684+
json_schema_path = Path(json_schema_path)
684685
metadata_4C, title_section, code_metadata = metadata_object_from_file(metadata_path)
685686
schema = get_schema(metadata_4C)
686687
schema["properties"].update(
@@ -691,6 +692,14 @@ def main(metadata_path, json_schema_path):
691692
}
692693
create_json_schema(schema, code_metadata["commit_hash"], json_schema_path)
693694

695+
# Create partial schema
696+
# Remove required section
697+
schema.pop("required")
698+
json_schema_partial_path = json_schema_path.parent / (
699+
json_schema_path.name + "_partial" + json_schema_path.suffix
700+
)
701+
create_json_schema(schema, code_metadata["commit_hash"], json_schema_partial_path)
702+
694703

695704
if __name__ == "__main__":
696705
parser = argparse.ArgumentParser(

0 commit comments

Comments
 (0)