{"id":28376633,"url":"https://github.com/apiaryio/mson-ast","last_synced_at":"2025-07-16T18:38:19.353Z","repository":{"id":19245489,"uuid":"22480731","full_name":"apiaryio/mson-ast","owner":"apiaryio","description":"MSON AST Serialization Media Types","archived":true,"fork":false,"pushed_at":"2015-12-03T12:30:01.000Z","size":3050,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-06-26T14:50:49.183Z","etag":null,"topics":["deprecated"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apiaryio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-31T18:48:32.000Z","updated_at":"2024-11-08T09:04:05.000Z","dependencies_parsed_at":"2022-08-01T04:07:57.800Z","dependency_job_id":null,"html_url":"https://github.com/apiaryio/mson-ast","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/apiaryio/mson-ast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiaryio%2Fmson-ast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiaryio%2Fmson-ast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiaryio%2Fmson-ast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiaryio%2Fmson-ast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apiaryio","download_url":"https://codeload.github.com/apiaryio/mson-ast/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apiaryio%2Fmson-ast/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265531326,"owners_count":23783215,"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":["deprecated"],"created_at":"2025-05-30T00:07:27.092Z","updated_at":"2025-07-16T18:38:19.335Z","avatar_url":"https://github.com/apiaryio.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# MSON AST \u0026 Source Map\nThis document defines serialization formats for [MSON][] abstract syntax tree.\nFor the definition of MSON AST Source Map see the [MSON AST Source Map definition][Source Map Definition].\n\n## Deprecation Notice\n\nAs of 2015-08-10 the AST is deprecated and should not be used for new development. The MSON AST has been superseded by [Data Structure Refract Namespace](https://github.com/refractproject/refract-spec/blob/master/namespaces/data-structure-namespace.md). The Data Structure Refract Namespace will be offered by API Blueprint parser harness – [Drafter](https://github.com/apiaryio/drafter).\n\nIf you are relying on MSON AST please contact [@zdne](mailto:z@apiary.io) as soon as possible.\n\n## Version\n- **Version**: 2.0\n- **Created**: 2014-07-31\n- **Updated**: 2014-12-22\n\n## Quick Links\n+ [AST Definition](#ast-definition)\n+ [Media Types](#media-types)\n+ [Example: JSON serialization](#example-json-serialization)\n\n## AST Definition\nFollowing is the definition of MSON AST serializations data structures using the [MSON][] syntax.\n\n\u003e **NOTE:** Refer to the [MSON Specification][] for the explanation of terms used throughout this document.\n\n### Document (object)\nTop-level MSON document or block.\n\n#### Properties\n- `types` (array[[Named Type][]]) - List of top-level [Named Types][] described in the document\n\n### Named Type (object)\nUser-defined named type.\n\n#### Properties\n- `name` ([Type Name][]) - Name of the type being defined\n- `typeDefinition` ([Type Definition][]) - The ancestor type definition\n- `sections` (array[[Type Section][]]) - Ordered list of type sections\n\n### Type Name (enum)\nBase or named type's name.\n\n#### Members\n- `boolean` (string)\n- `string` (string)\n- `number` (string)\n- `array` (string)\n- `enum` (string)\n- `object` (string)\n- ([Symbol][])\n\n### Symbol (object)\nType symbol (identifier).\n\n#### Properties\n- `literal` ([Literal][]) - Name of the symbol\n- `variable`: `false` (boolean, default) - Boolean flag to denote [Variable Type Name][], `true` for variable type name, `false` otherwise\n\n### Type Definition (object)\nDefinition of an instance value type.\n\n#### Properties\n- `typeSpecification` (object)\n    - `name` ([Type Name][]) - Name of the value type in an MSON instance\n    - `nestedTypes` (array[[Type Name][]]) - Array of nested value types, applicable only for types of an `array` or `enum` base type\n\n- `attributes` (array) - List of attributes associated with the type\n    - (enum[string])\n        - `required`\n        - `optional`\n        - `default`\n        - `sample`\n        - `fixed`\n\n### Type Section (object)\nSection of a type. The section can be any of the [Type Sections][] as described in the MSON Specification.\n\n#### Properties\n- `class` (enum[string]) - Denotes the class of the type section\n    - `blockDescription` - Section is a markdown block description\n    - `memberType` - Section holds member type(s) elements\n    - `sample` - Section defines alternate value(s) for member types\n    - `default` - Section defines the default value(s) for member types\n    - `validation` - Reserved for future use\n\n- `content` (enum) - Content of the section based on its class\n    - ([Markdown][]) - Markdown formatted content of the section (for class `blockDescription`)\n    - ([Literal][]) - Literal value for a sub-type of a primitive base type (for `sample` or `default` classes)\n    - ([Elements][]) - Section elements for a sub-type of a structured base type (for `memberType`, `sample` or `default` classes)\n\n### Element (object)\nAn element of a type section. The element holds either a member type (`value` or `property`), [Mixin][] type, [One Of][] type or groups elements in a collection of [Elements][].\n\n#### Properties\n- `class` (enum[string]) - Class of the member object\n    - `property` - Property member type\n    - `value` - Value member type\n    - `mixin` - Mixin type\n    - `oneOf` - One Of type\n    - `group` - Group of other elements\n\n- `content` (enum)\n    - ([Property Member][]) - Property member type (for class `property`)\n    - ([Value Member][]) - Value member type (for class `value`)\n    - ([Mixin][]) - Mixin type (for class `mixin`)\n    - ([One Of][]) - One Of type (for class `oneOf`)\n    - ([Elements][]) - Group of elements (for class `group`)\n\n### Elements (array[[Element][]])\nCollection of elements.\n\n### Property Member ([Value Member][])\nIndividual member of an `object` type structure.\n\n#### Properties\n- `name` ([Property Name][]) - Name of the object property\n\n### Property Name (object)\nName of a property member.\n\n#### Properties\n- One Of\n    - `literal` ([Literal][]) - Literal name of the property\n    - `variable` ([Value Definition][]) - Variable name of the property\n\n### Value Member (object)\nIndividual member of an `array` or `enum` type structure.\n\n#### Properties\n- `description` ([Markdown][]) - Inline description of the member type\n- `valueDefinition` ([Value Definition][]) - The definition of the member's value\n- `sections` (array[[Type Section][]]) - List of member's type sections\n\n### Mixin ([Type Definition][])\nMixin type.\n\n### One Of ([Elements][])\nOne Of type. List of mutually exclusive elements.\n\nNote the only allowed [Element][] classes are are `property`, `mixin`, `oneOf` and `group`.\n\n### Value Definition (object)\nValue definition of a type instance.\n\n#### Properties\n- `values` (array[[Value][]]) - List of values specified in the definition\n- `typeDefinition` ([Type Definition][]) - Type of the value\n\n### Value (object)\nSample or actual value of a type instance\n\n#### Properties\n- `literal` ([Literal][]) - The literal value\n- `variable`: `false` (boolean, default) - `true` to denote variable value, `false` otherwise\n\n### Markdown (string)\nMarkdown formatted plain text string.\n\n### Literal (string)\nLiteral value in the form of a plain-text.\n\n## Media Types\nThe base type media type is `application/vnd.mson.ast`.\n\n### Serialization formats\nTwo supported, feature-equal, serialization formats are JSON and YAML:\n\n+ `application/vnd.mson.ast+json`\n+ `application/vnd.mson.ast+yaml`\n\n### Example: JSON Serialization\nGiven the following [MSON][]\n\n```\n- id: 1 (required)\n- name: A green door\n- price: 12.50 (number)\n- tags: home, green\n- vector (array)\n    - 1\n    - 2\n    - 3\n```\n\n`application/vnd.mson.ast+json; version=2.0`\n\n```json\n{\n  \"types\": [\n    {\n      \"name\": null,\n      \"typeDefinition\": {\n        \"typeSpecification\": {\n          \"name\": \"object\"\n        }\n      },\n      \"sections\": [\n        {\n          \"class\": \"memberType\",\n          \"content\": [\n            {\n              \"class\": \"property\",\n              \"content\": {\n                \"name\": {\n                  \"literal\": \"id\"\n                },\n                \"valueDefinition\": {\n                  \"values\": [\n                    {\n                      \"literal\": \"1\"\n                    }\n                  ],\n                  \"typeDefinition\": {\n                    \"attributes\": [\n                      \"required\"\n                    ]\n                  }\n                }\n              }\n            },\n            {\n              \"class\": \"property\",\n              \"content\": {\n                \"name\": {\n                  \"literal\": \"name\"\n                },\n                \"valueDefinition\": {\n                  \"values\": [\n                    {\n                      \"literal\": \"A green door\"\n                    }\n                  ]\n                }\n              }\n            },\n            {\n              \"class\": \"property\",\n              \"content\": {\n                \"name\": {\n                  \"literal\": \"price\"\n                },\n                \"valueDefinition\": {\n                  \"values\": [\n                    {\n                      \"literal\": \"12.50\"\n                    }\n                  ],\n                  \"typeDefinition\": {\n                    \"typeSpecification\": {\n                      \"name\": \"number\"\n                    }\n                  }\n                }\n              }\n            },\n            {\n              \"class\": \"property\",\n              \"content\": {\n                \"name\": {\n                  \"literal\": \"tags\"\n                },\n                \"valueDefinition\": {\n                  \"values\": [\n                    {\n                      \"literal\": \"home\"\n                    },\n                    {\n                      \"literal\": \"green\"\n                    }\n                  ]\n                }\n              }\n            },\n            {\n              \"class\": \"property\",\n              \"content\": {\n                \"name\": {\n                  \"literal\": \"vector\"\n                },\n                \"valueDefinition\": {\n                  \"typeDefinition\": {\n                    \"typeSpecification\": {\n                      \"name\": \"array\"\n                    }\n                  }\n                },\n                \"sections\": [\n                  {\n                    \"class\": \"memberType\",\n                    \"content\": [\n                      {\n                        \"class\": \"value\",\n                        \"content\": {\n                          \"valueDefinition\": {\n                            \"values\": [\n                              {\n                                \"literal\": \"1\"\n                              }\n                            ]\n                          }\n                        }\n                      },\n                      {\n                        \"class\": \"value\",\n                        \"content\": {\n                          \"valueDefinition\": {\n                            \"values\": [\n                              {\n                                \"literal\": \"2\"\n                              }\n                            ]\n                          }\n                        }\n                      },\n                      {\n                        \"class\": \"value\",\n                        \"content\": {\n                          \"valueDefinition\": {\n                            \"values\": [\n                              {\n                                \"literal\": \"3\"\n                              }\n                            ]\n                          }\n                        }\n                      }\n                    ]\n                  }\n                ]\n              }\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}\n```\n\n## License\n\nMIT License. See the [LICENSE](LICENSE) file.\n\n[MSON]: https://github.com/apiaryio/mson\n[MSON Specification]: https://github.com/apiaryio/mson/blob/master/MSON%20Specification.md\n[Type Sections]: https://github.com/apiaryio/mson/blob/master/MSON%20Specification.md#4-type-sections\n[Named Types]: https://github.com/apiaryio/mson/blob/master/MSON%20Specification.md#22-named-types\n[Variable Type Name]: https://github.com/apiaryio/mson/blob/master/MSON%20Specification.md#3521-variable-type-name\n[Mixin]: https://github.com/apiaryio/mson/blob/master/MSON%20Specification.md#51-mixin-inheritance\n[One Of]: https://github.com/apiaryio/mson/blob/master/MSON%20Specification.md#52-one-of-type\n\n[Named Type]: #named-type-object\n[Type Name]: #type-name-enum\n[Type Definition]: #type-definition-object\n[Type Section]: #type-section-object\n[Symbol]: #symbol-object\n[Element]: #element-object\n[Elements]: #elements-arrayelement\n[Markdown]: #markdown-string\n[Literal]: #literal-string\n[Value]: #value-object\n[Property Member]: #property-member-value-member\n[Value Member]: #value-member-object\n[Mixin]: #mixin-type-definition\n[One Of]: #one-of-elements\n[Property Name]: #property-name-object\n[Value Definition]: #value-definition-object\n[Source Map Definition]: Source%20Map.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiaryio%2Fmson-ast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapiaryio%2Fmson-ast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiaryio%2Fmson-ast/lists"}