swagger-express-ts
Version:
Generate and serve swagger.json
1 lines • 2.21 kB
Source Map (JSON)
{"version":3,"sources":["../../lib/swagger-express-ts-lib/src/api-model-property.decorator.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;CACzB;AAED,wBAAgB,gBAAgB,CAC5B,IAAI,CAAC,EAAE,qBAAqB,GAC7B,iBAAiB,CAcnB","file":"api-model-property.decorator.d.ts","sourcesContent":["import { SwaggerService } from './swagger.service';\nimport { IApiOperationArgsBase } from './i-api-operation-args.base';\n\nexport interface IApiModelPropertyArgs {\n /**\n * Define if property is required.\n * Optional. Default is false.\n */\n required?: boolean;\n\n /**\n * Define format of property. Example: SwaggerDefinitionConstant.Definition.Property.Format.INT_64\n * Optional.\n */\n format?: string;\n\n /**\n * Define type of property. Example: SwaggerDefinitionConstant.Definition.Property.Type.STRING\n * Optional.\n */\n type?: string;\n\n /**\n * Define description.\n * Optional.\n */\n description?: string;\n\n /**\n * Define enum;\n * Optional.\n */\n enum?: string[];\n\n /**\n * Define model.\n * Optional.\n */\n model?: string;\n\n /**\n * Define type of item. Example: SwaggerDefinitionConstant.Definition.Property.Type.STRING\n * Optional.\n */\n itemType?: string;\n\n /**\n * Define example.\n */\n example?: any | any[];\n}\n\nexport function ApiModelProperty(\n args?: IApiModelPropertyArgs\n): PropertyDecorator {\n return (target: any, propertyKey: string | symbol) => {\n const propertyType = Reflect.getMetadata(\n 'design:type',\n target,\n propertyKey\n ).name;\n SwaggerService.getInstance().addApiModelProperty(\n args,\n target,\n propertyKey,\n propertyType\n );\n };\n}\n"]}