{"action":"closed","issue":{"url":"https://api.github.com/repos/raml-org/raml-js-parser-2/issues/102","repository_url":"https://api.github.com/repos/raml-org/raml-js-parser-2","labels_url":"https://api.github.com/repos/raml-org/raml-js-parser-2/issues/102/labels{/name}","comments_url":"https://api.github.com/repos/raml-org/raml-js-parser-2/issues/102/comments","events_url":"https://api.github.com/repos/raml-org/raml-js-parser-2/issues/102/events","html_url":"https://github.com/raml-org/raml-js-parser-2/issues/102","id":148435598,"number":102,"title":"Parser TCK returns different representations for a type when its referenced using type vs using schema","user":{"login":"juancoen","id":1169708,"avatar_url":"https://avatars.githubusercontent.com/u/1169708?v=3","gravatar_id":"","url":"https://api.github.com/users/juancoen","html_url":"https://github.com/juancoen","followers_url":"https://api.github.com/users/juancoen/followers","following_url":"https://api.github.com/users/juancoen/following{/other_user}","gists_url":"https://api.github.com/users/juancoen/gists{/gist_id}","starred_url":"https://api.github.com/users/juancoen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juancoen/subscriptions","organizations_url":"https://api.github.com/users/juancoen/orgs","repos_url":"https://api.github.com/users/juancoen/repos","events_url":"https://api.github.com/users/juancoen/events{/privacy}","received_events_url":"https://api.github.com/users/juancoen/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-04-14T17:48:33Z","updated_at":"2016-04-20T05:28:00Z","closed_at":"2016-04-20T05:27:59Z","body":"RAML example\r\n\r\n```yaml\r\n#%RAML 1.0\r\ntitle: API with Types\r\nbaseUri: /media\r\n\r\nschemas:\r\n  - Player: |\r\n      {\r\n        \"type\": \"object\",\r\n        \"properties\": [\r\n          {\r\n            \"name\": \"string\"\r\n          }\r\n        ]\r\n      }\r\ntypes:\r\n  Person:\r\n    type: object\r\n    properties:\r\n      firstname:\r\n        type: string\r\n        description: test\r\n      lastname: string\r\n      addresses: string[]\r\n      age: number\r\n  User:\r\n    type: Person\r\n    properties:\r\n      firstname:\r\n        type: string\r\n        required: false\r\n      id: number\r\n      department: Department[]\r\n  Developer:\r\n    type: User\r\n    properties:\r\n      github: string\r\n  Department:\r\n    type: object\r\n    properties:\r\n      name: string\r\n    example:\r\n      name: Engineering\r\n  CEO:\r\n    type: User | Developer\r\n  Cleaner: |\r\n    {\r\n      \"type\": \"object\",\r\n      \"properties\": [\r\n        {\r\n          \"name\": \"string\"\r\n        }\r\n      ]\r\n    }\r\n\r\n/users:\r\n  get:\r\n    body:\r\n      application/json:\r\n        type: object\r\n        properties:\r\n          developer: string\r\n          test: string\r\n          animal: string\r\n          car: string\r\n\r\n    responses:\r\n      199:\r\n        body:\r\n          application/json:\r\n            type: object\r\n            properties:\r\n              developer: string\r\n              test: string\r\n              animal: string\r\n              car: string\r\n      200:\r\n        body:\r\n          application/json:\r\n            type: Person\r\n      201:\r\n        body:\r\n          application/json:\r\n            schema: Cleaner\r\n      202:\r\n        body:\r\n          application/json:\r\n            schema: Player\r\n      203:\r\n        body:\r\n          application/json:\r\n            schema: Department\r\n      204:\r\n        body:\r\n          application/json:\r\n            type: |\r\n              {\r\n                \"type\": \"object\",\r\n                \"properties\": [\r\n                  {\r\n                    \"name\": \"string\"\r\n                  }\r\n                ]\r\n              }\r\n      205:\r\n        body:\r\n          application/json:\r\n            schema: |\r\n              {\r\n                \"type\": \"object\",\r\n                \"properties\": [\r\n                  {\r\n                    \"name\": \"string\"\r\n                  }\r\n                ]\r\n              }\r\n```\r\n\r\nin response 200, the property `type` is used to reference the Person type, the parser TCK returns:\r\n\r\n```json\r\n{\r\n  \"application/json\": {\r\n    \"displayName\": \"application/json\",\r\n    \"name\": \"application/json\",\r\n    \"type\": [\r\n      \"Person\"\r\n    ],\r\n    \"repeat\": false,\r\n    \"required\": true,\r\n    \"__METADATA__\": {\r\n      \"primitiveValuesMeta\": {\r\n        \"displayName\": {\r\n          \"calculated\": true\r\n        },\r\n        \"repeat\": {\r\n          \"insertedAsDefault\": true\r\n        },\r\n        \"required\": {\r\n          \"insertedAsDefault\": true\r\n        }\r\n      }\r\n    }\r\n  },\r\n  \"currentType\": \"application/json\"\r\n}\r\n```\r\n\r\nin response 201, the property `schema` is used to reference the Cleaner type, the parser TCK returns:\r\n\r\n```json\r\n{\r\n  \"application/json\": {\r\n    \"displayName\": \"application/json\",\r\n    \"name\": \"application/json\",\r\n    \"schema\": \"Cleaner\",\r\n    \"type\": [\r\n      \"object\"\r\n    ],\r\n    \"repeat\": false,\r\n    \"required\": true,\r\n    \"schemaContent\": \"Cleaner\",\r\n    \"__METADATA__\": {\r\n      \"primitiveValuesMeta\": {\r\n        \"displayName\": {\r\n          \"calculated\": true\r\n        },\r\n        \"type\": {\r\n          \"insertedAsDefault\": true\r\n        },\r\n        \"repeat\": {\r\n          \"insertedAsDefault\": true\r\n        },\r\n        \"required\": {\r\n          \"insertedAsDefault\": true\r\n        }\r\n      }\r\n    }\r\n  },\r\n  \"currentType\": \"application/json\"\r\n}\r\n```\r\n\r\nBeing `type` and `schema` synonymous, there should be no difference in the way they are returned to the parser client.\r\n\r\nThanks!"}}