This repository was archived by the owner on Jul 23, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-12
lines changed Expand file tree Collapse file tree 3 files changed +22
-12
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ describe('ServerlessAWSDocumentation', function () {
141141 ContentType : 'application/json' ,
142142 Name : 'TestModel' ,
143143 Schema : 'some complex schema' ,
144+ Description : 'the test model schema' ,
144145 } ,
145146 } ,
146147 OtherModelModel : {
@@ -152,6 +153,7 @@ describe('ServerlessAWSDocumentation', function () {
152153 ContentType : 'application/json' ,
153154 Name : 'OtherModel' ,
154155 Schema : 'some even more complex schema' ,
156+ Description : 'the other test model schema' ,
155157 } ,
156158 } ,
157159 NoSchemaModelModel : {
@@ -163,6 +165,7 @@ describe('ServerlessAWSDocumentation', function () {
163165 ContentType : 'application/json' ,
164166 Name : 'NoSchemaModel' ,
165167 Schema : { } ,
168+ Description : 'the other test model schema' ,
166169 } ,
167170 } ,
168171 ExistingResource : {
Original file line number Diff line number Diff line change @@ -42,17 +42,22 @@ function replaceModelRefs(restApiId, cfModel) {
4242module . exports = {
4343 createCfModel : function createCfModel ( restApiId ) {
4444 return function ( model ) {
45- return replaceModelRefs ( restApiId ,
46- {
47- Type : 'AWS::ApiGateway::Model' ,
48- Properties : {
49- RestApiId : restApiId ,
50- ContentType : model . contentType ,
51- Name : model . name ,
52- Schema : model . schema || { } ,
53- } ,
54- }
55- ) ;
45+
46+ let cfModel = {
47+ Type : 'AWS::ApiGateway::Model' ,
48+ Properties : {
49+ RestApiId : restApiId ,
50+ ContentType : model . contentType ,
51+ Name : model . name ,
52+ Schema : model . schema || { } ,
53+ } ,
54+ }
55+
56+ if ( model . description ) {
57+ cfModel . Properties . Description = model . description
58+ }
59+
60+ return replaceModelRefs ( restApiId , cfModel )
5661 }
5762 } ,
5863
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ describe('ServerlessAWSDocumentation', function() {
5858 let modelInput = {
5959 contentType : 'application/json' ,
6060 name : 'TestModel' ,
61+ description : 'Test description' ,
6162 schema : {
6263 type : 'object' ,
6364 properties : {
@@ -98,7 +99,8 @@ describe('ServerlessAWSDocumentation', function() {
9899 }
99100 }
100101 }
101- }
102+ } ,
103+ Description : 'Test description' ,
102104 } ,
103105 DependsOn : [
104106 'OtherModelNameModel'
You can’t perform that action at this time.
0 commit comments