forked from loafle/openapi-generator-original
Fix NPE when generating examples for parameter (object) (#12538)
* fix NPE when generating examples for parameter (object) * add new files
This commit is contained in:
parent
6869f3b0b9
commit
f52ee28215
@ -1,6 +1,6 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-3.0
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
|
@ -1,6 +1,6 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-3.1
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
|
@ -1,6 +1,6 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-5.0
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
|
@ -1,6 +1,6 @@
|
||||
generatorName: aspnetcore
|
||||
outputDir: samples/server/petstore/aspnetcore-6.0
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
|
||||
additionalProperties:
|
||||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
|
||||
|
@ -1410,8 +1410,15 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
} else {
|
||||
example = "new List<" + p.items.dataType + ">()";
|
||||
}
|
||||
} else if (Boolean.TRUE.equals(p.isModel)) {
|
||||
example = "new " + p.dataType + "()";
|
||||
} else if (Boolean.TRUE.equals(p.isMap)) {
|
||||
example = "new Dictionary<String, " + p.items.dataType + ">";
|
||||
if (p.items != null) {
|
||||
example = "new Dictionary<String, " + p.items.dataType + ">";
|
||||
} else {
|
||||
// default to String if item is not defined
|
||||
example = "new Dictionary<String, String>";
|
||||
}
|
||||
}
|
||||
|
||||
p.example = example;
|
||||
|
@ -0,0 +1,754 @@
|
||||
openapi: 3.0.0
|
||||
servers:
|
||||
- url: 'http://petstore.swagger.io/v2'
|
||||
info:
|
||||
description: >-
|
||||
This is a sample server Petstore server. For this sample, you can use the api key
|
||||
`special-key` to test the authorization filters.
|
||||
version: 1.0.0
|
||||
title: OpenAPI Petstore
|
||||
license:
|
||||
name: Apache-2.0
|
||||
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
|
||||
tags:
|
||||
- name: pet
|
||||
description: Everything about your Pets
|
||||
- name: store
|
||||
description: Access to Petstore orders
|
||||
- name: user
|
||||
description: Operations about user
|
||||
paths:
|
||||
/pet:
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Add a new pet to the store
|
||||
description: ''
|
||||
operationId: addPet
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
put:
|
||||
tags:
|
||||
- pet
|
||||
summary: Update an existing pet
|
||||
description: ''
|
||||
operationId: updatePet
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
'405':
|
||||
description: Validation exception
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
/pet/findByStatus:
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Finds Pets by status
|
||||
description: Multiple status values can be provided with comma separated strings
|
||||
operationId: findPetsByStatus
|
||||
parameters:
|
||||
- name: status
|
||||
in: query
|
||||
description: Status values that need to be considered for filter
|
||||
required: true
|
||||
style: form
|
||||
explode: false
|
||||
deprecated: true
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
default: available
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'400':
|
||||
description: Invalid status value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'read:pets'
|
||||
/pet/findByTags:
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Finds Pets by tags
|
||||
description: >-
|
||||
Multiple tags can be provided with comma separated strings. Use tag1,
|
||||
tag2, tag3 for testing.
|
||||
operationId: findPetsByTags
|
||||
parameters:
|
||||
- name: tags
|
||||
in: query
|
||||
description: Tags to filter by
|
||||
required: true
|
||||
style: form
|
||||
explode: false
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'400':
|
||||
description: Invalid tag value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'read:pets'
|
||||
deprecated: true
|
||||
'/pet/{petId}':
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Find pet by ID
|
||||
description: Returns a single pet
|
||||
operationId: getPetById
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to return
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
security:
|
||||
- api_key: []
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Updates a pet in the store with form data
|
||||
description: ''
|
||||
operationId: updatePetWithForm
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet that needs to be updated
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
description: Updated name of the pet
|
||||
type: string
|
||||
status:
|
||||
description: Updated status of the pet
|
||||
type: string
|
||||
delete:
|
||||
tags:
|
||||
- pet
|
||||
summary: Deletes a pet
|
||||
description: ''
|
||||
operationId: deletePet
|
||||
parameters:
|
||||
- name: api_key
|
||||
in: header
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
- name: petId
|
||||
in: path
|
||||
description: Pet id to delete
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid pet value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
'/pet/{petId}/uploadImage':
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: uploads an image
|
||||
description: ''
|
||||
operationId: uploadFile
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to update
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponse'
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
type: string
|
||||
format: binary
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
summary: Returns pet inventories by status
|
||||
description: Returns a map of status codes to quantities
|
||||
operationId: getInventory
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: integer
|
||||
format: int32
|
||||
security:
|
||||
- api_key: []
|
||||
/store/order:
|
||||
post:
|
||||
tags:
|
||||
- store
|
||||
summary: Place an order for a pet
|
||||
description: ''
|
||||
operationId: placeOrder
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
'400':
|
||||
description: Invalid Order
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
description: order placed for purchasing the pet
|
||||
required: true
|
||||
'/store/order/{orderId}':
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
summary: Find purchase order by ID
|
||||
description: >-
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values
|
||||
will generated exceptions
|
||||
operationId: getOrderById
|
||||
parameters:
|
||||
- name: orderId
|
||||
in: path
|
||||
description: ID of pet that needs to be fetched
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 1
|
||||
maximum: 5
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Order not found
|
||||
delete:
|
||||
tags:
|
||||
- store
|
||||
summary: Delete purchase order by ID
|
||||
description: >-
|
||||
For valid response try integer IDs with value < 1000. Anything above
|
||||
1000 or nonintegers will generate API errors
|
||||
operationId: deleteOrder
|
||||
parameters:
|
||||
- name: orderId
|
||||
in: path
|
||||
description: ID of the order that needs to be deleted
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Order not found
|
||||
/user:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Create user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: createUser
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
description: Created user object
|
||||
required: true
|
||||
/user/createWithArray:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Creates list of users with given input array
|
||||
description: ''
|
||||
operationId: createUsersWithArrayInput
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/UserArray'
|
||||
/user/createWithList:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Creates list of users with given input array
|
||||
description: ''
|
||||
operationId: createUsersWithListInput
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/UserArray'
|
||||
/user/login:
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Logs user into the system
|
||||
description: ''
|
||||
operationId: loginUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: query
|
||||
description: The user name for login
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
|
||||
- name: password
|
||||
in: query
|
||||
description: The password for login in clear text
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
headers:
|
||||
Set-Cookie:
|
||||
description: >-
|
||||
Cookie authentication key for use with the `api_key`
|
||||
apiKey authentication.
|
||||
schema:
|
||||
type: string
|
||||
example: AUTH_KEY=abcde12345; Path=/; HttpOnly
|
||||
X-Rate-Limit:
|
||||
description: calls per hour allowed by the user
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
X-Expires-After:
|
||||
description: date in UTC when token expires
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: string
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
'400':
|
||||
description: Invalid username/password supplied
|
||||
/user/logout:
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Logs out current logged in user session
|
||||
description: ''
|
||||
operationId: logoutUser
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
security:
|
||||
- api_key: []
|
||||
'/user/{username}':
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Get user by user name
|
||||
description: ''
|
||||
operationId: getUserByName
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: The name that needs to be fetched. Use user1 for testing.
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
'400':
|
||||
description: Invalid username supplied
|
||||
'404':
|
||||
description: User not found
|
||||
put:
|
||||
tags:
|
||||
- user
|
||||
summary: Updated user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: updateUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: name that need to be deleted
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid user supplied
|
||||
'404':
|
||||
description: User not found
|
||||
security:
|
||||
- api_key: []
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
description: Updated user object
|
||||
required: true
|
||||
delete:
|
||||
tags:
|
||||
- user
|
||||
summary: Delete user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: deleteUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: The name that needs to be deleted
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid username supplied
|
||||
'404':
|
||||
description: User not found
|
||||
security:
|
||||
- api_key: []
|
||||
/fake/parameter_example_test:
|
||||
get:
|
||||
tags:
|
||||
- fake
|
||||
summary: fake endpoint to test parameter example (object)
|
||||
description: ''
|
||||
operationId: fake_parameter_example_test
|
||||
parameters:
|
||||
- name: data
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/components/schemas/Pet"
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: 'http://swagger.io'
|
||||
components:
|
||||
requestBodies:
|
||||
UserArray:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/User'
|
||||
description: List of user object
|
||||
required: true
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Pet object that needs to be added to the store
|
||||
required: true
|
||||
securitySchemes:
|
||||
petstore_auth:
|
||||
type: oauth2
|
||||
flows:
|
||||
implicit:
|
||||
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
|
||||
scopes:
|
||||
'write:pets': modify pets in your account
|
||||
'read:pets': read your pets
|
||||
api_key:
|
||||
type: apiKey
|
||||
name: api_key
|
||||
in: header
|
||||
schemas:
|
||||
Order:
|
||||
title: Pet Order
|
||||
description: An order for a pets from the pet store
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
petId:
|
||||
type: integer
|
||||
format: int64
|
||||
quantity:
|
||||
type: integer
|
||||
format: int32
|
||||
shipDate:
|
||||
type: string
|
||||
format: date-time
|
||||
status:
|
||||
type: string
|
||||
description: Order Status
|
||||
enum:
|
||||
- placed
|
||||
- approved
|
||||
- delivered
|
||||
complete:
|
||||
type: boolean
|
||||
default: false
|
||||
xml:
|
||||
name: Order
|
||||
Category:
|
||||
title: Pet category
|
||||
description: A category for a pet
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
|
||||
xml:
|
||||
name: Category
|
||||
User:
|
||||
title: a User
|
||||
description: A User who is purchasing from the pet store
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
username:
|
||||
type: string
|
||||
firstName:
|
||||
type: string
|
||||
lastName:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
phone:
|
||||
type: string
|
||||
userStatus:
|
||||
type: integer
|
||||
format: int32
|
||||
description: User Status
|
||||
xml:
|
||||
name: User
|
||||
Tag:
|
||||
title: Pet Tag
|
||||
description: A tag for a pet
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
xml:
|
||||
name: Tag
|
||||
Pet:
|
||||
title: a Pet
|
||||
description: A pet for sale in the pet store
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
category:
|
||||
$ref: '#/components/schemas/Category'
|
||||
name:
|
||||
type: string
|
||||
example: doggie
|
||||
photoUrls:
|
||||
type: array
|
||||
xml:
|
||||
name: photoUrl
|
||||
wrapped: true
|
||||
items:
|
||||
type: string
|
||||
tags:
|
||||
type: array
|
||||
xml:
|
||||
name: tag
|
||||
wrapped: true
|
||||
items:
|
||||
$ref: '#/components/schemas/Tag'
|
||||
status:
|
||||
type: string
|
||||
description: pet status in the store
|
||||
deprecated: true
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
xml:
|
||||
name: Pet
|
||||
ApiResponse:
|
||||
title: An uploaded response
|
||||
description: Describes the result of uploading an image resource
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
type:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
@ -5,6 +5,7 @@ build.sh
|
||||
src/Org.OpenAPITools/.gitignore
|
||||
src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs
|
||||
src/Org.OpenAPITools/Authentication/ApiAuthentication.cs
|
||||
src/Org.OpenAPITools/Controllers/FakeApi.cs
|
||||
src/Org.OpenAPITools/Controllers/PetApi.cs
|
||||
src/Org.OpenAPITools/Controllers/StoreApi.cs
|
||||
src/Org.OpenAPITools/Controllers/UserApi.cs
|
||||
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Newtonsoft.Json;
|
||||
using Org.OpenAPITools.Attributes;
|
||||
using Org.OpenAPITools.Models;
|
||||
|
||||
namespace Org.OpenAPITools.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class FakeApiController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// fake endpoint to test parameter example (object)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/fake/parameter_example_test")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FakeParameterExampleTest")]
|
||||
public virtual IActionResult FakeParameterExampleTest([FromQuery (Name = "data")][Required()]Pet data)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(0);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -31,20 +31,31 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Add a new pet to the store
|
||||
/// </summary>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <param name="pet">Pet object that needs to be added to the store</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="405">Invalid input</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/pet")]
|
||||
[Consumes("application/json", "application/xml")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("AddPet")]
|
||||
public virtual IActionResult AddPet([FromBody]Pet body)
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
||||
public virtual IActionResult AddPet([FromBody]Pet pet)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(200, default(Pet));
|
||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(405);
|
||||
|
||||
throw new NotImplementedException();
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -70,7 +81,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// Finds Pets by status
|
||||
/// </summary>
|
||||
/// <remarks>Multiple status values can be provided with comma separated strings</remarks>
|
||||
/// <param name="status">Status values that need to be considered for filter</param>
|
||||
/// <param name="status">Status values that need to be considered for filter (deprecated)</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid status value</response>
|
||||
[HttpGet]
|
||||
@ -164,7 +175,8 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Update an existing pet
|
||||
/// </summary>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <param name="pet">Pet object that needs to be added to the store</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Pet not found</response>
|
||||
/// <response code="405">Validation exception</response>
|
||||
@ -173,17 +185,27 @@ namespace Org.OpenAPITools.Controllers
|
||||
[Consumes("application/json", "application/xml")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UpdatePet")]
|
||||
public virtual IActionResult UpdatePet([FromBody]Pet body)
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
||||
public virtual IActionResult UpdatePet([FromBody]Pet pet)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(200, default(Pet));
|
||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(400);
|
||||
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(404);
|
||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(405);
|
||||
|
||||
throw new NotImplementedException();
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -111,15 +111,16 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Place an order for a pet
|
||||
/// </summary>
|
||||
/// <param name="body">order placed for purchasing the pet</param>
|
||||
/// <param name="order">order placed for purchasing the pet</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid Order</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/store/order")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("PlaceOrder")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")]
|
||||
public virtual IActionResult PlaceOrder([FromBody]Order body)
|
||||
public virtual IActionResult PlaceOrder([FromBody]Order order)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
|
@ -32,13 +32,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// Create user
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <param name="body">Created user object</param>
|
||||
/// <param name="user">Created user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUser")]
|
||||
public virtual IActionResult CreateUser([FromBody]User body)
|
||||
public virtual IActionResult CreateUser([FromBody]User user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -50,13 +52,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
/// </summary>
|
||||
/// <param name="body">List of user object</param>
|
||||
/// <param name="user">List of user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user/createWithArray")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUsersWithArrayInput")]
|
||||
public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> body)
|
||||
public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -68,13 +72,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
/// </summary>
|
||||
/// <param name="body">List of user object</param>
|
||||
/// <param name="user">List of user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user/createWithList")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUsersWithListInput")]
|
||||
public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> body)
|
||||
public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -92,6 +98,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpDelete]
|
||||
[Route("/v2/user/{username}")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("DeleteUser")]
|
||||
public virtual IActionResult DeleteUser([FromRoute (Name = "username")][Required]string username)
|
||||
@ -149,7 +156,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("LoginUser")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")]
|
||||
public virtual IActionResult LoginUser([FromQuery (Name = "username")][Required()]string username, [FromQuery (Name = "password")][Required()]string password)
|
||||
public virtual IActionResult LoginUser([FromQuery (Name = "username")][Required()][RegularExpression("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")]string username, [FromQuery (Name = "password")][Required()]string password)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -171,6 +178,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/user/logout")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("LogoutUser")]
|
||||
public virtual IActionResult LogoutUser()
|
||||
@ -187,14 +195,16 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <param name="username">name that need to be deleted</param>
|
||||
/// <param name="body">Updated user object</param>
|
||||
/// <param name="user">Updated user object</param>
|
||||
/// <response code="400">Invalid user supplied</response>
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpPut]
|
||||
[Route("/v2/user/{username}")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UpdateUser")]
|
||||
public virtual IActionResult UpdateUser([FromRoute (Name = "username")][Required]string username, [FromBody]User body)
|
||||
public virtual IActionResult UpdateUser([FromRoute (Name = "username")][Required]string username, [FromBody]User user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
|
@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[RegularExpression("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")]
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"openapi" : "3.0.1",
|
||||
"openapi" : "3.0.0",
|
||||
"info" : {
|
||||
"description" : "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.",
|
||||
"license" : {
|
||||
@ -9,6 +9,10 @@
|
||||
"title" : "OpenAPI Petstore",
|
||||
"version" : "1.0.0"
|
||||
},
|
||||
"externalDocs" : {
|
||||
"description" : "Find out more about Swagger",
|
||||
"url" : "http://swagger.io"
|
||||
},
|
||||
"servers" : [ {
|
||||
"url" : "http://petstore.swagger.io/v2"
|
||||
} ],
|
||||
@ -25,26 +29,28 @@
|
||||
"paths" : {
|
||||
"/pet" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "addPet",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/Pet"
|
||||
},
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"content" : {
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid input"
|
||||
}
|
||||
},
|
||||
@ -52,38 +58,37 @@
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Add a new pet to the store",
|
||||
"tags" : [ "pet" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "pet" ]
|
||||
},
|
||||
"put" : {
|
||||
"description" : "",
|
||||
"operationId" : "updatePet",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/Pet"
|
||||
},
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"content" : {
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Pet not found"
|
||||
},
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Validation exception"
|
||||
}
|
||||
},
|
||||
@ -91,8 +96,7 @@
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Update an existing pet",
|
||||
"tags" : [ "pet" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "pet" ]
|
||||
}
|
||||
},
|
||||
"/pet/findByStatus" : {
|
||||
@ -100,6 +104,7 @@
|
||||
"description" : "Multiple status values can be provided with comma separated strings",
|
||||
"operationId" : "findPetsByStatus",
|
||||
"parameters" : [ {
|
||||
"deprecated" : true,
|
||||
"description" : "Status values that need to be considered for filter",
|
||||
"explode" : false,
|
||||
"in" : "query",
|
||||
@ -138,12 +143,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid status value"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
"petstore_auth" : [ "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Finds Pets by status",
|
||||
"tags" : [ "pet" ]
|
||||
@ -191,12 +195,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid tag value"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
"petstore_auth" : [ "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Finds Pets by tags",
|
||||
"tags" : [ "pet" ]
|
||||
@ -204,26 +207,31 @@
|
||||
},
|
||||
"/pet/{petId}" : {
|
||||
"delete" : {
|
||||
"description" : "",
|
||||
"operationId" : "deletePet",
|
||||
"parameters" : [ {
|
||||
"explode" : false,
|
||||
"in" : "header",
|
||||
"name" : "api_key",
|
||||
"required" : false,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
}, {
|
||||
"description" : "Pet id to delete",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid pet value"
|
||||
}
|
||||
},
|
||||
@ -238,13 +246,15 @@
|
||||
"operationId" : "getPetById",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet to return",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@ -263,11 +273,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Pet not found"
|
||||
}
|
||||
},
|
||||
@ -278,16 +286,19 @@
|
||||
"tags" : [ "pet" ]
|
||||
},
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "updatePetWithForm",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet that needs to be updated",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
@ -300,7 +311,6 @@
|
||||
},
|
||||
"responses" : {
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid input"
|
||||
}
|
||||
},
|
||||
@ -313,16 +323,19 @@
|
||||
},
|
||||
"/pet/{petId}/uploadImage" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "uploadFile",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet to update",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
@ -381,10 +394,11 @@
|
||||
},
|
||||
"/store/order" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "placeOrder",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Order"
|
||||
}
|
||||
@ -410,13 +424,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid Order"
|
||||
}
|
||||
},
|
||||
"summary" : "Place an order for a pet",
|
||||
"tags" : [ "store" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "store" ]
|
||||
}
|
||||
},
|
||||
"/store/order/{orderId}" : {
|
||||
@ -425,20 +437,20 @@
|
||||
"operationId" : "deleteOrder",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of the order that needs to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "orderId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Order not found"
|
||||
}
|
||||
},
|
||||
@ -450,6 +462,7 @@
|
||||
"operationId" : "getOrderById",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet that needs to be fetched",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "orderId",
|
||||
"required" : true,
|
||||
@ -458,7 +471,8 @@
|
||||
"maximum" : 5,
|
||||
"minimum" : 1,
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@ -477,11 +491,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Order not found"
|
||||
}
|
||||
},
|
||||
@ -495,7 +507,7 @@
|
||||
"operationId" : "createUser",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
}
|
||||
@ -506,90 +518,79 @@
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Create user",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/createWithArray" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "createUsersWithArrayInput",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/UserArray"
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Creates list of users with given input array",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/createWithList" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "createUsersWithListInput",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/UserArray"
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Creates list of users with given input array",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/login" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "loginUser",
|
||||
"parameters" : [ {
|
||||
"description" : "The user name for login",
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"pattern" : "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "form"
|
||||
}, {
|
||||
"description" : "The password for login in clear text",
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "password",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@ -607,24 +608,36 @@
|
||||
},
|
||||
"description" : "successful operation",
|
||||
"headers" : {
|
||||
"Set-Cookie" : {
|
||||
"description" : "Cookie authentication key for use with the `api_key` apiKey authentication.",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"example" : "AUTH_KEY=abcde12345; Path=/; HttpOnly",
|
||||
"type" : "string"
|
||||
},
|
||||
"style" : "simple"
|
||||
},
|
||||
"X-Rate-Limit" : {
|
||||
"description" : "calls per hour allowed by the user",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"format" : "int32",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
},
|
||||
"X-Expires-After" : {
|
||||
"description" : "date in UTC when token expires",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"format" : "date-time",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username/password supplied"
|
||||
}
|
||||
},
|
||||
@ -634,13 +647,16 @@
|
||||
},
|
||||
"/user/logout" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "logoutUser",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Logs out current logged in user session",
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
@ -651,36 +667,42 @@
|
||||
"operationId" : "deleteUser",
|
||||
"parameters" : [ {
|
||||
"description" : "The name that needs to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Delete user",
|
||||
"tags" : [ "user" ]
|
||||
},
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "getUserByName",
|
||||
"parameters" : [ {
|
||||
"description" : "The name that needs to be fetched. Use user1 for testing.",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@ -699,11 +721,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
@ -715,16 +735,18 @@
|
||||
"operationId" : "updateUser",
|
||||
"parameters" : [ {
|
||||
"description" : "name that need to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
}
|
||||
@ -735,21 +757,76 @@
|
||||
},
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid user supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Updated user",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/fake/parameter_example_test" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "fake_parameter_example_test",
|
||||
"parameters" : [ {
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "data",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"summary" : "fake endpoint to test parameter example (object)",
|
||||
"tags" : [ "fake" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
"components" : {
|
||||
"requestBodies" : {
|
||||
"UserArray" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
},
|
||||
"Pet" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
}
|
||||
},
|
||||
"schemas" : {
|
||||
"Order" : {
|
||||
"description" : "An order for a pets from the pet store",
|
||||
@ -806,6 +883,7 @@
|
||||
"type" : "integer"
|
||||
},
|
||||
"name" : {
|
||||
"pattern" : "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
@ -935,6 +1013,7 @@
|
||||
}
|
||||
},
|
||||
"status" : {
|
||||
"deprecated" : true,
|
||||
"description" : "pet status in the store",
|
||||
"enum" : [ "available", "pending", "sold" ],
|
||||
"type" : "string"
|
||||
@ -979,7 +1058,8 @@
|
||||
"description" : "Updated status of the pet",
|
||||
"type" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type" : "object"
|
||||
},
|
||||
"uploadFile_request" : {
|
||||
"properties" : {
|
||||
@ -992,7 +1072,8 @@
|
||||
"format" : "binary",
|
||||
"type" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type" : "object"
|
||||
}
|
||||
},
|
||||
"securitySchemes" : {
|
||||
@ -1014,6 +1095,5 @@
|
||||
"type" : "apiKey"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-original-swagger-version" : "2.0"
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ build.sh
|
||||
src/Org.OpenAPITools/.gitignore
|
||||
src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs
|
||||
src/Org.OpenAPITools/Authentication/ApiAuthentication.cs
|
||||
src/Org.OpenAPITools/Controllers/FakeApi.cs
|
||||
src/Org.OpenAPITools/Controllers/PetApi.cs
|
||||
src/Org.OpenAPITools/Controllers/StoreApi.cs
|
||||
src/Org.OpenAPITools/Controllers/UserApi.cs
|
||||
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Newtonsoft.Json;
|
||||
using Org.OpenAPITools.Attributes;
|
||||
using Org.OpenAPITools.Models;
|
||||
|
||||
namespace Org.OpenAPITools.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class FakeApiController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// fake endpoint to test parameter example (object)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/fake/parameter_example_test")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FakeParameterExampleTest")]
|
||||
public virtual IActionResult FakeParameterExampleTest([FromQuery (Name = "data")][Required()]Pet data)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(0);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -31,20 +31,31 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Add a new pet to the store
|
||||
/// </summary>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <param name="pet">Pet object that needs to be added to the store</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="405">Invalid input</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/pet")]
|
||||
[Consumes("application/json", "application/xml")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("AddPet")]
|
||||
public virtual IActionResult AddPet([FromBody]Pet body)
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
||||
public virtual IActionResult AddPet([FromBody]Pet pet)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(200, default(Pet));
|
||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(405);
|
||||
|
||||
throw new NotImplementedException();
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -70,7 +81,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// Finds Pets by status
|
||||
/// </summary>
|
||||
/// <remarks>Multiple status values can be provided with comma separated strings</remarks>
|
||||
/// <param name="status">Status values that need to be considered for filter</param>
|
||||
/// <param name="status">Status values that need to be considered for filter (deprecated)</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid status value</response>
|
||||
[HttpGet]
|
||||
@ -164,7 +175,8 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Update an existing pet
|
||||
/// </summary>
|
||||
/// <param name="body">Pet object that needs to be added to the store</param>
|
||||
/// <param name="pet">Pet object that needs to be added to the store</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid ID supplied</response>
|
||||
/// <response code="404">Pet not found</response>
|
||||
/// <response code="405">Validation exception</response>
|
||||
@ -173,17 +185,27 @@ namespace Org.OpenAPITools.Controllers
|
||||
[Consumes("application/json", "application/xml")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UpdatePet")]
|
||||
public virtual IActionResult UpdatePet([FromBody]Pet body)
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
|
||||
public virtual IActionResult UpdatePet([FromBody]Pet pet)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(200, default(Pet));
|
||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(400);
|
||||
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(404);
|
||||
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(405);
|
||||
|
||||
throw new NotImplementedException();
|
||||
string exampleJson = null;
|
||||
exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}";
|
||||
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
|
||||
|
||||
var example = exampleJson != null
|
||||
? JsonConvert.DeserializeObject<Pet>(exampleJson)
|
||||
: default(Pet);
|
||||
//TODO: Change the data returned
|
||||
return new ObjectResult(example);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -111,15 +111,16 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Place an order for a pet
|
||||
/// </summary>
|
||||
/// <param name="body">order placed for purchasing the pet</param>
|
||||
/// <param name="order">order placed for purchasing the pet</param>
|
||||
/// <response code="200">successful operation</response>
|
||||
/// <response code="400">Invalid Order</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/store/order")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("PlaceOrder")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")]
|
||||
public virtual IActionResult PlaceOrder([FromBody]Order body)
|
||||
public virtual IActionResult PlaceOrder([FromBody]Order order)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
|
@ -32,13 +32,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// Create user
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <param name="body">Created user object</param>
|
||||
/// <param name="user">Created user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUser")]
|
||||
public virtual IActionResult CreateUser([FromBody]User body)
|
||||
public virtual IActionResult CreateUser([FromBody]User user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -50,13 +52,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
/// </summary>
|
||||
/// <param name="body">List of user object</param>
|
||||
/// <param name="user">List of user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user/createWithArray")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUsersWithArrayInput")]
|
||||
public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> body)
|
||||
public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -68,13 +72,15 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <summary>
|
||||
/// Creates list of users with given input array
|
||||
/// </summary>
|
||||
/// <param name="body">List of user object</param>
|
||||
/// <param name="user">List of user object</param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpPost]
|
||||
[Route("/v2/user/createWithList")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("CreateUsersWithListInput")]
|
||||
public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> body)
|
||||
public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -92,6 +98,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpDelete]
|
||||
[Route("/v2/user/{username}")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("DeleteUser")]
|
||||
public virtual IActionResult DeleteUser([FromRoute (Name = "username")][Required]string username)
|
||||
@ -149,7 +156,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("LoginUser")]
|
||||
[SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")]
|
||||
public virtual IActionResult LoginUser([FromQuery (Name = "username")][Required()]string username, [FromQuery (Name = "password")][Required()]string password)
|
||||
public virtual IActionResult LoginUser([FromQuery (Name = "username")][Required()][RegularExpression("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")]string username, [FromQuery (Name = "password")][Required()]string password)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
@ -171,6 +178,7 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/user/logout")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("LogoutUser")]
|
||||
public virtual IActionResult LogoutUser()
|
||||
@ -187,14 +195,16 @@ namespace Org.OpenAPITools.Controllers
|
||||
/// </summary>
|
||||
/// <remarks>This can only be done by the logged in user.</remarks>
|
||||
/// <param name="username">name that need to be deleted</param>
|
||||
/// <param name="body">Updated user object</param>
|
||||
/// <param name="user">Updated user object</param>
|
||||
/// <response code="400">Invalid user supplied</response>
|
||||
/// <response code="404">User not found</response>
|
||||
[HttpPut]
|
||||
[Route("/v2/user/{username}")]
|
||||
[Authorize(Policy = "api_key")]
|
||||
[Consumes("application/json")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("UpdateUser")]
|
||||
public virtual IActionResult UpdateUser([FromRoute (Name = "username")][Required]string username, [FromBody]User body)
|
||||
public virtual IActionResult UpdateUser([FromRoute (Name = "username")][Required]string username, [FromBody]User user)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
|
@ -35,6 +35,7 @@ namespace Org.OpenAPITools.Models
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[RegularExpression("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")]
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"openapi" : "3.0.1",
|
||||
"openapi" : "3.0.0",
|
||||
"info" : {
|
||||
"description" : "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.",
|
||||
"license" : {
|
||||
@ -9,6 +9,10 @@
|
||||
"title" : "OpenAPI Petstore",
|
||||
"version" : "1.0.0"
|
||||
},
|
||||
"externalDocs" : {
|
||||
"description" : "Find out more about Swagger",
|
||||
"url" : "http://swagger.io"
|
||||
},
|
||||
"servers" : [ {
|
||||
"url" : "http://petstore.swagger.io/v2"
|
||||
} ],
|
||||
@ -25,26 +29,28 @@
|
||||
"paths" : {
|
||||
"/pet" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "addPet",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/Pet"
|
||||
},
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"content" : {
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid input"
|
||||
}
|
||||
},
|
||||
@ -52,38 +58,37 @@
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Add a new pet to the store",
|
||||
"tags" : [ "pet" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "pet" ]
|
||||
},
|
||||
"put" : {
|
||||
"description" : "",
|
||||
"operationId" : "updatePet",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/Pet"
|
||||
},
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"content" : {
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Pet not found"
|
||||
},
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Validation exception"
|
||||
}
|
||||
},
|
||||
@ -91,8 +96,7 @@
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Update an existing pet",
|
||||
"tags" : [ "pet" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "pet" ]
|
||||
}
|
||||
},
|
||||
"/pet/findByStatus" : {
|
||||
@ -100,6 +104,7 @@
|
||||
"description" : "Multiple status values can be provided with comma separated strings",
|
||||
"operationId" : "findPetsByStatus",
|
||||
"parameters" : [ {
|
||||
"deprecated" : true,
|
||||
"description" : "Status values that need to be considered for filter",
|
||||
"explode" : false,
|
||||
"in" : "query",
|
||||
@ -138,12 +143,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid status value"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
"petstore_auth" : [ "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Finds Pets by status",
|
||||
"tags" : [ "pet" ]
|
||||
@ -191,12 +195,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid tag value"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
"petstore_auth" : [ "read:pets" ]
|
||||
} ],
|
||||
"summary" : "Finds Pets by tags",
|
||||
"tags" : [ "pet" ]
|
||||
@ -204,26 +207,31 @@
|
||||
},
|
||||
"/pet/{petId}" : {
|
||||
"delete" : {
|
||||
"description" : "",
|
||||
"operationId" : "deletePet",
|
||||
"parameters" : [ {
|
||||
"explode" : false,
|
||||
"in" : "header",
|
||||
"name" : "api_key",
|
||||
"required" : false,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
}, {
|
||||
"description" : "Pet id to delete",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid pet value"
|
||||
}
|
||||
},
|
||||
@ -238,13 +246,15 @@
|
||||
"operationId" : "getPetById",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet to return",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@ -263,11 +273,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Pet not found"
|
||||
}
|
||||
},
|
||||
@ -278,16 +286,19 @@
|
||||
"tags" : [ "pet" ]
|
||||
},
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "updatePetWithForm",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet that needs to be updated",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
@ -300,7 +311,6 @@
|
||||
},
|
||||
"responses" : {
|
||||
"405" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid input"
|
||||
}
|
||||
},
|
||||
@ -313,16 +323,19 @@
|
||||
},
|
||||
"/pet/{petId}/uploadImage" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "uploadFile",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet to update",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "petId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"format" : "int64",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
@ -381,10 +394,11 @@
|
||||
},
|
||||
"/store/order" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "placeOrder",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Order"
|
||||
}
|
||||
@ -410,13 +424,11 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid Order"
|
||||
}
|
||||
},
|
||||
"summary" : "Place an order for a pet",
|
||||
"tags" : [ "store" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "store" ]
|
||||
}
|
||||
},
|
||||
"/store/order/{orderId}" : {
|
||||
@ -425,20 +437,20 @@
|
||||
"operationId" : "deleteOrder",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of the order that needs to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "orderId",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Order not found"
|
||||
}
|
||||
},
|
||||
@ -450,6 +462,7 @@
|
||||
"operationId" : "getOrderById",
|
||||
"parameters" : [ {
|
||||
"description" : "ID of pet that needs to be fetched",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "orderId",
|
||||
"required" : true,
|
||||
@ -458,7 +471,8 @@
|
||||
"maximum" : 5,
|
||||
"minimum" : 1,
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@ -477,11 +491,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid ID supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "Order not found"
|
||||
}
|
||||
},
|
||||
@ -495,7 +507,7 @@
|
||||
"operationId" : "createUser",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
}
|
||||
@ -506,90 +518,79 @@
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Create user",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/createWithArray" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "createUsersWithArrayInput",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/UserArray"
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Creates list of users with given input array",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/createWithList" : {
|
||||
"post" : {
|
||||
"description" : "",
|
||||
"operationId" : "createUsersWithListInput",
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
"$ref" : "#/components/requestBodies/UserArray"
|
||||
},
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Creates list of users with given input array",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/user/login" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "loginUser",
|
||||
"parameters" : [ {
|
||||
"description" : "The user name for login",
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"pattern" : "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "form"
|
||||
}, {
|
||||
"description" : "The password for login in clear text",
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "password",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@ -607,24 +608,36 @@
|
||||
},
|
||||
"description" : "successful operation",
|
||||
"headers" : {
|
||||
"Set-Cookie" : {
|
||||
"description" : "Cookie authentication key for use with the `api_key` apiKey authentication.",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"example" : "AUTH_KEY=abcde12345; Path=/; HttpOnly",
|
||||
"type" : "string"
|
||||
},
|
||||
"style" : "simple"
|
||||
},
|
||||
"X-Rate-Limit" : {
|
||||
"description" : "calls per hour allowed by the user",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"format" : "int32",
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
},
|
||||
"X-Expires-After" : {
|
||||
"description" : "date in UTC when token expires",
|
||||
"explode" : false,
|
||||
"schema" : {
|
||||
"format" : "date-time",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username/password supplied"
|
||||
}
|
||||
},
|
||||
@ -634,13 +647,16 @@
|
||||
},
|
||||
"/user/logout" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "logoutUser",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"content" : { },
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Logs out current logged in user session",
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
@ -651,36 +667,42 @@
|
||||
"operationId" : "deleteUser",
|
||||
"parameters" : [ {
|
||||
"description" : "The name that needs to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Delete user",
|
||||
"tags" : [ "user" ]
|
||||
},
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "getUserByName",
|
||||
"parameters" : [ {
|
||||
"description" : "The name that needs to be fetched. Use user1 for testing.",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
@ -699,11 +721,9 @@
|
||||
"description" : "successful operation"
|
||||
},
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid username supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
@ -715,16 +735,18 @@
|
||||
"operationId" : "updateUser",
|
||||
"parameters" : [ {
|
||||
"description" : "name that need to be deleted",
|
||||
"explode" : false,
|
||||
"in" : "path",
|
||||
"name" : "username",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
"style" : "simple"
|
||||
} ],
|
||||
"requestBody" : {
|
||||
"content" : {
|
||||
"*/*" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
}
|
||||
@ -735,21 +757,76 @@
|
||||
},
|
||||
"responses" : {
|
||||
"400" : {
|
||||
"content" : { },
|
||||
"description" : "Invalid user supplied"
|
||||
},
|
||||
"404" : {
|
||||
"content" : { },
|
||||
"description" : "User not found"
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"api_key" : [ ]
|
||||
} ],
|
||||
"summary" : "Updated user",
|
||||
"tags" : [ "user" ],
|
||||
"x-codegen-request-body-name" : "body"
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/fake/parameter_example_test" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "fake_parameter_example_test",
|
||||
"parameters" : [ {
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "data",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"summary" : "fake endpoint to test parameter example (object)",
|
||||
"tags" : [ "fake" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
"components" : {
|
||||
"requestBodies" : {
|
||||
"UserArray" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"items" : {
|
||||
"$ref" : "#/components/schemas/User"
|
||||
},
|
||||
"type" : "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "List of user object",
|
||||
"required" : true
|
||||
},
|
||||
"Pet" : {
|
||||
"content" : {
|
||||
"application/json" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
},
|
||||
"application/xml" : {
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description" : "Pet object that needs to be added to the store",
|
||||
"required" : true
|
||||
}
|
||||
},
|
||||
"schemas" : {
|
||||
"Order" : {
|
||||
"description" : "An order for a pets from the pet store",
|
||||
@ -806,6 +883,7 @@
|
||||
"type" : "integer"
|
||||
},
|
||||
"name" : {
|
||||
"pattern" : "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$",
|
||||
"type" : "string"
|
||||
}
|
||||
},
|
||||
@ -935,6 +1013,7 @@
|
||||
}
|
||||
},
|
||||
"status" : {
|
||||
"deprecated" : true,
|
||||
"description" : "pet status in the store",
|
||||
"enum" : [ "available", "pending", "sold" ],
|
||||
"type" : "string"
|
||||
@ -979,7 +1058,8 @@
|
||||
"description" : "Updated status of the pet",
|
||||
"type" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type" : "object"
|
||||
},
|
||||
"uploadFile_request" : {
|
||||
"properties" : {
|
||||
@ -992,7 +1072,8 @@
|
||||
"format" : "binary",
|
||||
"type" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type" : "object"
|
||||
}
|
||||
},
|
||||
"securitySchemes" : {
|
||||
@ -1014,6 +1095,5 @@
|
||||
"type" : "apiKey"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-original-swagger-version" : "2.0"
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ build.sh
|
||||
src/Org.OpenAPITools/.gitignore
|
||||
src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs
|
||||
src/Org.OpenAPITools/Authentication/ApiAuthentication.cs
|
||||
src/Org.OpenAPITools/Controllers/FakeApi.cs
|
||||
src/Org.OpenAPITools/Controllers/PetApi.cs
|
||||
src/Org.OpenAPITools/Controllers/StoreApi.cs
|
||||
src/Org.OpenAPITools/Controllers/UserApi.cs
|
||||
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Newtonsoft.Json;
|
||||
using Org.OpenAPITools.Attributes;
|
||||
using Org.OpenAPITools.Models;
|
||||
|
||||
namespace Org.OpenAPITools.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class FakeApiController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// fake endpoint to test parameter example (object)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/fake/parameter_example_test")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FakeParameterExampleTest")]
|
||||
public virtual IActionResult FakeParameterExampleTest([FromQuery (Name = "data")][Required()]Pet data)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(0);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -769,6 +769,29 @@
|
||||
"summary" : "Updated user",
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/fake/parameter_example_test" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "fake_parameter_example_test",
|
||||
"parameters" : [ {
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "data",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"summary" : "fake endpoint to test parameter example (object)",
|
||||
"tags" : [ "fake" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
"components" : {
|
||||
|
@ -5,6 +5,7 @@ build.sh
|
||||
src/Org.OpenAPITools/.gitignore
|
||||
src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs
|
||||
src/Org.OpenAPITools/Authentication/ApiAuthentication.cs
|
||||
src/Org.OpenAPITools/Controllers/FakeApi.cs
|
||||
src/Org.OpenAPITools/Controllers/PetApi.cs
|
||||
src/Org.OpenAPITools/Controllers/StoreApi.cs
|
||||
src/Org.OpenAPITools/Controllers/UserApi.cs
|
||||
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using Newtonsoft.Json;
|
||||
using Org.OpenAPITools.Attributes;
|
||||
using Org.OpenAPITools.Models;
|
||||
|
||||
namespace Org.OpenAPITools.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class FakeApiController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// fake endpoint to test parameter example (object)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <response code="0">successful operation</response>
|
||||
[HttpGet]
|
||||
[Route("/v2/fake/parameter_example_test")]
|
||||
[ValidateModelState]
|
||||
[SwaggerOperation("FakeParameterExampleTest")]
|
||||
public virtual IActionResult FakeParameterExampleTest([FromQuery (Name = "data")][Required()]Pet data)
|
||||
{
|
||||
|
||||
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
|
||||
// return StatusCode(0);
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -769,6 +769,29 @@
|
||||
"summary" : "Updated user",
|
||||
"tags" : [ "user" ]
|
||||
}
|
||||
},
|
||||
"/fake/parameter_example_test" : {
|
||||
"get" : {
|
||||
"description" : "",
|
||||
"operationId" : "fake_parameter_example_test",
|
||||
"parameters" : [ {
|
||||
"explode" : true,
|
||||
"in" : "query",
|
||||
"name" : "data",
|
||||
"required" : true,
|
||||
"schema" : {
|
||||
"$ref" : "#/components/schemas/Pet"
|
||||
},
|
||||
"style" : "form"
|
||||
} ],
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"description" : "successful operation"
|
||||
}
|
||||
},
|
||||
"summary" : "fake endpoint to test parameter example (object)",
|
||||
"tags" : [ "fake" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
"components" : {
|
||||
|
Loading…
x
Reference in New Issue
Block a user