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AGG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,4BAA4B,CAAA;KAAE,CAAC;IAEzD;;;OAGG;IACH,YAAY,CAAC,EAAE,oBAAoB,CAAC;IAEpC;;;OAGG;IACH,mBAAmB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,0BAA0B,CAAA;KAAE,CAAC;IAEpE;;;OAGG;IACH,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,6BAA6B,CAAA;KAAE,CAAC;CAChE;AAED,wBAAgB,KAAK,CAAC,eAAe,EAAE,uBAAuB,GAAG,IAAI,CA8CpE","file":"swagger.builder.d.ts","sourcesContent":["import {\n    ISwaggerInfo,\n    ISwaggerDefinition,\n    ISwaggerDefinitionProperty,\n    ISwaggerExternalDocs,\n    ISwaggerOperationResponse,\n} from './i-swagger';\nimport * as assert from 'assert';\nimport { SwaggerService } from './swagger.service';\nimport { SwaggerDefinitionConstant } from './swagger-definition.constant';\nimport {\n    IApiOperationArgsBaseParameter,\n    IApiOperationArgsBaseResponse,\n} from './i-api-operation-args.base';\n\nexport interface ISwaggerBuildDefinitionModelPropertyType {\n    type?: string | ISwaggerBuildDefinitionModelPropertyType;\n}\n\nexport interface ISwaggerBuildDefinitionModelProperty {\n    /**\n     * Define type of property. Example: SwaggerDefinitionConstant.Definition.Property.Type.STRING\n     * Optional.\n     */\n    type?: string;\n\n    /**\n     * Define format of property. Example: SwaggerDefinitionConstant.Definition.Property.Format.INT_64\n     * Optional.\n     */\n    format?: string;\n\n    /**\n     * Define if property is required.\n     * Optional. Default is false.\n     */\n    required?: boolean;\n\n    /**\n     * Define model.\n     * Optional.\n     */\n    model?: string;\n\n    /**\n     * Define enum;\n     * Optional.\n     */\n    enum?: string[];\n\n    /**\n     * Define description.\n     * Optional.\n     */\n    description?: 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[];\n}\n\nexport interface ISwaggerBuildDefinitionModel {\n    /**\n     * Define description.\n     */\n    description?: string;\n\n    /**\n     * Define all properties of model.\n     */\n    properties: { [key: string]: ISwaggerBuildDefinitionModelProperty };\n}\n\nexport interface ISwaggerSecurityDefinition {\n    /**\n     * Define type of security.\n     */\n    type: string;\n\n    /**\n     * Define where security set.\n     * Optional.\n     */\n    in?: string;\n\n    /**\n     * Define name of security.\n     * Optional.\n     */\n    name?: string;\n}\n\nexport interface ISwaggerBuildDefinition {\n    /**\n     * Base URL for all API.\n     * Optional. Default is \"/\".\n     */\n    basePath?: string;\n\n    /**\n     * Version Open API\n     * Optional.\n     */\n    openapi?: string;\n\n    /**\n     * Metadata.\n     */\n    info: ISwaggerInfo;\n\n    /**\n     * Define the MIME types supported by the API for consumes. The root-level definition can be overridden in individual operations.\n     * Optional. Default is SwaggerDefinition.Consume.JSON = \"application/json\".\n     */\n    consumes?: string[];\n\n    /**\n     * Define the MIME types supported by the API for produces. The root-level definition can be overridden in individual operations.\n     * Optional. Default is SwaggerDefinition.Produce.JSON = \"application/json\".\n     */\n    produces?: string[];\n\n    /**\n     * Define schemes.\n     * Optional. Default is SwaggerDefinition.Scheme.HTTP = \"http\".\n     */\n    schemes?: string[];\n\n    /**\n     * Define host.\n     * Optional.\n     */\n    host?: string;\n\n    /**\n     * Define All Definitions.\n     * Optional.\n     */\n    models?: { [key: string]: ISwaggerBuildDefinitionModel };\n\n    /**\n     * Define external doc\n     * Optional.\n     */\n    externalDocs?: ISwaggerExternalDocs;\n\n    /**\n     * Define security definitions list.\n     * Optional.\n     */\n    securityDefinitions?: { [key: string]: ISwaggerSecurityDefinition };\n\n    /**\n     * Define global responses.\n     * Optional.\n     */\n    responses?: { [key: string]: IApiOperationArgsBaseResponse };\n}\n\nexport function build(buildDefinition: ISwaggerBuildDefinition): void {\n    assert.ok(buildDefinition, 'Definition are required.');\n    assert.ok(\n        buildDefinition.info,\n        'Informations are required. Base is { title: \"Title of my API\", version: \"1.0.0\"}'\n    );\n    if (buildDefinition.basePath) {\n        SwaggerService.getInstance().setBasePath(buildDefinition.basePath);\n    }\n    if (buildDefinition.openapi) {\n        SwaggerService.getInstance().setOpenapi(buildDefinition.openapi);\n    }\n    if (buildDefinition.info) {\n        SwaggerService.getInstance().setInfo(buildDefinition.info);\n    }\n    if (buildDefinition.schemes) {\n        SwaggerService.getInstance().setSchemes(buildDefinition.schemes);\n    }\n    if (buildDefinition.produces) {\n        SwaggerService.getInstance().setProduces(buildDefinition.produces);\n    }\n    if (buildDefinition.consumes) {\n        SwaggerService.getInstance().setConsumes(buildDefinition.consumes);\n    }\n    if (buildDefinition.host) {\n        SwaggerService.getInstance().setHost(buildDefinition.host);\n    }\n    if (buildDefinition.externalDocs) {\n        SwaggerService.getInstance().setExternalDocs(\n            buildDefinition.externalDocs\n        );\n    }\n    if (buildDefinition.securityDefinitions) {\n        SwaggerService.getInstance().addSecurityDefinitions(\n            buildDefinition.securityDefinitions\n        );\n    }\n    if (buildDefinition.models) {\n        SwaggerService.getInstance().setDefinitions(buildDefinition.models);\n    }\n    if (buildDefinition.responses) {\n        SwaggerService.getInstance().setGlobalResponses(\n            buildDefinition.responses\n        );\n    }\n    SwaggerService.getInstance().buildSwagger();\n}\n"]}