File Coverage

blib/lib/Mojolicious/resources/templates/mojo/command/resources/path.json.ep
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1 2     2   15126 % my $a = shift;
  2     2   4  
  2     2   14  
  2     2   186  
  2         6  
  2         1369  
  2         14089  
  2         6  
  2         13  
  2         217  
  2         4  
  2         1387  
2             {
3             "/<%= $a->{t} %>": {
4             "get": {
5             "operationId": "api.<%= $a->{home_route}{name} %>",
6             "x-mojo-to": "<%= $a->{home_route}{to} %>",
7             "summary": "List all records of type <%= $a->{class_name} %>.",
8             "description":"List all records of type <%= $a->{class_name} %> according to the client's priviledges.",
9             "parameters": [
10             { "$ref": "#/parameters/limit" },
11             { "$ref": "#/parameters/offset" }
12             ],
13             "responses": {
14             %# Refer to shared response-objects or define specific to this path only.
15             "200": {
16             "description": "An array of <%= $a->{class_name} %>.",
17             "schema": { "$ref": "#/definitions/<%= $a->{class_name} %>" }
18             },
19             "default": { "$ref": "#/definitions/ErrorResponse"}
20             }
21             },
22             "post": {
23             "operationId": "api.<%= $a->{store_route}{name} %>",
24             "x-mojo-to": "<%= $a->{store_route}{to} %>",
25             "summary": "Create and store an object of type <%= $a->{class_name} %>Item.",
26             "description": "Create and store an object of type <%= $a->{class_name} %>Item.",
27             %# Refer to shared parameters and define specific to this path only.
28             % my $json = JSON::PP->new->utf8;
29             "parameters": <%= $json->encode($a->{store_params}) %>,
30             "responses": {
31             "201": {
32             "description": "Expect this response to a valid request. The body of the response will be empty.",
33             "headers": { "Location": { "description": "The URL of the newly created resource.", "type": "string" } }
34             },
35             "400": {
36             "description": "Bad Request",
37             "schema": { "$ref": "#/definitions/Error"}
38             }
39             }
40             }
41             },
42             "/<%= $a->{t} %>/{id}" : {
43             "get": {
44             "operationId": "api.<%= $a->{show_route}{name} %>",
45             "x-mojo-to": "<%= $a->{show_route}{to} %>",
46             "summary": "Show an object of type <%= $a->{class_name} %>Item.",
47             "description": "Show an object of type <%= $a->{class_name} %>Item.",
48             "parameters": <%= $json->encode($a->{show_params}) %>,
49             "responses": {
50             %# Refer to shared responses or define specific to this path only.
51             "200": {
52             "description": "An object of type <%= $a->{class_name} %>Item.",
53             "schema": { "$ref": "#/definitions/<%= $a->{class_name} %>Item" }
54             },
55             "default": { "$ref": "#/definitions/ErrorResponse"}
56             }
57             },
58             "put": {
59             "operationId": "api.<%= $a->{update_route}{name} %>",
60             "x-mojo-to": "<%= $a->{update_route}{to} %>",
61             "summary": "Update an object of type <%= $a->{class_name} %>Item.",
62             "description": "Update an object of type <%= $a->{class_name} %>Item.",
63             "parameters": <%= $json->encode($a->{update_params}) %>,
64             "responses": {
65             "204" : {
66             "description": "Response to a valid PUT request. Response body will be empty."
67             },
68             "default": { "$ref": "#/definitions/ErrorResponse"}
69             }
70             },
71             "delete": {
72             "operationId": "api.<%= $a->{remove_route}{name} %>",
73             "x-mojo-to": "<%= $a->{remove_route}{to} %>",
74             "summary": "Delete an object of type <%= $a->{class_name} %>Item.",
75             "description": "Delete an object of type <%= $a->{class_name} %>Item.",
76             "parameters": <%= $json->encode($a->{show_params}) %>,
77             "responses": {
78             "204": { "description":"No content. The resource is deleted." },
79             "404":{ "description": "Not Found. The resource is already gone." },
80             "default": { "$ref": "#/definitions/ErrorResponse"}
81             }
82             }
83             }
84             }