undo changes to petstore.yaml oas3.0 (#6299)

This commit is contained in:
William Cheng 2020-05-15 09:12:12 +08:00 committed by GitHub
parent 7f8118069e
commit 00a706b760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 30 deletions

View File

@ -391,7 +391,7 @@ paths:
default: default:
description: successful operation description: successful operation
security: security:
- auth_cookie: [] - api_key: []
requestBody: requestBody:
content: content:
application/json: application/json:
@ -410,7 +410,7 @@ paths:
default: default:
description: successful operation description: successful operation
security: security:
- auth_cookie: [] - api_key: []
requestBody: requestBody:
$ref: '#/components/requestBodies/UserArray' $ref: '#/components/requestBodies/UserArray'
/user/createWithList: /user/createWithList:
@ -424,7 +424,7 @@ paths:
default: default:
description: successful operation description: successful operation
security: security:
- auth_cookie: [] - api_key: []
requestBody: requestBody:
$ref: '#/components/requestBodies/UserArray' $ref: '#/components/requestBodies/UserArray'
/user/login: /user/login:
@ -454,7 +454,7 @@ paths:
headers: headers:
Set-Cookie: Set-Cookie:
description: >- description: >-
Cookie authentication key for use with the `auth_cookie` Cookie authentication key for use with the `api_key`
apiKey authentication. apiKey authentication.
schema: schema:
type: string type: string
@ -489,7 +489,7 @@ paths:
default: default:
description: successful operation description: successful operation
security: security:
- auth_cookie: [] - api_key: []
'/user/{username}': '/user/{username}':
get: get:
tags: tags:
@ -537,7 +537,7 @@ paths:
'404': '404':
description: User not found description: User not found
security: security:
- auth_cookie: [] - api_key: []
requestBody: requestBody:
content: content:
application/json: application/json:
@ -564,7 +564,7 @@ paths:
'404': '404':
description: User not found description: User not found
security: security:
- auth_cookie: [] - api_key: []
externalDocs: externalDocs:
description: Find out more about Swagger description: Find out more about Swagger
url: 'http://swagger.io' url: 'http://swagger.io'
@ -602,10 +602,6 @@ components:
type: apiKey type: apiKey
name: api_key name: api_key
in: header in: header
auth_cookie:
type: apiKey
name: AUTH_KEY
in: cookie
schemas: schemas:
Order: Order:
title: Pet Order title: Pet Order

View File

@ -61,6 +61,10 @@ function user_api:create_user(user)
req:set_body(dkjson.encode(user)) req:set_body(dkjson.encode(user))
-- api key in headers 'api_key'
if self.api_key['api_key'] then
req.headers:upsert("api_key", self.api_key['api_key'])
end
-- make the HTTP call -- make the HTTP call
local headers, stream, errno = req:go() local headers, stream, errno = req:go()
@ -98,6 +102,10 @@ function user_api:create_users_with_array_input(user)
req:set_body(dkjson.encode(user)) req:set_body(dkjson.encode(user))
-- api key in headers 'api_key'
if self.api_key['api_key'] then
req.headers:upsert("api_key", self.api_key['api_key'])
end
-- make the HTTP call -- make the HTTP call
local headers, stream, errno = req:go() local headers, stream, errno = req:go()
@ -135,6 +143,10 @@ function user_api:create_users_with_list_input(user)
req:set_body(dkjson.encode(user)) req:set_body(dkjson.encode(user))
-- api key in headers 'api_key'
if self.api_key['api_key'] then
req.headers:upsert("api_key", self.api_key['api_key'])
end
-- make the HTTP call -- make the HTTP call
local headers, stream, errno = req:go() local headers, stream, errno = req:go()
@ -166,6 +178,10 @@ function user_api:delete_user(username)
-- set HTTP verb -- set HTTP verb
req.headers:upsert(":method", "DELETE") req.headers:upsert(":method", "DELETE")
-- api key in headers 'api_key'
if self.api_key['api_key'] then
req.headers:upsert("api_key", self.api_key['api_key'])
end
-- make the HTTP call -- make the HTTP call
local headers, stream, errno = req:go() local headers, stream, errno = req:go()
@ -289,6 +305,10 @@ function user_api:logout_user()
-- set HTTP verb -- set HTTP verb
req.headers:upsert(":method", "GET") req.headers:upsert(":method", "GET")
-- api key in headers 'api_key'
if self.api_key['api_key'] then
req.headers:upsert("api_key", self.api_key['api_key'])
end
-- make the HTTP call -- make the HTTP call
local headers, stream, errno = req:go() local headers, stream, errno = req:go()
@ -326,6 +346,10 @@ function user_api:update_user(username, user)
req:set_body(dkjson.encode(user)) req:set_body(dkjson.encode(user))
-- api key in headers 'api_key'
if self.api_key['api_key'] then
req.headers:upsert("api_key", self.api_key['api_key'])
end
-- make the HTTP call -- make the HTTP call
local headers, stream, errno = req:go() local headers, stream, errno = req:go()

View File

@ -108,12 +108,6 @@ Authentication schemes defined for the API:
- **API key parameter name**: api_key - **API key parameter name**: api_key
- **Location**: HTTP header - **Location**: HTTP header
### auth_cookie
- **Type**: API key
- **API key parameter name**: AUTH_KEY
- **Location**:
## Author ## Author

View File

@ -34,7 +34,7 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
* code 0 : (successful operation) * code 0 : (successful operation)
* *
* Available security schemes: * Available security schemes:
* auth_cookie (apiKey) * api_key (apiKey)
* *
* @param user Created user object * @param user Created user object
*/ */
@ -42,7 +42,7 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
basicRequest basicRequest
.method(Method.POST, uri"$baseUrl/user") .method(Method.POST, uri"$baseUrl/user")
.contentType("application/json") .contentType("application/json")
.cookie("AUTH_KEY", apiKey.value) .header("api_key", apiKey.value)
.body(user) .body(user)
.response(asJson[Unit]) .response(asJson[Unit])
@ -51,7 +51,7 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
* code 0 : (successful operation) * code 0 : (successful operation)
* *
* Available security schemes: * Available security schemes:
* auth_cookie (apiKey) * api_key (apiKey)
* *
* @param user List of user object * @param user List of user object
*/ */
@ -59,7 +59,7 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
basicRequest basicRequest
.method(Method.POST, uri"$baseUrl/user/createWithArray") .method(Method.POST, uri"$baseUrl/user/createWithArray")
.contentType("application/json") .contentType("application/json")
.cookie("AUTH_KEY", apiKey.value) .header("api_key", apiKey.value)
.body(user) .body(user)
.response(asJson[Unit]) .response(asJson[Unit])
@ -68,7 +68,7 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
* code 0 : (successful operation) * code 0 : (successful operation)
* *
* Available security schemes: * Available security schemes:
* auth_cookie (apiKey) * api_key (apiKey)
* *
* @param user List of user object * @param user List of user object
*/ */
@ -76,7 +76,7 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
basicRequest basicRequest
.method(Method.POST, uri"$baseUrl/user/createWithList") .method(Method.POST, uri"$baseUrl/user/createWithList")
.contentType("application/json") .contentType("application/json")
.cookie("AUTH_KEY", apiKey.value) .header("api_key", apiKey.value)
.body(user) .body(user)
.response(asJson[Unit]) .response(asJson[Unit])
@ -88,7 +88,7 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
* code 404 : (User not found) * code 404 : (User not found)
* *
* Available security schemes: * Available security schemes:
* auth_cookie (apiKey) * api_key (apiKey)
* *
* @param username The name that needs to be deleted * @param username The name that needs to be deleted
*/ */
@ -96,7 +96,7 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
basicRequest basicRequest
.method(Method.DELETE, uri"$baseUrl/user/${username}") .method(Method.DELETE, uri"$baseUrl/user/${username}")
.contentType("application/json") .contentType("application/json")
.cookie("AUTH_KEY", apiKey.value) .header("api_key", apiKey.value)
.response(asJson[Unit]) .response(asJson[Unit])
/** /**
@ -117,7 +117,7 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
* Expected answers: * Expected answers:
* code 200 : String (successful operation) * code 200 : String (successful operation)
* Headers : * Headers :
* Set-Cookie - Cookie authentication key for use with the `auth_cookie` apiKey authentication. * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when toekn expires * X-Expires-After - date in UTC when toekn expires
* code 400 : (Invalid username/password supplied) * code 400 : (Invalid username/password supplied)
@ -136,13 +136,13 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
* code 0 : (successful operation) * code 0 : (successful operation)
* *
* Available security schemes: * Available security schemes:
* auth_cookie (apiKey) * api_key (apiKey)
*/ */
def logoutUser()(implicit apiKey: ApiKeyValue): ApiRequestT[Unit] = def logoutUser()(implicit apiKey: ApiKeyValue): ApiRequestT[Unit] =
basicRequest basicRequest
.method(Method.GET, uri"$baseUrl/user/logout") .method(Method.GET, uri"$baseUrl/user/logout")
.contentType("application/json") .contentType("application/json")
.cookie("AUTH_KEY", apiKey.value) .header("api_key", apiKey.value)
.response(asJson[Unit]) .response(asJson[Unit])
/** /**
@ -153,7 +153,7 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
* code 404 : (User not found) * code 404 : (User not found)
* *
* Available security schemes: * Available security schemes:
* auth_cookie (apiKey) * api_key (apiKey)
* *
* @param username name that need to be deleted * @param username name that need to be deleted
* @param user Updated user object * @param user Updated user object
@ -162,7 +162,7 @@ class UserApi(baseUrl: String)(implicit serializer: SttpSerializer) {
basicRequest basicRequest
.method(Method.PUT, uri"$baseUrl/user/${username}") .method(Method.PUT, uri"$baseUrl/user/${username}")
.contentType("application/json") .contentType("application/json")
.cookie("AUTH_KEY", apiKey.value) .header("api_key", apiKey.value)
.body(user) .body(user)
.response(asJson[Unit]) .response(asJson[Unit])