github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/cmd/protoc-gen-openapi/converter/testdata/signup.go (about) 1 package testdata 2 3 const Signup = `{ 4 "components": { 5 "requestBodies": { 6 "SignupCompleteSignupRequest": { 7 "content": { 8 "application/json": { 9 "schema": { 10 "$ref": "#/components/schemas/CompleteSignupRequest" 11 } 12 } 13 }, 14 "description": "SignupCompleteSignupRequest" 15 }, 16 "SignupHasPaymentMethodRequest": { 17 "content": { 18 "application/json": { 19 "schema": { 20 "$ref": "#/components/schemas/HasPaymentMethodRequest" 21 } 22 } 23 }, 24 "description": "SignupHasPaymentMethodRequest" 25 }, 26 "SignupRecoverRequest": { 27 "content": { 28 "application/json": { 29 "schema": { 30 "$ref": "#/components/schemas/RecoverRequest" 31 } 32 } 33 }, 34 "description": "SignupRecoverRequest" 35 }, 36 "SignupSendVerificationEmailRequest": { 37 "content": { 38 "application/json": { 39 "schema": { 40 "$ref": "#/components/schemas/SendVerificationEmailRequest" 41 } 42 } 43 }, 44 "description": "SignupSendVerificationEmailRequest" 45 }, 46 "SignupSetPaymentMethodRequest": { 47 "content": { 48 "application/json": { 49 "schema": { 50 "$ref": "#/components/schemas/SetPaymentMethodRequest" 51 } 52 } 53 }, 54 "description": "SignupSetPaymentMethodRequest" 55 }, 56 "SignupVerifyRequest": { 57 "content": { 58 "application/json": { 59 "schema": { 60 "$ref": "#/components/schemas/VerifyRequest" 61 } 62 } 63 }, 64 "description": "SignupVerifyRequest" 65 } 66 }, 67 "responses": { 68 "MicroAPIError": { 69 "content": { 70 "application/json": { 71 "schema": { 72 "properties": { 73 "Code": { 74 "description": "Error code", 75 "example": 500, 76 "type": "number" 77 }, 78 "Detail": { 79 "description": "Error detail", 80 "example": "service not found", 81 "type": "string" 82 }, 83 "Id": { 84 "description": "Error ID", 85 "type": "string" 86 }, 87 "Status": { 88 "description": "Error status message", 89 "example": "Internal Server Error", 90 "type": "string" 91 } 92 }, 93 "title": "MicroAPIError", 94 "type": "object" 95 } 96 } 97 }, 98 "description": "Error from the Micro API" 99 }, 100 "SignupCompleteSignupResponse": { 101 "content": { 102 "application/json": { 103 "schema": { 104 "$ref": "#/components/schemas/CompleteSignupResponse" 105 } 106 } 107 }, 108 "description": "SignupCompleteSignupResponse" 109 }, 110 "SignupHasPaymentMethodResponse": { 111 "content": { 112 "application/json": { 113 "schema": { 114 "$ref": "#/components/schemas/HasPaymentMethodResponse" 115 } 116 } 117 }, 118 "description": "SignupHasPaymentMethodResponse" 119 }, 120 "SignupRecoverResponse": { 121 "content": { 122 "application/json": { 123 "schema": { 124 "$ref": "#/components/schemas/RecoverResponse" 125 } 126 } 127 }, 128 "description": "SignupRecoverResponse" 129 }, 130 "SignupSendVerificationEmailResponse": { 131 "content": { 132 "application/json": { 133 "schema": { 134 "$ref": "#/components/schemas/SendVerificationEmailResponse" 135 } 136 } 137 }, 138 "description": "SignupSendVerificationEmailResponse" 139 }, 140 "SignupSetPaymentMethodResponse": { 141 "content": { 142 "application/json": { 143 "schema": { 144 "$ref": "#/components/schemas/SetPaymentMethodResponse" 145 } 146 } 147 }, 148 "description": "SignupSetPaymentMethodResponse" 149 }, 150 "SignupVerifyResponse": { 151 "content": { 152 "application/json": { 153 "schema": { 154 "$ref": "#/components/schemas/VerifyResponse" 155 } 156 } 157 }, 158 "description": "SignupVerifyResponse" 159 } 160 }, 161 "schemas": { 162 "AuthToken": { 163 "description": "lifted from https://github.com/micro/go-micro/blob/master/auth/service/proto/auth.proto", 164 "properties": { 165 "accessToken": { 166 "type": "string" 167 }, 168 "created": { 169 "format": "int64", 170 "type": "number" 171 }, 172 "expiry": { 173 "format": "int64", 174 "type": "number" 175 }, 176 "refreshToken": { 177 "type": "string" 178 } 179 }, 180 "title": "AuthToken", 181 "type": "object" 182 }, 183 "CompleteSignupRequest": { 184 "properties": { 185 "email": { 186 "type": "string" 187 }, 188 "namespace": { 189 "description": "Which namespace to sign up to based on previous invite", 190 "type": "string" 191 }, 192 "paymentMethodID": { 193 "description": "This payment method ID is the one we got back from Stripe on the frontend (ie. 'm3o.com/subscribe.html')\n deprecated: signup service now knows the payment method due to the\n SetPaymentMethod call issued by the frontend.", 194 "type": "string" 195 }, 196 "secret": { 197 "description": "The secret/password to use for the account", 198 "type": "string" 199 }, 200 "token": { 201 "description": "The token has to be passed here too for identification purposes.", 202 "type": "string" 203 } 204 }, 205 "title": "CompleteSignupRequest", 206 "type": "object" 207 }, 208 "CompleteSignupResponse": { 209 "properties": { 210 "authToken": { 211 "properties": { 212 "accessToken": { 213 "type": "string" 214 }, 215 "created": { 216 "format": "int64", 217 "type": "number" 218 }, 219 "expiry": { 220 "format": "int64", 221 "type": "number" 222 }, 223 "refreshToken": { 224 "type": "string" 225 } 226 }, 227 "type": "object" 228 }, 229 "namespace": { 230 "type": "string" 231 } 232 }, 233 "title": "CompleteSignupResponse", 234 "type": "object" 235 }, 236 "HasPaymentMethodRequest": { 237 "properties": { 238 "token": { 239 "description": "We can't read by email because that would be too easy to guess.\n The token is already used for identification purposes during the signup\n so we will use that too to pull for the payment method.", 240 "type": "string" 241 } 242 }, 243 "title": "HasPaymentMethodRequest", 244 "type": "object" 245 }, 246 "HasPaymentMethodResponse": { 247 "properties": { 248 "has": { 249 "type": "boolean" 250 } 251 }, 252 "title": "HasPaymentMethodResponse", 253 "type": "object" 254 }, 255 "RecoverRequest": { 256 "properties": { 257 "email": { 258 "type": "string" 259 } 260 }, 261 "title": "RecoverRequest", 262 "type": "object" 263 }, 264 "RecoverResponse": { 265 "title": "RecoverResponse", 266 "type": "object" 267 }, 268 "SendVerificationEmailRequest": { 269 "properties": { 270 "email": { 271 "type": "string" 272 } 273 }, 274 "title": "SendVerificationEmailRequest", 275 "type": "object" 276 }, 277 "SendVerificationEmailResponse": { 278 "title": "SendVerificationEmailResponse", 279 "type": "object" 280 }, 281 "SetPaymentMethodRequest": { 282 "properties": { 283 "email": { 284 "type": "string" 285 }, 286 "paymentMethod": { 287 "type": "string" 288 } 289 }, 290 "title": "SetPaymentMethodRequest", 291 "type": "object" 292 }, 293 "SetPaymentMethodResponse": { 294 "title": "SetPaymentMethodResponse", 295 "type": "object" 296 }, 297 "VerifyRequest": { 298 "properties": { 299 "email": { 300 "type": "string" 301 }, 302 "token": { 303 "description": "Email token that was received in an email.", 304 "type": "string" 305 } 306 }, 307 "title": "VerifyRequest", 308 "type": "object" 309 }, 310 "VerifyResponse": { 311 "properties": { 312 "authToken": { 313 "description": "Auth token to be saved into '~/.micro'\n For users who are already registered and paid,\n the flow stops here.\n For users who are yet to be registered\n the token will be acquired in the 'FinishSignup' step.", 314 "properties": { 315 "accessToken": { 316 "type": "string" 317 }, 318 "created": { 319 "format": "int64", 320 "type": "number" 321 }, 322 "expiry": { 323 "format": "int64", 324 "type": "number" 325 }, 326 "refreshToken": { 327 "type": "string" 328 } 329 }, 330 "type": "object" 331 }, 332 "customerID": { 333 "description": "Payment provider custommer id that can be used to\n acquire a payment method, see 'micro login' flow for more.\n @todo this is likely not needed", 334 "type": "string" 335 }, 336 "message": { 337 "description": "Message to display to the user", 338 "type": "string" 339 }, 340 "namespace": { 341 "description": "Namespace to use\n @todod deprecated since we no longer support OTP logins", 342 "type": "string" 343 }, 344 "namespaces": { 345 "description": "Namespaces one has access to based on previous invites\n Currently only 1 is supported", 346 "items": { 347 "type": "string" 348 }, 349 "type": "array" 350 }, 351 "paymentRequired": { 352 "description": "Whether payment is required or not", 353 "type": "boolean" 354 } 355 }, 356 "title": "VerifyResponse", 357 "type": "object" 358 } 359 }, 360 "securitySchemes": { 361 "MicroAPIToken": { 362 "bearerFormat": "JWT", 363 "description": "Micro API token", 364 "scheme": "bearer", 365 "type": "http" 366 } 367 } 368 }, 369 "info": { 370 "description": "Generated by protoc-gen-openapi", 371 "title": "Go.Micro.Generator.Test", 372 "version": "1", 373 "x-logo": { 374 "altText": "Micro logo", 375 "backgroundColor": "#FFFFFF", 376 "url": "https://micro.dev/images/brand.png" 377 } 378 }, 379 "openapi": "3.0.0", 380 "paths": { 381 "/test/Signup/CompleteSignup": { 382 "parameters": [ 383 { 384 "in": "header", 385 "name": "Micro-Namespace", 386 "required": true, 387 "schema": { 388 "default": "micro", 389 "type": "string" 390 } 391 } 392 ], 393 "post": { 394 "requestBody": { 395 "$ref": "#/components/requestBodies/SignupCompleteSignupRequest" 396 }, 397 "responses": { 398 "200": { 399 "$ref": "#/components/responses/SignupCompleteSignupResponse" 400 }, 401 "default": { 402 "$ref": "#/components/responses/MicroAPIError" 403 } 404 }, 405 "security": [ 406 { 407 "MicroAPIToken": [] 408 } 409 ], 410 "summary": "Signup.CompleteSignup(CompleteSignupRequest)" 411 } 412 }, 413 "/test/Signup/HasPaymentMethod": { 414 "parameters": [ 415 { 416 "in": "header", 417 "name": "Micro-Namespace", 418 "required": true, 419 "schema": { 420 "default": "micro", 421 "type": "string" 422 } 423 } 424 ], 425 "post": { 426 "requestBody": { 427 "$ref": "#/components/requestBodies/SignupHasPaymentMethodRequest" 428 }, 429 "responses": { 430 "200": { 431 "$ref": "#/components/responses/SignupHasPaymentMethodResponse" 432 }, 433 "default": { 434 "$ref": "#/components/responses/MicroAPIError" 435 } 436 }, 437 "security": [ 438 { 439 "MicroAPIToken": [] 440 } 441 ], 442 "summary": "Signup.HasPaymentMethod(HasPaymentMethodRequest)" 443 } 444 }, 445 "/test/Signup/Recover": { 446 "parameters": [ 447 { 448 "in": "header", 449 "name": "Micro-Namespace", 450 "required": true, 451 "schema": { 452 "default": "micro", 453 "type": "string" 454 } 455 } 456 ], 457 "post": { 458 "requestBody": { 459 "$ref": "#/components/requestBodies/SignupRecoverRequest" 460 }, 461 "responses": { 462 "200": { 463 "$ref": "#/components/responses/SignupRecoverResponse" 464 }, 465 "default": { 466 "$ref": "#/components/responses/MicroAPIError" 467 } 468 }, 469 "security": [ 470 { 471 "MicroAPIToken": [] 472 } 473 ], 474 "summary": "Signup.Recover(RecoverRequest)" 475 } 476 }, 477 "/test/Signup/SendVerificationEmail": { 478 "parameters": [ 479 { 480 "in": "header", 481 "name": "Micro-Namespace", 482 "required": true, 483 "schema": { 484 "default": "micro", 485 "type": "string" 486 } 487 } 488 ], 489 "post": { 490 "requestBody": { 491 "$ref": "#/components/requestBodies/SignupSendVerificationEmailRequest" 492 }, 493 "responses": { 494 "200": { 495 "$ref": "#/components/responses/SignupSendVerificationEmailResponse" 496 }, 497 "default": { 498 "$ref": "#/components/responses/MicroAPIError" 499 } 500 }, 501 "security": [ 502 { 503 "MicroAPIToken": [] 504 } 505 ], 506 "summary": "Signup.SendVerificationEmail(SendVerificationEmailRequest)" 507 } 508 }, 509 "/test/Signup/SetPaymentMethod": { 510 "parameters": [ 511 { 512 "in": "header", 513 "name": "Micro-Namespace", 514 "required": true, 515 "schema": { 516 "default": "micro", 517 "type": "string" 518 } 519 } 520 ], 521 "post": { 522 "requestBody": { 523 "$ref": "#/components/requestBodies/SignupSetPaymentMethodRequest" 524 }, 525 "responses": { 526 "200": { 527 "$ref": "#/components/responses/SignupSetPaymentMethodResponse" 528 }, 529 "default": { 530 "$ref": "#/components/responses/MicroAPIError" 531 } 532 }, 533 "security": [ 534 { 535 "MicroAPIToken": [] 536 } 537 ], 538 "summary": "Signup.SetPaymentMethod(SetPaymentMethodRequest)" 539 } 540 }, 541 "/test/Signup/Verify": { 542 "parameters": [ 543 { 544 "in": "header", 545 "name": "Micro-Namespace", 546 "required": true, 547 "schema": { 548 "default": "micro", 549 "type": "string" 550 } 551 } 552 ], 553 "post": { 554 "requestBody": { 555 "$ref": "#/components/requestBodies/SignupVerifyRequest" 556 }, 557 "responses": { 558 "200": { 559 "$ref": "#/components/responses/SignupVerifyResponse" 560 }, 561 "default": { 562 "$ref": "#/components/responses/MicroAPIError" 563 } 564 }, 565 "security": [ 566 { 567 "MicroAPIToken": [] 568 } 569 ], 570 "summary": "Signup.Verify(VerifyRequest)" 571 } 572 } 573 }, 574 "servers": [ 575 { 576 "url": "http://localhost:8080", 577 "description": "Micro dev environment" 578 } 579 ] 580 }`