javascript 投诉API Swagger文档

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 投诉API Swagger文档相关的知识,希望对你有一定的参考价值。


{
  "swagger": "2.0",
  "info": {
    "title": "Customer Complaints",
    "version": "1.0.0",
    "description": "This is the Orchestration between SNOW and Complaints Manager(RCRM)"
  },
  "host": "api.telstra.com",
  "basePath": "/v1/complaints",
  "schemes": [
    "https"
  ],
  "paths": {
    "/": {
      "post": {
        "tags": [
          "complaints"
        ],
        "summary": "Posts complaint Request to complaint manager(RCRM) for creating the complaints and gets the complaintId and sends back the id to Snow",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [{
          "name": "Authorization",
          "in": "header",
          "description": "A header in the format 'Bearer {access_token}' - get the token by using the OAuth  with the scope 'CustomerComplaintsCreate",
          "type": "string",
          "required": true
        }, {
          "in": "body",
          "name": "payload",
          "description": "Complaints Creation",
          "required": true,
          "schema": {
            "$ref": "#/definitions/ComplaintCreation"
          }
        }],
        "responses": {
          "200": {
            "description": "successfully Created Complaint",
            "schema": {
              "$ref": "#/definitions/ComplaintResponse"
            }
          },
          "400": {
            "description": "Invalid or missing request parameters",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          },
          "500": {
            "description": "An internal error occurred when processing the request",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        },
        "security": [{
          "OAuth2": [
            "CustomerComplaintsCreate"
          ]
        }]
      }
    }
  },
  "securityDefinitions": {
    "OAuth2": {
      "type": "oauth2",
      "tokenUrl": "/v1/oauth/token",
      "flow": "application",
      "scopes": {
        "CustomerComplaintsCreate": "OAuth scope for the Customer Complaint API"
      }
    }
  },
  "definitions": {
    "ComplaintCreation": {
      "type": "object",
      "properties": {
        "data": {
          "type": "object",
          "properties": {
            "customerIssues": {
              "type": "string",
              "description": "Captures the issues of the customer"
            },
            "owner": {
              "type": "string",
              "description": "Employee that the service request is assigned to"
            },
            "priority": {
              "type": "string",
              "description": "Service Request Priority"
            },
            "source": {
              "type": "string",
              "description": "source of the complaint"
            },
            "creationDate": {
              "type": "string",
              "description": "creationDate of the complaint"
            },
            "furtherContactRequired": {
              "type": "boolean",
              "description": "Either addition information for the SR is required or not"
            },
            "Area": {
              "type": "string",
              "description": "High level grouping for the reason why the service request was needed"
            },
            "subArea": {
              "type": "string",
              "description": "A sub-classification of the Area"
            },
            "comments": {
              "type": "string",
              "description": "The description for the Service Request."
            },
            "status": {
              "type": "string",
              "description": "Status of the Service Request"
            },
            "subStatus": {
              "type": "string",
              "description": "A detail of head status"
            },
            "product": {
              "type": "string",
              "description": "Product or Service related to Service Request"
            },
            "subProduct": {
              "type": "array",
              "description":"subproduct details",
              "items" : {
                "type": "string",
                "description": "subProduct1"
              }
            },
            "customer": {
              "type": "object",
              "properties": {
                "preferredCommunicationMethod": {
                  "type": "string",
                  "description": "Allows the user to enter the Communication method requested by customer"
                },
                "customerCode": {
                  "type": "string",
                  "description": "10 digit Customer Code generated from the system and modified when a Customer order is registered."
                }
              },
              "required": [
                "preferredCommunicationMethod",
                "customerCode"
              ]

            },
            "resolution": {
              "type": "object",
              "properties": {
                "requestedResolution": {
                  "type": "string",
                  "description": "Captures the requested resolution given by customer"
                },
                "resolutionDetails": {
                  "type": "string",
                  "description": "Displays the resolution which has been related to the Service Request, A Resolution is a standardized solution to the service request."
                },
                "provideWriting": {
                  "type": "boolean",
                  "description": "Writing to be provided or not"
                },
                "actionsCompleted": {
                  "type": "string",
                  "description": "completed actions"
                },
                "remainingActions": {
                  "type": "string",
                  "description": "remaining actions"
                },
                "proposedResolution": {
                  "type": "string",
                  "description": "Captures the proposed resolution "
                },
                "commitmentMade": {
                  "type": "string",
                  "description": "Captures the Commitments made "
                },
                "customerResponse": {
                  "type": "string",
                  "description": "Captures the Customers response "
                }
              },
              "required": [
                "requestedResolution"
              ]

            },
            "rootCauseAnalysis": {
              "type": "array",
              "description":"rootCauseAnalysis of complaint",
              "items": {
                "type": "string",
                "description":"rootCauseAnalysis1"
                  
              }
            }

          },
          "required": [
            "customerIssues",
            "owner",
            "source",
            "priority",
            "Area",
            "subArea",
            "comments",
            "status",
            "subStatus",
            "product"
          ]
        }
      },
      "required": [

        "data"

      ],
      "example": { 
   "data":{ 
      "customerIssues":"xxx",
      "owner":"xxx",
      "priority":"xxx",
      "source":"xxx",
      "creationDate":"xxx",
      "furtherContactRequired":"xxx",
      "Area":"xxx",
      "subArea":"xxx",
      "comments":"xxx",
      "status":"xxx",
      "subStatus":"xxx",
      "product":"xxx",
      "subProduct":[ 
         "xxx"
      ],
      "customer":{ 
         "preferredCommunicationMethod":"xxx",
         "customerCode":"xxx"
      },
      "resolution":{ 
         "requestedResolution":"xxx",
         "resolutionDetails":"xxx",
         "provideWriting":"xxx",
         "actionsCompleted":"xxx",
         "remainingActions":"xxx",
         "proposedResolution":"xxx",
         "commitmentMade":"xxx",
         "customerResponse":"xxx"
      },
      "rootCauseAnalysis":[ 
         "xxx",
         "xxx"
      ]
   }
}
    },
    "ComplaintResponse": {
      "type": "object",
      "properties": {
    "correlationId": {
              "type": "string",
              "description": "correlationId of transcation"
            },
    "data": {
          "type": "object",
          "properties": {
      "id": {
              "type": "string",
              "description": "id of the complaint created"
            }
      },
      "required":[
      "id"
      ]
      }
    },
      "example": { 
    "correlationId":"58fb5c78-77ed-4f58-97e3-6e0ae3ce498e", 
    "data": 
        { 
           "id":"" 
        } 
  }
  },
    "Error": {
      "type": "object",
      "properties": {
        "time": {
          "type": "string",
          "format": "date-time",
          "description": "The date and time when the message was received by recipient."
        },
        "message": {
          "type": "string",
          "description": "error message"
        },
        "errors": {
          "$ref": "#/definitions/ErrorArrayResponse"
        },
        "correlationId": {
          "type": "string",
          "description": "Correlation id of the message received"
        }
      },
      "required": [
        "message"
      ]
    },
    "ErrorArrayResponse": {
      "type": "array",
      "description": "Array of errors",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": "Error code"
          },
          "message": {
            "type": "string",
            "description": "Error description"
          }
        }
      }
    }
  }
}

以上是关于javascript 投诉API Swagger文档的主要内容,如果未能解决你的问题,请参考以下文章

javascript complaints_api_swagger_smart_docs.js

javascript Hapi-Swagger示例 - 运行并打开“http:// localhost:3000 / documentation”以显示API的文档。

《API接口管理Swagger2实战教程》学习笔记

Spring Boot中使用Swagger2构建API文档

.Net Core入门学习 1 swagger的使用

gRPC helloworld service, RESTful JSON API gateway and swagger UI