swagger-express-ts
Advanced tools
Changelog
Example:
...
@ApiModelProperty({
description: "Name of author",
required: true,
itemType: SwaggerDefinitionConstant.Model.Property.Type.STRING
})
name: string[];
...
or
...
app.use(
swagger.express({
definition: {
...
models: {
Author: {
name: {
description: "Name of author",
type: SwaggerDefinitionConstant.Model.Property.Type.ARRAY,
itemType:
SwaggerDefinitionConstant.Model.Property.ItemType.STRING,
required: true
}
}
}
}
...
}
})
);
...
<a name="1.0.0-rc.4"></a>
Changelog
Example:
swagger.express({
definition: {
...
responses: {
500: {}
},
...
}
})
<a name="1.0.0-rc.3"></a>
Changelog
Merge name when several controllers that point to the same name .
Example:
@ApiPath({
path: "/versions",
name: "Version"
})
...
export class VersionsController implements interfaces.Controller {
...
}
@ApiPath({
path: "/versions/:id",
name: "Version"
})
...
export class VersionController implements interfaces.Controller {
...
}
<a name="1.0.0-rc.1"></a>
Changelog
example:
definition : {
...
models : {
Version : {
properties : {
id : {
type : SwaggerDefinitionConstant.Model.Property.Type.STRING,
required : true
},
name : {
type : SwaggerDefinitionConstant.Model.Property.Type.STRING,
required : true
},
description : {
type : SwaggerDefinitionConstant.Model.Property.Type.STRING
},
version : {
type : SwaggerDefinitionConstant.Model.Property.Type.STRING
},
author: {
model: "Author"
}
}
},
Author: {
properties: {
id: {
type: SwaggerDefinitionConstant.Model.Property.Type.STRING,
required : true
},
name : {
type : SwaggerDefinitionConstant.Model.Property.Type.STRING,
required : true
},
}
}
},
...
}
or
@ApiModel({
description: 'Version description',
name: 'Version',
})
export class VersionModel {
@ApiModelProperty({
description: 'Id of version',
required: true,
})
id: number;
@ApiModelProperty({
description: '',
required: true,
})
name: string;
@ApiModelProperty({
description: 'Description of version',
required: true,
})
description: string;
@ApiModelProperty({
description: 'Author of version',
model: 'Author',
})
author: AuthorModel;
}
example:
@ApiOperationGet( {
...
responses : {
200 : { description : "Success" , type : SwaggerDefinitionConstant.Response.Type.ARRAY , model : "Version" }
} ,
...
} )
<a name="1.0.0-beta.1"></a>
Changelog
example:
app.use( swagger.express(
{
definition : {
...
securityDefinitions : {
basicAuth : {
type : SwaggerDefinitionConstant.Security.Type.BASIC_AUTHENTICATION
},
apiKeyHeader : {
type: SwaggerDefinitionConstant.Security.Type.API_KEY,
in: SwaggerDefinitionConstant.Security.In.HEADER,
name: "apiHeader"
}
}
}
}
) );
Example:
...
@ApiOperationGet( {
...
security : {
basicAuth : []
}
} )
...
Example:
...
@ApiOperationGet( {
...
security : {
apiKeyHeader : []
}
} )
...
Example in path:
...
@ApiPath( {
...
deprecated: true
} )
...
Example in operation:
...
@ApiOperationGet( {
...
deprecated: true
} )
...
<a name="1.0.0-alpha.5"></a>
Changelog
Example:
app.use(
swagger.express({
definition: {
info: {
title: 'My api',
version: '1.0',
},
models: {
Version: {
properties: {
id: {
type:
SwaggerDefinitionConstant.Model.Property.Type
.STRING,
required: true,
},
name: {
type:
SwaggerDefinitionConstant.Model.Property.Type
.STRING,
required: true,
},
description: {
type:
SwaggerDefinitionConstant.Model.Property.Type
.STRING,
},
version: {
type:
SwaggerDefinitionConstant.Model.Property.Type
.STRING,
},
},
},
},
externalDocs: {
url: 'My url',
},
},
})
);
<a name="1.0.0-alpha.4"></a>