File Coverage

blib/lib/Mojolicious/resources/templates/mojo/command/resources/api.json.ep
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1 2     2   10231 % my $a = shift;
  2     2   5  
  2         16  
  2         211  
  2         5  
  2         460  
2             {
3             "swagger": "2.0",
4             %# See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#info-object
5             "info": {
6             "version": "1.0",
7             "title": "<%= $a->{api_title} %>",
8             "description": "This is the OpenAPI specification for <%= $a->{api_title} %>.",
9             %# See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#licenseObject
10             "license": {
11             "name": "restricted"
12             },
13             %# See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#contactObject
14             "contact": {"name":"Company name here", "email":"company_api@example.com"}
15             },
16             "basePath": "/api",
17             %# See http://localhost:3000/perldoc/Mojolicious/Plugin/OpenAPI/Guides/Tutorial
18             %# These keys are currently not in use (schemes, consumes, produces).
19             "schemes": ["http", "https"],
20             "consumes": ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"],
21             "produces": ["application/json", "text/plain", "text/html"],
22             "definitions":{
23             %# Here all the definitions will be put,
24             %# already existing definitions in the api.json file will be replaced with
25             %# new ones with the same name
26              
27             "ErrorResponse": {
28             "type": "object",
29             "properties": {
30             "valid": { "type": "boolean" },
31             "errors:": { "$ref": "#/definitions/Errors" }
32             }
33             },
34             "Errors": { "items": { "$ref": "#/definitions/Error" }, "type": "array" },
35             "Error": {
36             "properties": { "path": { "type": "string" }, "message": { "type": "string" } },
37             "required": [ "message" ]
38             }
39              
40             %# Here will be definitions for each resource, for example: Users,
41             %# GroupsItem, Blog, Product, etc.
42             },
43             %# end of definitions
44             "parameters": {
45             %# Parameters that can be used across operations. This property does not
46             %# define global parameters for all operations.
47             "limit": {
48             "default": 100,
49             "description": "How many, items to return at once (max: 100; min: 1)",
50             "in": "query",
51             "maximum": 100,
52             "minimum": 1,
53             "name": "limit",
54             "type": "integer"
55             },
56             "offset": {
57             "default": 0,
58             "description": "At what offset (min: 0)?",
59             "in": "query",
60             "minimum": 0,
61             "name": "offset",
62             "type": "integer"
63             }
64             },
65              
66             "paths": <%= JSON::PP->new->utf8->encode($a->{api_paths}) %>
67             }
68