|
@@ -73,7 +73,7 @@ describe 'API generation tests', -> |
|
|
]
|
|
|
, /Response not declared with the same id/
|
|
|
|
|
|
- it 'should fail on model with invalid id', ->
|
|
|
+ it 'should fail on model without properties', ->
|
|
|
assert.throws ->
|
|
|
swagger.generator express(), {}, [
|
|
|
api:
|
|
@@ -84,6 +84,42 @@ describe 'API generation tests', -> |
|
|
]
|
|
|
, /Response1 does not declares properties/
|
|
|
|
|
|
+ it 'should not fail on model with properties', ->
|
|
|
+ swagger.generator express(), {}, [
|
|
|
+ api:
|
|
|
+ resourcePath: '/test'
|
|
|
+ apis: [path: '/test/1'],
|
|
|
+ models:
|
|
|
+ Response1:
|
|
|
+ id: 'Response1'
|
|
|
+ properties: name: type: 'string'
|
|
|
+ controller: require './fixtures/sourceCrud'
|
|
|
+ ]
|
|
|
+
|
|
|
+ it 'should not fail on model with additionalProperties', ->
|
|
|
+ swagger.generator express(), {}, [
|
|
|
+ api:
|
|
|
+ resourcePath: '/test'
|
|
|
+ apis: [path: '/test/1'],
|
|
|
+ models:
|
|
|
+ Response1:
|
|
|
+ id: 'Response1'
|
|
|
+ additionalProperties: {}
|
|
|
+ controller: require './fixtures/sourceCrud'
|
|
|
+ ]
|
|
|
+
|
|
|
+ it 'should not fail on model with items', ->
|
|
|
+ swagger.generator express(), {}, [
|
|
|
+ api:
|
|
|
+ resourcePath: '/test'
|
|
|
+ apis: [path: '/test/1'],
|
|
|
+ models:
|
|
|
+ Response1:
|
|
|
+ id: 'Response1'
|
|
|
+ items: type: 'string'
|
|
|
+ controller: require './fixtures/sourceCrud'
|
|
|
+ ]
|
|
|
+
|
|
|
it 'should fail on model already defined', ->
|
|
|
assert.throws ->
|
|
|
swagger.generator express(), {}, [
|
|
@@ -682,4 +718,4 @@ describe 'API generation tests', -> |
|
|
nickname: 'remove'
|
|
|
]
|
|
|
]
|
|
|
- done()
|
|
|
+ done()
|