Skip to content

Commit 8cde277

Browse files
committed
swagger-sdk to version 1.0.3
2 parents 5be2c96 + 31517cc commit 8cde277

18 files changed

+133
-456
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ settings.xml
1111
tests/results/*
1212
apidocs/docbox/
1313
artifacts/
14-
workbench/build.number
15-
workbench/servers/.engine
14+
workbench/
1615
build/*
1716
modules/*
1817
!modules/swagger-sdk

.module.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
project.name=swagger-sdk
2+
project.version=1.0.3
3+
module.name=swagger-sdk

.travis.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ notifications:
55
secure: FIHlTn/YO7Wgumm1uIqmoEsqjQA7fV0AE94Rjc5yKzM3AquQa8HicgDVVk0d2GrKRnl0xt3j4ZJV//VJyIjlCd/QVKuj48R2ChjEY2im3+99HFPafCUI5/S2uyowKU6mJTFonH9v6p41eqxdbiAxJdDGOT0V2Gpt3UBSNuHz8ED9/aIHqv+P7M+VD6Xd2XYwctPniWlaSWx57sWcnG/VkFG45qFQAyha64uxOOe4M3ZmG/n5FfauZ8cBVLiRKEIr+CyNhh1ujfzi7+4uzMlSNL5t/BbZamAQuZzqGzGQ9RVvIlyPgUGNJtDEE/hWS09aagXF5T6EMj00szizErh4J1/x4qZwml5+TcBN31E0QmAhCtZe85sr3tYgic+hEz9XX1yymQzf/C7n4to2yNvq0r4g51xDk8IuP95WEh7zaqLlvFZvBFgxpHZBMYlRvhytjOYDeIFRMcGwHZcXosaG2ejqDwcGq/LC4oeG4sSwmg9sdRrtcmcanrNqrBka86WYO6LntI3JdZ86/1ACEUHzhCCwvrKELc9Ji1xxGAgS7QKH+s2/hnJuiMyv73gOVLKYC+wPMLt+fvOmPLSEl+PJiAIlToBq1KUBg03RSQLfPOLD7OrJ8VvDZsEPwejqlGDyc4wRglS9OTi7SnN5LYHSDNDdGdREegWqq9qDHEYEVLI=
66

77
env:
8+
global:
9+
- MODULE_ID=swagger-sdk
810
matrix:
911
1012
- ENGINE=lucee@5
11-
#- ENGINE=adobe@10 - ACF10 is not officially supported
13+
- ENGINE=adobe@10
1214
- ENGINE=adobe@11
1315
- ENGINE=adobe@2016
1416

@@ -29,7 +31,7 @@ before_install:
2931

3032
install:
3133
# Install Commandbox
32-
- sudo apt-get update && sudo apt-get --assume-yes install haveged rsync commandbox
34+
- sudo apt-get update && sudo apt-get --assume-yes install git haveged rsync commandbox
3335
# Test that the box binary is available and ready for our tests
3436
- box version
3537
# If using auto-publish, you will need to provide your API token with this line:
@@ -38,18 +40,27 @@ install:
3840
- mkdir tests/results
3941
- sudo chmod -R 775 tests/results
4042

43+
# Build script - note module versioning is passed to ANT
4144
script:
42-
- ant -DisTravis=true -Dcfengine=$ENGINE -Dbuild.number=$TRAVIS_BUILD_NUMBER -Dbuild.branch=$TRAVIS_BRANCH -f workbench/build.xml
45+
# run our dependency install to ensure the workbench is in place
46+
- box install
47+
# add our module-specific build properties
48+
- printf "\nmodule.name=$MODULE_ID" >> workbench/build.properties
49+
- printf "\ncfengine=$ENGINE" >> workbench/build.properties
50+
- printf "\ncfengine=$ENGINE" >> workbench/build.properties
51+
# execute our build
52+
- ant -DisTravis=true -Dbuild.number=$TRAVIS_BUILD_NUMBER -Dbuild.branch=$TRAVIS_BRANCH -f workbench/build.xml
4353

4454
after_failure:
55+
- cd $TRAVIS_BUILD_DIR
4556
# Spit out our Commandbox log in case we need to debug
4657
- box server log name=$ENGINE
4758
- cat `box system-log`
4859

4960
before_deploy:
5061
- cd $TRAVIS_BUILD_DIR
5162
- mkdir -p s3deploy
52-
- rsync -av ./artifacts/swagger-sdk/ ./s3deploy/
63+
- rsync -av ./artifacts/$MODULE_ID/ ./s3deploy/
5364
- rm -f ./s3deploy/box-repo.json
5465

5566
deploy:
@@ -66,7 +77,7 @@ deploy:
6677
secret_access_key: $AWS_ACCESS_SECRET
6778
bucket: "downloads.ortussolutions.com"
6879
local-dir: s3deploy
69-
upload-dir: ortussolutions/coldbox-modules/swagger-sdk
80+
upload-dir: ortussolutions/coldbox-modules/$MODULE_ID
7081
acl: public_read
7182
#API Docs Deployment
7283
- provider: s3
@@ -80,7 +91,7 @@ deploy:
8091
secret_access_key: $AWS_ACCESS_SECRET
8192
bucket: "apidocs.ortussolutions.com"
8293
local-dir: build/apidocs
83-
upload-dir: coldbox-modules/swagger-sdk
94+
upload-dir: coldbox-modules/$MODULE_ID
8495
acl: public_read
8596

8697

box.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
{
2-
"name":"SwaggerSDK-shell",
3-
"version":"0.0.1",
4-
"slug":"SwaggerSDK-shell",
5-
"private":false,
6-
"dependencies":{
7-
"coldbox":"4.1.0+00002",
8-
"cbjavaloader":">1.0.0"
2+
"name" : "SwaggerSDK-shell",
3+
"version" : "0.0.1",
4+
"slug" : "SwaggerSDK-shell",
5+
"private" : false,
6+
"dependencies" : {
7+
"coldbox" : "4.1.0+00002",
8+
"cbjavaloader": ">1.0.0",
9+
"workbench" : "git+https://github.com/Ortus-Solutions/unified-workbench.git"
910
},
10-
"devDependencies":{
11-
"testbox":"2.2.0"
11+
"devDependencies" : {
12+
"testbox" : "2.2.0"
1213
},
13-
"installPaths":{
14-
"coldbox":"coldbox",
15-
"testbox":"testbox",
16-
"cbjavaloader":"modules/cbjavaloader"
14+
"installPaths" : {
15+
"coldbox" : "coldbox",
16+
"testbox" : "testbox",
17+
"cbjavaloader": "modules/cbjavaloader",
18+
"workbench" : "workbench"
1719
}
1820
}

modules/swagger-sdk/box.json

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
{
2-
"name":"swagger-sdk",
3-
"shortDescription":"The Swagger Software Development Kit for the Coldbox Platform",
4-
"version":"@build.version@[email protected]@",
5-
"author":"Jon Clausen <[email protected]>",
6-
"slug":"swagger-sdk",
7-
"type":"modules",
8-
"keywords" : "Swagger,OpenAPI,API Documentation",
9-
"location" : "http://downloads.ortussolutions.com/ortussolutions/coldbox-modules/swagger-sdk/@build.version@/[email protected]@.zip",
10-
"homepage" : "https://github.com/coldbox-modules/swagger-sdk",
11-
"documentation" : "https://github.com/coldbox-modules/swagger-sdk/wiki",
12-
"repository" : { "type" : "git", "url" : "https://github.com/coldbox-modules/swagger-sdk" },
13-
"bugs" : "https://github.com/coldbox-modules/swagger-sdk/issues",
14-
"license":[
15-
{
16-
"type":"Apache2",
17-
"url":"http://www.apache.org/licenses/LICENSE-2.0.html"
18-
}
2+
"name" : "swagger-sdk",
3+
"shortDescription": "The Swagger Software Development Kit for the Coldbox Platform",
4+
"version" : "@build.version@[email protected]@",
5+
"author" : "Jon Clausen <[email protected]>",
6+
"slug" : "swagger-sdk",
7+
"type" : "modules",
8+
"keywords" : "Swagger,OpenAPI,API Documentation",
9+
"location" : "http://downloads.ortussolutions.com/ortussolutions/coldbox-modules/swagger-sdk/@build.version@/[email protected]@.zip",
10+
"homepage" : "https://github.com/coldbox-modules/swagger-sdk",
11+
"documentation" : "https://github.com/coldbox-modules/swagger-sdk/wiki",
12+
"repository" : { "type" : "git", "url" : "https://github.com/coldbox-modules/swagger-sdk" },
13+
"bugs" : "https://github.com/coldbox-modules/swagger-sdk/issues",
14+
"license" :[
15+
{
16+
"type" : "Apache2",
17+
"url" : "http://www.apache.org/licenses/LICENSE-2.0.html"
18+
}
1919
],
20-
"contributors":[
20+
"contributors" :[
2121
"Luis Majano <[email protected]>"
2222
],
23-
"engines":[
24-
{
25-
"type":"railo",
26-
"version":">4.1"
27-
},
28-
{
29-
"type":"lucee",
30-
"version":">4.5"
31-
},
32-
{
33-
"type":"adobe",
34-
"version":">9.02"
35-
}
23+
"engines" :[
24+
{
25+
"type" : "railo",
26+
"version" : ">4.1"
27+
},
28+
{
29+
"type" : "lucee",
30+
"version" : ">4.5"
31+
},
32+
{
33+
"type" : "adobe",
34+
"version" : ">9.02"
35+
}
3636
],
37-
"dependencies" :{
38-
"cbjavaloader" : ">0.0.9"
37+
"dependencies" :{
38+
"cbjavaloader": ">0.0.9"
3939
}
4040
}

modules/swagger-sdk/models/OpenAPI/Document.cfc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ component name="OpenAPIDocument" accessors="true" {
2525
zoomToXPath();
2626
}
2727

28-
setResourceIds( getDocument() );
28+
if( isStruct( getDocument() ) ){
29+
setResourceIds( getDocument() );
30+
}
2931

3032
return this;
3133
}
@@ -114,7 +116,11 @@ component name="OpenAPIDocument" accessors="true" {
114116
* Normalizes the document recursively to provide a flattened representation
115117
* @param APIDoc The document to normalized. Defaults to the entity document
116118
**/
117-
public function getNormalizedDocument(struct APIDoc=this.getDocument()){
119+
public function getNormalizedDocument(any APIDoc=this.getDocument()){
120+
121+
if( isArray( APIDoc ) ){
122+
return APIDoc;
123+
}
118124

119125
var NormalizedDoc = structCopy( ARGUMENTS.APIDoc );
120126

modules/swagger-sdk/models/OpenAPI/Parser.cfc

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ component name="OpenAPIParser" accessors="true" {
7676
break;
7777

7878
default:
79-
throw( type="SwaggerSDK.ParserException", message="SwaggerSDK does not support schema using the .#lcase(getSchemaType())# file extension." );
79+
throw(
80+
type="SwaggerSDK.ParserException",
81+
message="SwaggerSDK does not support schema using the .#lcase(getSchemaType())# file extension."
82+
);
8083
}
8184

8285
return parse( documentContent , XPath );
@@ -96,7 +99,9 @@ component name="OpenAPIParser" accessors="true" {
9699
var Document = getDocumentObject().getDocument();
97100

98101
for( var key in Document ){
99-
Document[ key ] = parseDocumentReferences( Document[ key ] );
102+
if( isSimpleValue( key ) ){
103+
Document[ key ] = parseDocumentReferences( Document[ key ] );
104+
}
100105
}
101106

102107
return this;
@@ -143,9 +148,13 @@ component name="OpenAPIParser" accessors="true" {
143148
&&
144149
structKeyExists( DocItem[ key ], "$ref" )
145150
) {
151+
146152
DocItem[ key ] = fetchDocumentReference( DocItem[ key ][ "$ref" ] );
153+
147154
} else if( isStruct( DocItem[ key ] ) || isArray( DocItem[ key ] ) ){
155+
148156
DocItem[ key ] = parseDocumentReferences( DocItem[ key ] );
157+
149158
}
150159

151160
}
@@ -193,33 +202,44 @@ component name="OpenAPIParser" accessors="true" {
193202

194203
var ReferenceDocument = {};
195204

196-
//Files receive a parser reference
197-
if( left( FilePath, 4 ) == 'http' ){
205+
try{
198206

199-
var ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( $ref );
207+
//Files receive a parser reference
208+
if( left( FilePath, 4 ) == 'http' ){
209+
210+
var ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( $ref );
200211

201-
} else if( len( FilePath ) && fileExists( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )){
212+
} else if( len( FilePath ) && fileExists( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )){
202213

203-
var ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( getDirectoryFromPath( getBaseDocumentPath() ) & $ref );
204-
205-
} else if( len( FilePath ) && fileExists( expandPath( FilePath ) ) ) {
214+
var ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( getDirectoryFromPath( getBaseDocumentPath() ) & $ref );
215+
216+
} else if( len( FilePath ) && fileExists( expandPath( FilePath ) ) ) {
206217

207-
var ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( expandPath( FilePath ) & ( !isNull( xPath ) ? "##" & xPath : "" ) );
218+
var ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( expandPath( FilePath ) & ( !isNull( xPath ) ? "##" & xPath : "" ) );
208219

209-
} else if( len( FilePath ) && !fileExists( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )) {
220+
} else if( len( FilePath ) && !fileExists( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )) {
210221

211-
throw( type="SwaggerSDK.ParserException", message="File #( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )# does not exist" );
222+
throw( type="SwaggerSDK.ParserException", message="File #( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )# does not exist" );
212223

213-
} else if( !isNull( XPath ) && len( XPath ) ) {
224+
} else if( !isNull( XPath ) && len( XPath ) ) {
214225

215-
var ReferenceDocument = getInternalXPath( XPath );
226+
var ReferenceDocument = getInternalXPath( XPath );
216227

217-
} else {
228+
} else {
218229

219-
throw( type="SwaggerSDK.ParserException", message="The $ref #$ref# could not be resolved as either an internal or external reference");
230+
throw( type="SwaggerSDK.ParserException", message="The $ref #$ref# could not be resolved as either an internal or external reference");
220231

221-
}
232+
}
233+
234+
} catch( any e ){
222235

236+
throw(
237+
type="CBSwagger.InvalidReferenceDocumentException",
238+
message="The $ref file pointer of #$ref# could not be loaded and parsed as a valid object. If your $ref file content is an array, please nest the array within an object as a named key."
239+
);
240+
241+
}
242+
223243
return ReferenceDocument;
224244
}
225245

modules/swagger-sdk/models/OpenAPI/Util.cfc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ component name="OpenAPIUtil" accessors="true" {
1414
//We need to use Linked Hashmaps to maintain struct order for serialization and deserialization
1515
var template = createLinkedHashMap();
1616

17-
var templateDefaults = [
18-
{"swagger": "2.0"},
17+
var templateDefaults = [
18+
{"swagger" : "2.0"},
1919
{
20-
"info": {
21-
"version": "",
22-
"title": "",
23-
"description": "",
20+
"info" : {
21+
"version" : "",
22+
"title" : "",
23+
"description" : "",
2424
"termsOfService": "",
25-
"contact": createLinkedHashMap(),
26-
"license": createLinkedHashMap()
25+
"contact" : createLinkedHashMap(),
26+
"license" : createLinkedHashMap()
2727
}
2828
},
29-
{"host": ""},
30-
{"basePath": ""},
31-
{"schemes": []},
32-
{"consumes": ["application/json","multipart/form-data","application/x-www-form-urlencoded"]},
33-
{"produces": ["application/json"]},
34-
{"paths": createLinkedHashMap()}
29+
{"host" : ""},
30+
{"basePath" : ""},
31+
{"schemes" : []},
32+
{"consumes" : ["application/json","multipart/form-data","application/x-www-form-urlencoded"]},
33+
{"produces" : ["application/json"]},
34+
{"paths" : createLinkedHashMap()}
3535

3636
];
3737

@@ -46,12 +46,12 @@ component name="OpenAPIUtil" accessors="true" {
4646
var method = createLinkedHashMap();
4747
var descMap = createLinkedHashMap();
4848
descMap.put( "description", "" );
49-
var methodDefaults = [
50-
{"description": ""},
51-
{"operationId": ""},
52-
{"parameters": []},
49+
var methodDefaults = [
50+
{"description" : ""},
51+
{"operationId" : ""},
52+
{"parameters" : []},
5353
{
54-
"responses": {
54+
"responses" : {
5555
"default": descMap
5656
}
5757
}

server.json.old

Lines changed: 0 additions & 9 deletions
This file was deleted.

workbench/build-auto.properties

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)