|Version 2 (modified by toidinamai, 6 years ago) (diff)|
YAML needs a schema language. This page is an index of ideas and discussions and proposals about a YAML Schema Language.
- A Schema in the YAML context is something external to a YAML document that adds structural information to the document.
- A Schema Language is a text format for describing a schema.
- Schemas can be used to:
- Indicate the tag to be used for a given node.
- Indicate the required and optional structure of a node.
- Identify invalid content in a node.
- A parser or a loader should be able to apply a schema document to the loading of YAML document.
- A dumper or emitter might be able to use a schema determine the best way to dump a document.
- A Schema Language encoded in YAML is not a requirement, but is at least tempting.
- Almost all use cases for YAML docs that would need an external schema, would only use scalars for mapping keys. It might be useful to specify a schema language in only those terms.
- It might be good to define a more verbose YAML format for Schema, a structure that every parser uses. Then if we want a more compact format for eveyday use, it could be compiled into the more verbose format.
- SchemaProposalYGNI - Ingy's proposal for a schema language.
Example YAML Documents
One good approach to designing a YAML Schema language is to find a big set of real (or realistically ficticious) YAML formats in use, and then designing a language around them. The following is a list of known use cases. Schema proposals should strive to handle all these cases.
http://www.kuwata-lab.com/kwalify/ implements its own syntax for specifying the schema for a YAML document. It's currently available for Java and Ruby only.