raml-org / raml-js-parser

(deprecated) A RAML parser based on PyYAML written in CoffeScript and available for use as NodeJs module or in-browser.
195 stars 53 forks source link

oauth_2_0 is not inherited at endpoint level #171

Open priyavivek1 opened 8 years ago

priyavivek1 commented 8 years ago

Following is my RAML and i want to include oauth_2_0 at endpoint level. Its not giving any error and also not including it,

%RAML 0.8


title: File System version: v3 baseUri: https://api.domain.com/{version}/{other} baseUriParameters: other: displayName: Dummy description: | Description of the other baseUriParameter default: abc mediaType: application/json securitySchemes:

securedBy: [ null, oauth_2_0 ] documentation:

schemas:

Following is my parsed file

{ "/": { "get": { "queryParameters": { "type": { "type": "string", "displayName": "type" }, "other": { "type": "string", "displayName": "other" } }, "securedBy": [ null, "oauth_2_0" ], "responsesschema": { "200": { "body": { "application/json": { "schema": "{\r\n \"id\": \"https://www.paschidev.com/schemas/entry-schema.json\",\r\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\r\n \"description\": \"schema for an fstab entry\",\r\n \"type\": \"object\",\r\n \"required\": [ \"storage\" ],\r\n \"properties\": {\r\n \"storage\": {\r\n \"type\": \"object\",\r\n \"oneOf\": [\r\n { \"$ref\": \"#/definitions/diskDevice\" },\r\n { \"$ref\": \"#/definitions/diskUUID\" },\r\n { \"$ref\": \"#/definitions/nfs\" },\r\n { \"$ref\": \"#/definitions/tmpfs\" }\r\n ]\r\n },\r\n \"fstype\": {\r\n \"enum\": [ \"ext3\", \"ext4\", \"btrfs\" ]\r\n },\r\n \"options\": {\r\n \"type\": \"array\",\r\n \"minItems\": 1,\r\n \"items\": { \"type\": \"string\" },\r\n \"uniqueItems\": true\r\n },\r\n \"readonly\": { \"type\": \"boolean\" }\r\n },\r\n \"definitions\": {\r\n \"diskDevice\": {\r\n \"properties\": {\r\n \"type\": { \"enum\": [ \"disk\" ] },\r\n \"device\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^/dev/[^/]+(/[^/]+)*$\"\r\n }\r\n },\r\n \"required\": [ \"type\", \"device\" ],\r\n \"additionalProperties\": false\r\n },\r\n \"diskUUID\": {\r\n \"properties\": {\r\n \"type\": { \"enum\": [ \"disk\" ] },\r\n \"label\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$\"\r\n }\r\n },\r\n \"required\": [ \"type\", \"label\" ],\r\n \"additionalProperties\": false\r\n },\r\n \"nfs\": {\r\n \"properties\": {\r\n \"type\": { \"enum\": [ \"nfs\" ] },\r\n \"remotePath\": {\r\n \"type\": \"string\",\r\n \"pattern\": \"^(/[^/]+)+$\"\r\n },\r\n \"server\": {\r\n \"type\": \"string\",\r\n \"oneOf\": [\r\n { \"format\": \"host-name\" },\r\n { \"format\": \"ipv4\" },\r\n { \"format\": \"ipv6\" }\r\n ]\r\n }\r\n },\r\n \"required\": [ \"type\", \"server\", \"remotePath\" ],\r\n \"additionalProperties\": false\r\n },\r\n \"tmpfs\": {\r\n \"properties\": {\r\n \"type\": { \"enum\": [ \"tmpfs\" ] },\r\n \"sizeInMB\": {\r\n \"type\": \"integer\",\r\n \"minimum\": 16,\r\n \"maximum\": 512\r\n }\r\n },\r\n \"required\": [ \"type\", \"sizeInMB\" ],\r\n \"additionalProperties\": false\r\n }\r\n }\r\n}", "example": "{\n \"storage1\": {\n \"type\": \"disk\",\n \"device\": \"/dev/sda1\"\n },\n \"fstype\": \"btrfs\",\n \"readonly\": true\n}\n" } } } } } }, "//folder": { "get": { "securedBy": [ null, "oauth_2_0" ], "responsesschema": { "200": { "body": { "application/json": { "example": "{}\n" } } } } } } }

dmartinezg commented 8 years ago

Hi @priyavivek1, I am not sure what you mean by endpoint level do you mean that the securedBy property is not copied to each resource in the tree?

priyavivek1 commented 8 years ago

SecuredBY property can be specified at root level also, which should after parsing be added to each endpoint level.