github.com/dirkm/go-swagger@v0.19.0/examples/oauth2/restapi/embedded_spec.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package restapi
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"encoding/json"
    10  )
    11  
    12  var (
    13  	// SwaggerJSON embedded version of the swagger document used at generation time
    14  	SwaggerJSON json.RawMessage
    15  	// FlatSwaggerJSON embedded flattened version of the swagger document used at generation time
    16  	FlatSwaggerJSON json.RawMessage
    17  )
    18  
    19  func init() {
    20  	SwaggerJSON = json.RawMessage([]byte(`{
    21    "produces": [
    22      "application/json"
    23    ],
    24    "schemes": [
    25      "http"
    26    ],
    27    "swagger": "2.0",
    28    "info": {
    29      "title": "oauth2 debug",
    30      "version": "0.3.0"
    31    },
    32    "basePath": "/api",
    33    "paths": {
    34      "/auth/callback": {
    35        "get": {
    36          "security": [],
    37          "summary": "return access_token",
    38          "responses": {
    39            "200": {
    40              "description": "login",
    41              "schema": {
    42                "properties": {
    43                  "access_token": {
    44                    "type": "string",
    45                    "format": "string"
    46                  }
    47                }
    48              }
    49            },
    50            "default": {
    51              "description": "error",
    52              "schema": {
    53                "$ref": "#/definitions/error"
    54              }
    55            }
    56          }
    57        }
    58      },
    59      "/customers": {
    60        "get": {
    61          "tags": [
    62            "customers"
    63          ],
    64          "summary": "Get a customerId given an SSN",
    65          "operationId": "getId",
    66          "parameters": [
    67            {
    68              "name": "info",
    69              "in": "body",
    70              "schema": {
    71                "$ref": "#/definitions/social_id"
    72              }
    73            }
    74          ],
    75          "responses": {
    76            "200": {
    77              "description": "OK",
    78              "schema": {
    79                "$ref": "#/definitions/customer"
    80              }
    81            },
    82            "401": {
    83              "description": "unauthorized",
    84              "schema": {
    85                "$ref": "#/definitions/error"
    86              }
    87            },
    88            "404": {
    89              "description": "resource not found",
    90              "schema": {
    91                "$ref": "#/definitions/error"
    92              }
    93            },
    94            "default": {
    95              "description": "error",
    96              "schema": {
    97                "$ref": "#/definitions/error"
    98              }
    99            }
   100          }
   101        },
   102        "post": {
   103          "tags": [
   104            "customers"
   105          ],
   106          "summary": "Create a new customer to track",
   107          "operationId": "create",
   108          "parameters": [
   109            {
   110              "name": "info",
   111              "in": "body",
   112              "schema": {
   113                "$ref": "#/definitions/customer"
   114              }
   115            }
   116          ],
   117          "responses": {
   118            "201": {
   119              "description": "created",
   120              "schema": {
   121                "$ref": "#/definitions/customer"
   122              }
   123            },
   124            "default": {
   125              "description": "error",
   126              "schema": {
   127                "$ref": "#/definitions/error"
   128              }
   129            }
   130          }
   131        }
   132      },
   133      "/login": {
   134        "get": {
   135          "security": [],
   136          "summary": "login through oauth2 server",
   137          "responses": {
   138            "200": {
   139              "description": "login",
   140              "schema": {
   141                "properties": {
   142                  "access_token": {
   143                    "type": "string",
   144                    "format": "string"
   145                  }
   146                }
   147              }
   148            },
   149            "default": {
   150              "description": "error",
   151              "schema": {
   152                "$ref": "#/definitions/error"
   153              }
   154            }
   155          }
   156        }
   157      }
   158    },
   159    "definitions": {
   160      "customer": {
   161        "type": "object",
   162        "required": [
   163          "customerId",
   164          "name",
   165          "surname",
   166          "ssn",
   167          "fipsCode"
   168        ],
   169        "properties": {
   170          "agentId": {
   171            "description": "agent associated with this customer",
   172            "type": "integer",
   173            "format": "int32"
   174          },
   175          "customerId": {
   176            "description": "internal identifier of a customer",
   177            "type": "integer",
   178            "format": "int64",
   179            "readOnly": true
   180          },
   181          "fipsCode": {
   182            "type": "string",
   183            "format": "string",
   184            "minLength": 1
   185          },
   186          "name": {
   187            "type": "string",
   188            "format": "string",
   189            "minLength": 1
   190          },
   191          "ssn": {
   192            "description": "Lookup identifier to find a customer in the system",
   193            "type": "string",
   194            "format": "string",
   195            "minLength": 11
   196          },
   197          "surname": {
   198            "type": "string",
   199            "format": "string",
   200            "minLength": 1
   201          }
   202        }
   203      },
   204      "error": {
   205        "type": "object",
   206        "required": [
   207          "message"
   208        ],
   209        "properties": {
   210          "code": {
   211            "type": "integer",
   212            "format": "int64"
   213          },
   214          "fields": {
   215            "type": "string"
   216          },
   217          "message": {
   218            "type": "string"
   219          }
   220        }
   221      },
   222      "principal": {
   223        "type": "string"
   224      },
   225      "social_id": {
   226        "type": "object",
   227        "required": [
   228          "ssn"
   229        ],
   230        "properties": {
   231          "ssn": {
   232            "type": "string",
   233            "format": "string",
   234            "minLength": 11
   235          }
   236        }
   237      }
   238    },
   239    "securityDefinitions": {
   240      "OauthSecurity": {
   241        "type": "oauth2",
   242        "flow": "accessCode",
   243        "authorizationUrl": "https://accounts.google.com/o/oauth2/v2/auth",
   244        "tokenUrl": "hhttps://www.googleapis.com/oauth2/v4/token",
   245        "scopes": {
   246          "admin": "Admin scope",
   247          "user": "User scope"
   248        }
   249      }
   250    },
   251    "security": [
   252      {
   253        "OauthSecurity": [
   254          "user"
   255        ]
   256      }
   257    ]
   258  }`))
   259  	FlatSwaggerJSON = json.RawMessage([]byte(`{
   260    "produces": [
   261      "application/json"
   262    ],
   263    "schemes": [
   264      "http"
   265    ],
   266    "swagger": "2.0",
   267    "info": {
   268      "title": "oauth2 debug",
   269      "version": "0.3.0"
   270    },
   271    "basePath": "/api",
   272    "paths": {
   273      "/auth/callback": {
   274        "get": {
   275          "security": [],
   276          "summary": "return access_token",
   277          "responses": {
   278            "200": {
   279              "description": "login",
   280              "schema": {
   281                "properties": {
   282                  "access_token": {
   283                    "type": "string",
   284                    "format": "string"
   285                  }
   286                }
   287              }
   288            },
   289            "default": {
   290              "description": "error",
   291              "schema": {
   292                "$ref": "#/definitions/error"
   293              }
   294            }
   295          }
   296        }
   297      },
   298      "/customers": {
   299        "get": {
   300          "tags": [
   301            "customers"
   302          ],
   303          "summary": "Get a customerId given an SSN",
   304          "operationId": "getId",
   305          "parameters": [
   306            {
   307              "name": "info",
   308              "in": "body",
   309              "schema": {
   310                "$ref": "#/definitions/social_id"
   311              }
   312            }
   313          ],
   314          "responses": {
   315            "200": {
   316              "description": "OK",
   317              "schema": {
   318                "$ref": "#/definitions/customer"
   319              }
   320            },
   321            "401": {
   322              "description": "unauthorized",
   323              "schema": {
   324                "$ref": "#/definitions/error"
   325              }
   326            },
   327            "404": {
   328              "description": "resource not found",
   329              "schema": {
   330                "$ref": "#/definitions/error"
   331              }
   332            },
   333            "default": {
   334              "description": "error",
   335              "schema": {
   336                "$ref": "#/definitions/error"
   337              }
   338            }
   339          }
   340        },
   341        "post": {
   342          "tags": [
   343            "customers"
   344          ],
   345          "summary": "Create a new customer to track",
   346          "operationId": "create",
   347          "parameters": [
   348            {
   349              "name": "info",
   350              "in": "body",
   351              "schema": {
   352                "$ref": "#/definitions/customer"
   353              }
   354            }
   355          ],
   356          "responses": {
   357            "201": {
   358              "description": "created",
   359              "schema": {
   360                "$ref": "#/definitions/customer"
   361              }
   362            },
   363            "default": {
   364              "description": "error",
   365              "schema": {
   366                "$ref": "#/definitions/error"
   367              }
   368            }
   369          }
   370        }
   371      },
   372      "/login": {
   373        "get": {
   374          "security": [],
   375          "summary": "login through oauth2 server",
   376          "responses": {
   377            "200": {
   378              "description": "login",
   379              "schema": {
   380                "properties": {
   381                  "access_token": {
   382                    "type": "string",
   383                    "format": "string"
   384                  }
   385                }
   386              }
   387            },
   388            "default": {
   389              "description": "error",
   390              "schema": {
   391                "$ref": "#/definitions/error"
   392              }
   393            }
   394          }
   395        }
   396      }
   397    },
   398    "definitions": {
   399      "customer": {
   400        "type": "object",
   401        "required": [
   402          "customerId",
   403          "name",
   404          "surname",
   405          "ssn",
   406          "fipsCode"
   407        ],
   408        "properties": {
   409          "agentId": {
   410            "description": "agent associated with this customer",
   411            "type": "integer",
   412            "format": "int32"
   413          },
   414          "customerId": {
   415            "description": "internal identifier of a customer",
   416            "type": "integer",
   417            "format": "int64",
   418            "readOnly": true
   419          },
   420          "fipsCode": {
   421            "type": "string",
   422            "format": "string",
   423            "minLength": 1
   424          },
   425          "name": {
   426            "type": "string",
   427            "format": "string",
   428            "minLength": 1
   429          },
   430          "ssn": {
   431            "description": "Lookup identifier to find a customer in the system",
   432            "type": "string",
   433            "format": "string",
   434            "minLength": 11
   435          },
   436          "surname": {
   437            "type": "string",
   438            "format": "string",
   439            "minLength": 1
   440          }
   441        }
   442      },
   443      "error": {
   444        "type": "object",
   445        "required": [
   446          "message"
   447        ],
   448        "properties": {
   449          "code": {
   450            "type": "integer",
   451            "format": "int64"
   452          },
   453          "fields": {
   454            "type": "string"
   455          },
   456          "message": {
   457            "type": "string"
   458          }
   459        }
   460      },
   461      "principal": {
   462        "type": "string"
   463      },
   464      "social_id": {
   465        "type": "object",
   466        "required": [
   467          "ssn"
   468        ],
   469        "properties": {
   470          "ssn": {
   471            "type": "string",
   472            "format": "string",
   473            "minLength": 11
   474          }
   475        }
   476      }
   477    },
   478    "securityDefinitions": {
   479      "OauthSecurity": {
   480        "type": "oauth2",
   481        "flow": "accessCode",
   482        "authorizationUrl": "https://accounts.google.com/o/oauth2/v2/auth",
   483        "tokenUrl": "hhttps://www.googleapis.com/oauth2/v4/token",
   484        "scopes": {
   485          "admin": "Admin scope",
   486          "user": "User scope"
   487        }
   488      }
   489    },
   490    "security": [
   491      {
   492        "OauthSecurity": [
   493          "user"
   494        ]
   495      }
   496    ]
   497  }`))
   498  }