const util = require('util') const javaClient = require('../src/java-client') const resources = [ { "type": "role", "plural": "roles", "operations": [ { "method": "GET", "path": "/roles/", "parameters": [], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "[role]", "description": "OK.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] } ], "attributes": [], "description": "Get all defined user roles." }, { "method": "GET", "path": "/roles/:id/:other", "parameters": [ { "name": "id", "type": "uuid", "location": "Path", "required": true }, { "name": "other", "type": "string", "location": "Path", "required": true } ], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "role", "description": "User role found.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized", "attributes": [] }, { "code": { "integer": { "value": 404 } }, "type": "unit", "description": "User role not found.", "attributes": [] } ], "attributes": [], "description": "Get a user role for id." }, { "method": "POST", "path": "/roles/", "parameters": [ { name: 'Authorization', location: "Header", type: "string" } ], "responses": [ { "code": { "integer": { "value": 201 } }, "type": "user", "description": "User role successfully created.", "attributes": [] }, { "code": { "integer": { "value": 400 } }, "type": "[de.nclazz.errors.v0.models.genericError]", "description": "Bad Request.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] } ], "attributes": [], "description": "Create a new user role.", "body": { "type": "role_form", "attributes": [] } }, { "method": "PUT", "path": "/roles/:id/status", "parameters": [ { "name": "id", "type": "uuid", "location": "Path", "required": true } ], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "userStatus", "description": "User role status updated successfully.", "attributes": [] }, { "code": { "integer": { "value": 400 } }, "type": "[de.nclazz.errors.v0.models.genericError]", "description": "Bad Request.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] }, { "code": { "integer": { "value": 404 } }, "type": "unit", "description": "Not Found.", "attributes": [] } ], "attributes": [], "description": "Update the status of a user role.", "body": { "type": "userStatus_form", "attributes": [] } }, { "method": "DELETE", "path": "/roles/:id", "parameters": [ { "name": "id", "type": "uuid", "location": "Path", "required": true } ], "responses": [ { "code": { "integer": { "value": 200 } }, "type": "unit", "description": "User role deleted successfully.", "attributes": [] }, { "code": { "integer": { "value": 401 } }, "type": "unit", "description": "Unauthorized.", "attributes": [] }, { "code": { "integer": { "value": 404 } }, "type": "unit", "description": "Not Found.", "attributes": [] } ], "attributes": [], "description": "Mark a user role as deleted. The user role cannot be accessed by the api, but will stay in the db for a while, before completely removed." } ], "attributes": [], "path": "/roles", "description": "Managing user roles." }, ] const mapped = javaClient.mapResources(resources, "de.nclazz.test.v0") console.log('Resource: ', util.inspect(mapped, { depth: 8 }), '\n-----\n')