Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swagger-express-ts

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-express-ts - npm Package Versions

2

1.1.0

Diff

olivierlsc
published 1.0.1 •

olivierlsc
published 1.0.0 •

Changelog

Source

1.0.0

Features

itemType

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>

olivierlsc
published 1.0.0-rc.4 •

Changelog

Source

1.0.0-rc.4

Features

Add global responses

Example:

swagger.express({
  definition: {
    ...
    responses: {
      500: {}
    },
    ...
  }
})

Fixes

Fix ApiModel when arg "name" and class name are equal.

<a name="1.0.0-rc.3"></a>

olivierlsc
published 1.0.0-rc.3 •

Changelog

Source

1.0.0-rc.3

Fixes

Merge models and path

<a name="1.0.0-rc.2"></a>

olivierlsc
published 1.0.0-rc.2 •

Changelog

Source

1.0.0-rc.2

Features

Name

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>

olivierlsc
published 1.0.0-rc.1 •

Changelog

Source

1.0.0-rc.1

Features

Model

Configuration

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;
}
Controller

example:

@ApiOperationGet( {
    ...
    responses : {
        200 : { description : "Success" , type : SwaggerDefinitionConstant.Response.Type.ARRAY , model : "Version" }
    } ,
    ...
} )

<a name="1.0.0-beta.1"></a>

olivierlsc
published 1.0.0-beta.1 •

Changelog

Source

1.0.0-beta.1

Features

Authentication

Configuration

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"
                }
            }
        }
    }
) );
Basic Authentication

Example:

...
@ApiOperationGet( {
    ...
    security : {
        basicAuth : []
    }
} )
...
API Keys

Example:

...
@ApiOperationGet( {
    ...
    security : {
        apiKeyHeader : []
    }
} )
...

Operations as deprecated

Example in path:

...
@ApiPath( {
    ...
    deprecated: true
} )
...

Example in operation:

...
@ApiOperationGet( {
    ...
    deprecated: true
} )
...

<a name="1.0.0-alpha.5"></a>

olivierlsc
published 1.0.0-alpha.5 •

Changelog

Source

1.0.0-alpha.5

Features

externalDocs

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>

olivierlsc
published 1.0.0-alpha.4 •

Changelog

Source

1.0.0-alpha.4

Add keywords for npm.

<a name="1.0.0-alpha.3"></a>

2
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc