{"id":23229003,"url":"https://github.com/common-workflow-language/schema_salad","last_synced_at":"2025-07-03T22:35:54.372Z","repository":{"id":36669451,"uuid":"40975824","full_name":"common-workflow-language/schema_salad","owner":"common-workflow-language","description":"Semantic Annotations for Linked Avro Data","archived":false,"fork":false,"pushed_at":"2025-05-30T13:14:56.000Z","size":3138,"stargazers_count":77,"open_issues_count":89,"forks_count":62,"subscribers_count":32,"default_branch":"main","last_synced_at":"2025-05-30T17:33:49.257Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.commonwl.org/v1.2/SchemaSalad.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/common-workflow-language.png","metadata":{"funding":{"custom":["https://www.commonwl.org/donate/","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=Z55VS5LBBSZTJ"]},"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-08-18T14:11:27.000Z","updated_at":"2025-05-30T13:14:58.000Z","dependencies_parsed_at":"2023-09-24T16:01:32.377Z","dependency_job_id":"503bf478-261a-4111-b11c-27f2a39acf21","html_url":"https://github.com/common-workflow-language/schema_salad","commit_stats":{"total_commits":1028,"total_committers":46,"mean_commits":"22.347826086956523","dds":0.7461089494163424,"last_synced_commit":"744c084601f30d371864b0b76dbd755dd52a3a43"},"previous_names":[],"tags_count":164,"template":false,"template_full_name":null,"purl":"pkg:github/common-workflow-language/schema_salad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/common-workflow-language%2Fschema_salad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/common-workflow-language%2Fschema_salad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/common-workflow-language%2Fschema_salad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/common-workflow-language%2Fschema_salad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/common-workflow-language","download_url":"https://codeload.github.com/common-workflow-language/schema_salad/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/common-workflow-language%2Fschema_salad/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263415862,"owners_count":23463106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-19T01:15:51.531Z","updated_at":"2025-07-03T22:35:54.326Z","avatar_url":"https://github.com/common-workflow-language.png","language":"Python","funding_links":["https://www.commonwl.org/donate/","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=Z55VS5LBBSZTJ"],"categories":["Tools"],"sub_categories":["BBedit"],"readme":"|Linux Build Status| |Code coverage| |Documentation Status| |CII Best Practices|\n\n.. |Linux Build Status| image:: https://github.com/common-workflow-language/schema_salad/actions/workflows/ci-tests.yml/badge.svg?branch=main\n   :target: https://github.com/common-workflow-language/schema_salad/actions/workflows/ci-tests.yml\n.. |Code coverage| image:: https://codecov.io/gh/common-workflow-language/schema_salad/branch/main/graph/badge.svg\n   :target: https://codecov.io/gh/common-workflow-language/schema_salad\n.. |Documentation Status| image:: https://readthedocs.org/projects/schema-salad/badge/?version=latest\n   :target: https://schema-salad.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation Status\n.. |CII Best Practices| image:: https://bestpractices.coreinfrastructure.org/projects/1867/badge\n   :target: https://bestpractices.coreinfrastructure.org/projects/1867\n\nSchema Salad\n------------\n\nSalad is a schema language for describing JSON or YAML structured\nlinked data documents.  Salad schema describes rules for\npreprocessing, structural validation, and hyperlink checking for\ndocuments described by a Salad schema. Salad supports rich data\nmodeling with inheritance, template specialization, object\nidentifiers, object references, documentation generation, code\ngeneration, and transformation to RDF_. Salad provides a bridge\nbetween document and record oriented data modeling and the Semantic\nWeb.\n\nThe Schema Salad library is Python 3.9+ only.\n\nInstallation\n------------\n\n::\n\n   pip3 install schema_salad\n\nIf you intend to use the `schema-salad-tool --codegen=python` feature, please\ninclude the `[pycodegen]` extra::\n\n   pip3 install schema_salad[pycodegen]\n\nTo install from source::\n\n   git clone https://github.com/common-workflow-language/schema_salad\n   cd schema_salad\n   pip3 install .\n   # or pip3 install .[pycodegen] if needed\n\nCommands\n--------\n\nSchema salad can be used as a command line tool or imported as a Python module::\n\n   $ schema-salad-tool\n   usage: schema-salad-tool [-h] [--rdf-serializer RDF_SERIALIZER] [--skip-schemas]\n                         [--strict-foreign-properties] [--print-jsonld-context]\n                         [--print-rdfs] [--print-avro] [--print-rdf] [--print-pre]\n                         [--print-index] [--print-metadata] [--print-inheritance-dot]\n                         [--print-fieldrefs-dot] [--codegen language] [--codegen-target CODEGEN_TARGET]\n                         [--codegen-examples directory] [--codegen-package dotted.package]\n                         [--codegen-copyright copyright_string] [--print-oneline]\n                         [--print-doc] [--strict | --non-strict]\n                         [--verbose | --quiet | --debug] [--only ONLY] [--redirect REDIRECT]\n                         [--brand BRAND] [--brandlink BRANDLINK] [--brandstyle BRANDSTYLE]\n                         [--brandinverse] [--primtype PRIMTYPE] [--version]\n                         [schema] [document]\n\n   $ python\n   \u003e\u003e\u003e import schema_salad\n\nValidate a schema::\n\n   $ schema-salad-tool myschema.yml\n\nValidate a document using a schema::\n\n   $ schema-salad-tool myschema.yml mydocument.yml\n\nGenerate HTML documentation::\n\n   $ schema-salad-tool --print-doc myschema.yml \u003e myschema.html\n   $ # or\n   $ schema-salad-doc myschema.yml \u003e myschema.html\n\nGet JSON-LD context::\n\n   $ schema-salad-tool --print-jsonld-context myschema.yml mydocument.yml\n\nConvert a document to JSON-LD::\n\n   $ schema-salad-tool --print-pre myschema.yml mydocument.yml \u003e mydocument.jsonld\n\nGenerate Python classes for loading/generating documents described by the schema\n(Requires the `[pycodegen]` extra)::\n\n   $ schema-salad-tool --codegen=python myschema.yml \u003e myschema.py\n\nDisplay inheritance relationship between classes as a graphviz 'dot' file and\nrender as SVG::\n\n   $ schema-salad-tool --print-inheritance-dot myschema.yml | dot -Tsvg \u003e myschema.svg\n\nCodegen Examples\n----------------\n\nThe examples in the tables below are helpful to see how to use the output of `schema-salad-tool --codegen`\nin different languages for loading and/or creating/editing/saving objects.\n\nFirst set of examples is using the `CWL v1.2 schema \u003chttps://github.com/common-workflow-language/cwl-v1.2/blob/1.2.1_proposed/CommonWorkflowLanguage.yml\u003e`_:\n\n+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Language    | Repository                                              | Serialization Example                                                                                                                                 | Deserialization Example                                                                                                                                                   |\n+=============+=========================================================+======================================================================================================================================================+============================================================================================================================================================================+\n| Python      | https://github.com/common-workflow-language/cwl-utils/  | `create_cwl_from_objects.py \u003chttps://github.com/common-workflow-language/cwl-utils/blob/main/create_cwl_from_objects.py\u003e`_                           | `load_document() \u003chttps://github.com/common-workflow-language/cwl-utils/blob/main/cwl_utils/parser/__init__.py#L93\u003e`_                                                      |\n+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| Java        | https://github.com/common-workflow-language/cwljava/    | (Not yet implemented)                                                                                                                                | `PackedWorkflowClassTest.java \u003chttps://github.com/common-workflow-language/cwljava/blob/cwl-1.2.0/src/test/java/org/w3id/cwl/cwl1_2/utils/PackedWorkflowClassTest.java\u003e`_  |\n+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| TypeScript  | https://github.com/common-workflow-lab/cwl-ts-auto      | `Creating, editing, and saving CWL docs with TypeScript \u003chttps://github.com/common-workflow-lab/cwl-ts-auto#creating-editing-and-saving-documents\u003e`_ | `Loading CWL documents with TypeScript \u003chttps://github.com/common-workflow-lab/cwl-ts-auto#loading-documents\u003e`_                                                            |\n+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| .Net        | https://github.com/common-workflow-lab/CWLDotNet        | `Creating, editing, and saving CWL docs with .Net \u003chttps://github.com/common-workflow-lab/CWLDotNet#creating-editing-and-serializing-documents\u003e`_    | `Loading CWL documents with .Net \u003chttps://github.com/common-workflow-lab/CWLDotNet#loading-documents\u003e`_                                                                    |\n+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| C++         | https://github.com/common-workflow-lab/cwl-cpp-auto     | `cwl_output_example.cpp \u003chttps://github.com/common-workflow-lab/cwl-cpp-auto/blob/main/cwl_output_example.cpp\u003e`_                                     | `cwl_input_example.cpp \u003chttps://github.com/common-workflow-lab/cwl-cpp-auto/blob/main/cwl_input_example.cpp\u003e`_                                                             |\n+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| D           | https://github.com/common-workflow-lab/cwl-d-auto       | `How to use \u003chttps://github.com/common-workflow-lab/cwl-d-auto#how-to-use\u003e`_                                                                         | `How to use \u003chttps://github.com/common-workflow-lab/cwl-d-auto#how-to-use\u003e`_                                                                                               |\n+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n\nSecond set of examples is for the `Galaxy Workflow Format 2 \u003chttps://github.com/galaxyproject/gxformat2/\u003e`_ schema:\n\n+-------------+------------------------------------------------------------------------------------+\n| Language    | Path                                                                               |\n+=============+====================================================================================+\n| Python      | https://github.com/galaxyproject/gxformat2/blob/master/gxformat2/schema/v19_09.py  |\n+-------------+------------------------------------------------------------------------------------+\n| Java        | https://github.com/galaxyproject/gxformat2/tree/master/java                        |\n+-------------+------------------------------------------------------------------------------------+\n| TypeScript  | https://github.com/galaxyproject/gxformat2/tree/master/typescript                  |\n+-------------+------------------------------------------------------------------------------------+\n\nQuick Start\n-----------\n\nLet's say you have a 'basket' record that can contain items measured either by\nweight or by count.  Here's an example::\n\n   basket:\n     - product: bananas\n       price: 0.39\n       per: pound\n       weight: 1\n     - product: cucumbers\n       price: 0.79\n       per: item\n       count: 3\n\nWe want to validate that all the expected fields are present, the\nmeasurement is known, and that \"count\" cannot be a fractional value.\nHere is an example schema to do that::\n\n   - name: Product\n     doc: |\n       The base type for a product.  This is an abstract type, so it\n       can't be used directly, but can be used to define other types.\n     type: record\n     abstract: true\n     fields:\n       product: string\n       price: float\n\n   - name: ByWeight\n     doc: |\n       A product, sold by weight.  Products may be sold by pound or by\n       kilogram.  Weights may be fractional.\n     type: record\n     extends: Product\n     fields:\n       per:\n         type:\n           type: enum\n           symbols:\n             - pound\n             - kilogram\n         jsonldPredicate: '#per'\n       weight: float\n\n   - name: ByCount\n     doc: |\n       A product, sold by count.  The count must be a integer value.\n     type: record\n     extends: Product\n     fields:\n       per:\n         type:\n           type: enum\n           symbols:\n             - item\n         jsonldPredicate: '#per'\n       count: int\n\n   - name: Basket\n     doc: |\n       A basket of products.  The 'documentRoot' field indicates it is a\n       valid starting point for a document.  The 'basket' field will\n       validate subtypes of 'Product' (ByWeight and ByCount).\n     type: record\n     documentRoot: true\n     fields:\n       basket:\n         type:\n           type: array\n           items: Product\n\nYou can check the schema and document in schema_salad/tests/basket_schema.yml\nand schema_salad/tests/basket.yml::\n\n   $ schema-salad-tool basket_schema.yml basket.yml\n   Document `basket.yml` is valid\n\n\nDocumentation\n-------------\n\nSee the specification_ and the metaschema_ (salad schema for itself).  For an\nexample application of Schema Salad see the Common Workflow Language_.\n\n\nRationale\n---------\n\nThe JSON data model is an popular way to represent structured data.  It is\nattractive because of it's relative simplicity and is a natural fit with the\nstandard types of many programming languages.  However, this simplicity comes\nat the cost that basic JSON lacks expressive features useful for working with\ncomplex data structures and document formats, such as schemas, object\nreferences, and namespaces.\n\nJSON-LD is a W3C standard providing a way to describe how to interpret a JSON\ndocument as Linked Data by means of a \"context\".  JSON-LD provides a powerful\nsolution for representing object references and namespaces in JSON based on\nstandard web URIs, but is not itself a schema language.  Without a schema\nproviding a well defined structure, it is difficult to process an arbitrary\nJSON-LD document as idiomatic JSON because there are many ways to express the\nsame data that are logically equivalent but structurally distinct.\n\nSeveral schema languages exist for describing and validating JSON data, such as\nJSON Schema and Apache Avro data serialization system, however none\nunderstand linked data.  As a result, to fully take advantage of JSON-LD to\nbuild the next generation of linked data applications, one must maintain\nseparate JSON schema, JSON-LD context, RDF schema, and human documentation,\ndespite significant overlap of content and obvious need for these documents to\nstay synchronized.\n\nSchema Salad is designed to address this gap.  It provides a schema language\nand processing rules for describing structured JSON content permitting URI\nresolution and strict document validation.  The schema language supports linked\ndata through annotations that describe the linked data interpretation of the\ncontent, enables generation of JSON-LD context and RDF schema, and production\nof RDF triples by applying the JSON-LD context.  The schema language also\nprovides for robust support of inline documentation.\n\n.. _JSON-LD: http://json-ld.org\n.. _Avro: http://avro.apache.org\n.. _metaschema: https://github.com/common-workflow-language/schema_salad/blob/main/schema_salad/metaschema/metaschema.yml\n.. _specification: http://www.commonwl.org/v1.2/SchemaSalad.html\n.. _Language: https://github.com/common-workflow-language/cwl-v1.2/blob/v1.2.0/CommandLineTool.yml\n.. _RDF: https://www.w3.org/RDF/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommon-workflow-language%2Fschema_salad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommon-workflow-language%2Fschema_salad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommon-workflow-language%2Fschema_salad/lists"}