-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathModuleConfig.cfc
111 lines (103 loc) · 4.21 KB
/
ModuleConfig.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/**
* Copyright since 2016 by Ortus Solutions, Corp
* www.ortussolutions.com
* ---
* Module Config
*/
component {
// Module Properties
this.title = "cbswagger";
this.author = "Jon Clausen <[email protected]>";
this.webURL = "https://github.com/coldbox-modules/cbswagger";
this.version = "@version.number@[email protected]@";
this.description = "A coldbox module to auto-generate Swagger API documentation from your configured routes";
this.entryPoint = "cbswagger";
this.modelNamespace = "cbswagger";
this.cfmapping = "cbswagger";
this.autoMapModels = true;
this.dependencies = [ "swagger-sdk" ];
/**
* Configure module
*/
function configure(){
settings = {
// The route prefix to search. Routes beginning with this prefix will be determined to be api routes
"routes" : [ "api" ],
// Routes to exclude by prefix. Routes beginning with this prefix will be excluded
"excludeRoutesPrefix" : [],
// Routes to exclude from the generated spec
"excludeRoutes" : [],
// Routes to exclude based on event
"excludeEvents" : [],
// The default output format, either json or yml
"defaultFormat" : "json",
// A convention route, relative to your app root, where request/response samples are stored ( e.g. resources/apidocs/responses/[module].[handler].[action].[HTTP Status Code].json )
"samplesPath" : "resources/apidocs",
// Information about your API
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#infoObject
"info" : {
// REQUIRED A title for your API
"title" : "My Awesome API",
// A short description of the application. CommonMark syntax MAY be used for rich text representation.
"description" : "",
// A URL to the Terms of Service for the API. MUST be in the format of a URL.
"termsOfService" : "",
// Contact information for the exposed API.
"contact" : {
// The identifying name of the contact person/organization.
"name" : "",
// The URL pointing to the contact information. MUST be in the format of a URL.
"url" : "",
// The email address of the contact person/organization. MUST be in the format of an email address.
"email" : ""
},
// License information for the exposed API.
"license" : {
// The license name used for the API.
"name" : "",
// A URL to the license used for the API. MUST be in the format of a URL.
"url" : ""
},
// REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).
"version" : "1.0.0"
},
// An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /.
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#serverObject
"servers" : [],
// An element to hold various schemas for the specification.
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#componentsObject
"components" : {},
// A declaration of which security mechanisms can be used across the API.
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#securityRequirementObject
"security" : [],
// A list of tags used by the specification with additional metadata.
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#tagObject
"tags" : [],
// Whether to enable endpoint and parsed doc caching by cbswagger
"cacheEnabled" : true
};
// SES Routes
router
.route( "/" )
.withHandler( "Main" )
.toAction( { "GET" : "index", "OPTIONS" : "options" } );
router
.route( "/json" )
.withHandler( "Main" )
.toAction( { "GET" : "json", "OPTIONS" : "options" } );
router
.route( "/yml" )
.withHandler( "Main" )
.toAction( { "GET" : "yml", "OPTIONS" : "options" } );
}
/**
* Fired when the module is registered and activated.
*/
function onLoad(){
}
/**
* Fired when the module is unregistered and unloaded
*/
function onUnload(){
}
}