[kotlin-spring] Fix cookie parameter code generation in API (#17959)

* + Cookie parameter generation fixed

* Added cookie parameter mustache template for generating cookie related code
* Adapted kotlin-spring api templates to include cookie parameters
* Added tests for evaluating cookie parameter code generation
* Added configuration sample for the new cookie use case

* - Unused fake cases removed

* Removed fake cases from openapi spec that were not related to cookie usage
* Cleaned sample files
This commit is contained in:
Oscar Reyes 2024-03-09 01:34:12 -05:00 committed by GitHub
parent 2653777ece
commit 7d9f9d7e81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 2435 additions and 2 deletions

View File

@ -0,0 +1,9 @@
generatorName: kotlin-spring
outputDir: samples/server/petstore/kotlin-springboot-request-cookie
library: spring-boot
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-fake-endpoints-for-testing-with-cookie.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
additionalProperties:
appendRequestToHandler: true
interfaceOnly: true
useSpringBoot3: true

View File

@ -90,7 +90,7 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v
produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}}, produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}},
consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]{{/hasConsumes}}{{/singleContentTypes}} consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]{{/hasConsumes}}{{/singleContentTypes}}
) )
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{>requesObject}}{{^-last}},{{/-last}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> { {{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{>requesObject}}{{^-last}},{{/-last}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> {
return {{>returnValue}} return {{>returnValue}}
} }
{{/operation}} {{/operation}}

View File

@ -102,7 +102,7 @@ interface {{classname}} {
produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}}, produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}},
consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]{{/hasConsumes}}{{/singleContentTypes}} consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]{{/hasConsumes}}{{/singleContentTypes}}
) )
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{>requesObject}}{{^-last}},{{/-last}}{{/allParams}}): ResponseEntity<{{>returnTypes}}>{{^skipDefaultInterface}} { {{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>cookieParams}}{{>bodyParams}}{{>formParams}}{{>requesObject}}{{^-last}},{{/-last}}{{/allParams}}): ResponseEntity<{{>returnTypes}}>{{^skipDefaultInterface}} {
{{^isDelegate}} {{^isDelegate}}
return {{>returnValue}} return {{>returnValue}}
{{/isDelegate}} {{/isDelegate}}

View File

@ -0,0 +1 @@
{{#isCookieParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@CookieValue(name = "{{baseName}}"{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}) {{paramName}}: {{>optionalDataType}}{{/isCookieParam}}

View File

@ -435,6 +435,48 @@ public class KotlinSpringServerCodegenTest {
); );
} }
@Test(description = "test cookie parameter generation on interface apis")
public void cookieParameterGenerationApis() throws Exception {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');
KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen();
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(KotlinSpringServerCodegen.INTERFACE_ONLY, true);
codegen.additionalProperties().put(KotlinSpringServerCodegen.SKIP_DEFAULT_INTERFACE, true);
new DefaultGenerator().opts(new ClientOptInput()
.openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/petstore-with-fake-endpoints-for-testing-with-cookie.yaml"))
.config(codegen))
.generate();
assertFileContains(
Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/FakeApi.kt"),
"@CookieValue"
);
}
@Test(description = "test cookie parameter generation on controllers")
public void cookieParameterGenerationControllers() throws Exception {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');
KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen();
codegen.setOutputDir(output.getAbsolutePath());
new DefaultGenerator().opts(new ClientOptInput()
.openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/petstore-with-fake-endpoints-for-testing-with-cookie.yaml"))
.config(codegen))
.generate();
assertFileContains(
Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/FakeApiController.kt"),
"@CookieValue"
);
}
@Test(description = "use Spring boot 3 & jakarta extension") @Test(description = "use Spring boot 3 & jakarta extension")
public void useSpringBoot3() throws Exception { public void useSpringBoot3() throws Exception {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); File output = Files.createTempDirectory("test").toFile().getCanonicalFile();

View File

@ -0,0 +1,859 @@
openapi: 3.0.0
info:
description: >-
This spec is mainly for testing Petstore server and contains fake endpoints,
models. Please do not use this for any other purpose. Special characters: "
\
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:
/foo:
get:
responses:
default:
description: response
content:
application/json:
schema:
type: object
properties:
string:
$ref: '#/components/schemas/Foo'
/pet:
servers:
- url: 'http://petstore.swagger.io/v2'
- url: 'http://path-server-test.petstore.local/v2'
- url: 'http://{server}.swagger.io:{port}/v2'
description: test server with variables
variables:
server:
description: target server
enum:
- 'petstore'
- 'qa-petstore'
- 'dev-petstore'
default: 'petstore'
port:
enum:
- 80
- 8080
default: 80
post:
tags:
- pet
summary: Add a new pet to the store
description: ''
operationId: addPet
responses:
'200':
description: Successful operation
'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
x-webclient-blocking: true
responses:
'200':
description: Successful operation
'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
x-webclient-blocking: true
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:
- 'write:pets'
- '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
x-webclient-blocking: true
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:
'200':
description: Successful operation
'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:
'200':
description: Successful operation
'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
x-webclient-blocking: false
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/{order_id}':
get:
tags:
- store
summary: Find purchase order by ID
description: >-
For valid response try integer IDs with value <= 5 or > 10. Other values
will generate exceptions
operationId: getOrderById
parameters:
- name: order_id
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: order_id
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
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
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
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
- name: password
in: query
description: The password for login in clear text
required: true
schema:
type: string
responses:
'200':
description: successful operation
headers:
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
'/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
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
/fake_classname_test:
patch:
tags:
- 'fake_classname_tags 123#$%^'
summary: To test class name in snake case
description: To test class name in snake case
operationId: testClassname
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Client'
security:
- api_key_query: []
requestBody:
$ref: '#/components/requestBodies/Client'
/fake/cookie-suggestion:
get:
tags:
- fake
description: Test list of objects with additional values matching data from cookie
operationId: fakeCookieSuggestion
parameters:
- in: cookie
name: category.history
description: History of categories that user has viewed
required: true
schema:
type: string
responses:
200:
description: List of pets resolved from suggestion
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
servers:
- url: 'http://{server}.swagger.io:{port}/v2'
description: petstore server
variables:
server:
enum:
- 'petstore'
- 'qa-petstore'
- 'dev-petstore'
default: 'petstore'
port:
enum:
- 80
- 8080
default: 80
- url: https://localhost:8080/{version}
description: The local server
variables:
version:
enum:
- 'v1'
- 'v2'
default: 'v2'
- url: https://127.0.0.1/no_varaible
description: The local server without variables
components:
requestBodies:
UserArray:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
description: List of user object
required: true
Client:
content:
application/json:
schema:
$ref: '#/components/schemas/Client'
description: client model
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
api_key_query:
type: apiKey
name: api_key_query
in: query
http_basic_test:
type: http
scheme: basic
bearer_test:
type: http
scheme: bearer
bearerFormat: JWT
http_signature_test:
type: http
scheme: signature
schemas:
Foo:
type: object
properties:
bar:
$ref: '#/components/schemas/Bar'
Bar:
type: string
default: bar
Order:
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:
type: object
required:
- name
properties:
id:
type: integer
format: int64
name:
type: string
default: default-name
xml:
name: Category
User:
type: object
properties:
id:
type: integer
format: int64
x-is-unique: true
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:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: Tag
Pet:
type: object
required:
- name
- photoUrls
properties:
id:
type: integer
format: int64
x-is-unique: true
category:
$ref: '#/components/schemas/Category'
name:
type: string
example: doggie
photoUrls:
type: array
xml:
name: photoUrl
wrapped: true
items:
type: string
uniqueItems: true
tags:
type: array
xml:
name: tag
wrapped: true
items:
$ref: '#/components/schemas/Tag'
status:
type: string
description: pet status in the store
enum:
- available
- pending
- sold
xml:
name: Pet
ApiResponse:
type: object
properties:
code:
type: integer
format: int32
type:
type: string
message:
type: string
Dog:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
breed:
type: string
Cat:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
declawed:
type: boolean
Animal:
type: object
discriminator:
propertyName: className
mapping:
DOG: '#/components/schemas/Dog'
CAT: '#/components/schemas/Cat'
required:
- className
properties:
className:
type: string
color:
type: string
default: red
Client:
type: object
properties:
client:
type: string

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -0,0 +1,26 @@
.openapi-generator-ignore
README.md
build.gradle.kts
pom.xml
settings.gradle
src/main/kotlin/org/openapitools/SpringDocConfiguration.kt
src/main/kotlin/org/openapitools/api/ApiUtil.kt
src/main/kotlin/org/openapitools/api/Exceptions.kt
src/main/kotlin/org/openapitools/api/FakeApi.kt
src/main/kotlin/org/openapitools/api/FakeClassnameTestApi.kt
src/main/kotlin/org/openapitools/api/FooApi.kt
src/main/kotlin/org/openapitools/api/PetApi.kt
src/main/kotlin/org/openapitools/api/StoreApi.kt
src/main/kotlin/org/openapitools/api/UserApi.kt
src/main/kotlin/org/openapitools/model/Animal.kt
src/main/kotlin/org/openapitools/model/Cat.kt
src/main/kotlin/org/openapitools/model/Category.kt
src/main/kotlin/org/openapitools/model/Client.kt
src/main/kotlin/org/openapitools/model/Dog.kt
src/main/kotlin/org/openapitools/model/Foo.kt
src/main/kotlin/org/openapitools/model/FooGetDefaultResponse.kt
src/main/kotlin/org/openapitools/model/ModelApiResponse.kt
src/main/kotlin/org/openapitools/model/Order.kt
src/main/kotlin/org/openapitools/model/Pet.kt
src/main/kotlin/org/openapitools/model/Tag.kt
src/main/kotlin/org/openapitools/model/User.kt

View File

@ -0,0 +1,21 @@
# openAPIPetstore
This Kotlin based [Spring Boot](https://spring.io/projects/spring-boot) application has been generated using the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator).
## Getting Started
This document assumes you have either maven or gradle available, either via the wrapper or otherwise. This does not come with a gradle / maven wrapper checked in.
By default a [`pom.xml`](pom.xml) file will be generated. If you specified `gradleBuildFile=true` when generating this project, a `build.gradle.kts` will also be generated. Note this uses [Gradle Kotlin DSL](https://github.com/gradle/kotlin-dsl).
To build the project using maven, run:
```bash
mvn package && java -jar target/openapi-spring-1.0.0.jar
```
To build the project using gradle, run:
```bash
gradle build && java -jar build/libs/openapi-spring-1.0.0.jar
```
If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/)

View File

@ -0,0 +1,43 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
group = "org.openapitools"
version = "1.0.0"
java.sourceCompatibility = JavaVersion.VERSION_17
repositories {
mavenCentral()
maven { url = uri("https://repo.spring.io/milestone") }
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
plugins {
val kotlinVersion = "1.7.10"
id("org.jetbrains.kotlin.jvm") version kotlinVersion
id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion
id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion
id("org.springframework.boot") version "3.0.2"
id("io.spring.dependency-management") version "1.0.14.RELEASE"
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.0-M5")
implementation("com.google.code.findbugs:jsr305:3.0.2")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("jakarta.validation:jakarta.validation-api")
implementation("jakarta.annotation:jakarta.annotation-api:2.1.0")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(module = "junit")
}
}

View File

@ -0,0 +1,138 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>openapi-spring</artifactId>
<packaging>jar</packaging>
<name>openapi-spring</name>
<version>1.0.0</version>
<properties>
<springdoc-openapi.version>2.2.0</springdoc-openapi.version>
<findbugs-jsr305.version>3.0.2</findbugs-jsr305.version>
<jakarta-annotation.version>2.1.0</jakarta-annotation.version>
<kotlin-test-junit5.version>1.7.10</kotlin-test-junit5.version>
<kotlin.version>1.7.10</kotlin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.3</version>
</parent>
<repositories>
<repository>
<id>repository.spring.milestone</id>
<name>Spring Milestone Repository</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<configuration>
<compilerPlugins>
<plugin>spring</plugin>
</compilerPlugins>
<jvmTarget>17</jvmTarget>
</configuration>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--SpringDoc dependencies -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc-openapi.version}</version>
</dependency>
<!-- @Nullable annotation -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${findbugs-jsr305.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>
<!-- Bean Validation API support -->
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit5</artifactId>
<version>${kotlin-test-junit5.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,15 @@
pluginManagement {
repositories {
maven { url = uri("https://repo.spring.io/snapshot") }
maven { url = uri("https://repo.spring.io/milestone") }
gradlePluginPortal()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == "org.springframework.boot") {
useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}")
}
}
}
}
rootProject.name = "openapi-spring"

View File

@ -0,0 +1,60 @@
package org.openapitools
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import io.swagger.v3.oas.models.OpenAPI
import io.swagger.v3.oas.models.info.Info
import io.swagger.v3.oas.models.info.Contact
import io.swagger.v3.oas.models.info.License
import io.swagger.v3.oas.models.Components
import io.swagger.v3.oas.models.security.SecurityScheme
@Configuration
class SpringDocConfiguration {
@Bean
fun apiInfo(): OpenAPI {
return OpenAPI()
.info(
Info()
.title("OpenAPI Petstore")
.description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\")
.license(
License()
.name("Apache-2.0")
.url("https://www.apache.org/licenses/LICENSE-2.0.html")
)
.version("1.0.0")
)
.components(
Components()
.addSecuritySchemes("petstore_auth", SecurityScheme()
.type(SecurityScheme.Type.OAUTH2)
)
.addSecuritySchemes("api_key", SecurityScheme()
.type(SecurityScheme.Type.APIKEY)
.`in`(SecurityScheme.In.HEADER)
.name("api_key")
)
.addSecuritySchemes("api_key_query", SecurityScheme()
.type(SecurityScheme.Type.APIKEY)
.`in`(SecurityScheme.In.QUERY)
.name("api_key_query")
)
.addSecuritySchemes("http_basic_test", SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("basic")
)
.addSecuritySchemes("bearer_test", SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")
)
.addSecuritySchemes("http_signature_test", SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("signature")
)
)
}
}

View File

@ -0,0 +1,19 @@
package org.openapitools.api
import org.springframework.web.context.request.NativeWebRequest
import jakarta.servlet.http.HttpServletResponse
import java.io.IOException
object ApiUtil {
fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) {
try {
val res = req.getNativeResponse(HttpServletResponse::class.java)
res?.characterEncoding = "UTF-8"
res?.addHeader("Content-Type", contentType)
res?.writer?.print(example)
} catch (e: IOException) {
throw RuntimeException(e)
}
}
}

View File

@ -0,0 +1,29 @@
package org.openapitools.api
import org.springframework.http.HttpStatus
import org.springframework.web.bind.annotation.ControllerAdvice
import org.springframework.web.bind.annotation.ExceptionHandler
import jakarta.servlet.http.HttpServletResponse
import jakarta.validation.ConstraintViolationException
// TODO Extend ApiException for custom exception handling, e.g. the below NotFound exception
sealed class ApiException(msg: String, val code: Int) : Exception(msg)
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
@ControllerAdvice
class DefaultExceptionHandler {
@ExceptionHandler(value = [ApiException::class])
fun onApiException(ex: ApiException, response: HttpServletResponse): Unit =
response.sendError(ex.code, ex.message)
@ExceptionHandler(value = [NotImplementedError::class])
fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit =
response.sendError(HttpStatus.NOT_IMPLEMENTED.value())
@ExceptionHandler(value = [ConstraintViolationException::class])
fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit =
response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message })
}

View File

@ -0,0 +1,58 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api
import org.openapitools.model.Pet
import io.swagger.v3.oas.annotations.*
import io.swagger.v3.oas.annotations.enums.*
import io.swagger.v3.oas.annotations.media.*
import io.swagger.v3.oas.annotations.responses.*
import io.swagger.v3.oas.annotations.security.*
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.http.server.reactive.ServerHttpRequest
import org.springframework.web.bind.annotation.*
import org.springframework.validation.annotation.Validated
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.beans.factory.annotation.Autowired
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import kotlin.collections.List
import kotlin.collections.Map
@Validated
@RequestMapping("\${api.base-path:/v2}")
interface FakeApi {
@Operation(
tags = ["fake",],
summary = "",
operationId = "fakeCookieSuggestion",
description = """Test list of objects with additional values matching data from cookie""",
responses = [
ApiResponse(responseCode = "200", description = "List of pets resolved from suggestion", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))])
]
)
@RequestMapping(
method = [RequestMethod.GET],
value = ["/fake/cookie-suggestion"],
produces = ["application/json"]
)
fun fakeCookieSuggestion(@NotNull @CookieValue(name = "category.history") categoryHistory: kotlin.String,serverHttpRequest: ServerHttpRequest): ResponseEntity<List<Pet>> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
}

View File

@ -0,0 +1,60 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api
import org.openapitools.model.Client
import io.swagger.v3.oas.annotations.*
import io.swagger.v3.oas.annotations.enums.*
import io.swagger.v3.oas.annotations.media.*
import io.swagger.v3.oas.annotations.responses.*
import io.swagger.v3.oas.annotations.security.*
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.http.server.reactive.ServerHttpRequest
import org.springframework.web.bind.annotation.*
import org.springframework.validation.annotation.Validated
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.beans.factory.annotation.Autowired
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import kotlin.collections.List
import kotlin.collections.Map
@Validated
@RequestMapping("\${api.base-path:/v2}")
interface FakeClassnameTestApi {
@Operation(
tags = ["fake_classname_tags 123#$%^",],
summary = "To test class name in snake case",
operationId = "testClassname",
description = """To test class name in snake case""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Client::class))])
],
security = [ SecurityRequirement(name = "api_key_query") ]
)
@RequestMapping(
method = [RequestMethod.PATCH],
value = ["/fake_classname_test"],
produces = ["application/json"],
consumes = ["application/json"]
)
fun testClassname(@Parameter(description = "client model", required = true) @Valid @RequestBody client: Client,serverHttpRequest: ServerHttpRequest): ResponseEntity<Client> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
}

View File

@ -0,0 +1,58 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api
import org.openapitools.model.FooGetDefaultResponse
import io.swagger.v3.oas.annotations.*
import io.swagger.v3.oas.annotations.enums.*
import io.swagger.v3.oas.annotations.media.*
import io.swagger.v3.oas.annotations.responses.*
import io.swagger.v3.oas.annotations.security.*
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.http.server.reactive.ServerHttpRequest
import org.springframework.web.bind.annotation.*
import org.springframework.validation.annotation.Validated
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.beans.factory.annotation.Autowired
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import kotlin.collections.List
import kotlin.collections.Map
@Validated
@RequestMapping("\${api.base-path:/v2}")
interface FooApi {
@Operation(
tags = ["default",],
summary = "",
operationId = "fooGet",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "response", content = [Content(schema = Schema(implementation = FooGetDefaultResponse::class))])
]
)
@RequestMapping(
method = [RequestMethod.GET],
value = ["/foo"],
produces = ["application/json"]
)
fun fooGet(serverHttpRequest: ServerHttpRequest): ResponseEntity<FooGetDefaultResponse> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
}

View File

@ -0,0 +1,203 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api
import org.openapitools.model.ModelApiResponse
import org.openapitools.model.Pet
import io.swagger.v3.oas.annotations.*
import io.swagger.v3.oas.annotations.enums.*
import io.swagger.v3.oas.annotations.media.*
import io.swagger.v3.oas.annotations.responses.*
import io.swagger.v3.oas.annotations.security.*
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.http.server.reactive.ServerHttpRequest
import org.springframework.web.bind.annotation.*
import org.springframework.validation.annotation.Validated
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.beans.factory.annotation.Autowired
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import kotlin.collections.List
import kotlin.collections.Map
@Validated
@RequestMapping("\${api.base-path:/v2}")
interface PetApi {
@Operation(
tags = ["pet",],
summary = "Add a new pet to the store",
operationId = "addPet",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "Successful operation"),
ApiResponse(responseCode = "405", description = "Invalid input")
],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
)
@RequestMapping(
method = [RequestMethod.POST],
value = ["/pet"],
consumes = ["application/json", "application/xml"]
)
fun addPet(@Parameter(description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody pet: Pet,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["pet",],
summary = "Deletes a pet",
operationId = "deletePet",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "Successful operation"),
ApiResponse(responseCode = "400", description = "Invalid pet value")
],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
)
@RequestMapping(
method = [RequestMethod.DELETE],
value = ["/pet/{petId}"]
)
fun deletePet(@Parameter(description = "Pet id to delete", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "", `in` = ParameterIn.HEADER) @RequestHeader(value = "api_key", required = false) apiKey: kotlin.String?,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["pet",],
summary = "Finds Pets by status",
operationId = "findPetsByStatus",
description = """Multiple status values can be provided with comma separated strings""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid status value")
],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
)
@RequestMapping(
method = [RequestMethod.GET],
value = ["/pet/findByStatus"],
produces = ["application/xml", "application/json"]
)
fun findPetsByStatus(@NotNull @Parameter(description = "Status values that need to be considered for filter", required = true, schema = Schema(allowableValues = ["available", "pending", "sold"])) @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List<kotlin.String>,serverHttpRequest: ServerHttpRequest): ResponseEntity<List<Pet>> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["pet",],
summary = "Finds Pets by tags",
operationId = "findPetsByTags",
description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]),
ApiResponse(responseCode = "400", description = "Invalid tag value")
],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ]
)
@RequestMapping(
method = [RequestMethod.GET],
value = ["/pet/findByTags"],
produces = ["application/xml", "application/json"]
)
fun findPetsByTags(@NotNull @Parameter(description = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>,serverHttpRequest: ServerHttpRequest): ResponseEntity<List<Pet>> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["pet",],
summary = "Find pet by ID",
operationId = "getPetById",
description = """Returns a single pet""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]),
ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
ApiResponse(responseCode = "404", description = "Pet not found")
],
security = [ SecurityRequirement(name = "api_key") ]
)
@RequestMapping(
method = [RequestMethod.GET],
value = ["/pet/{petId}"],
produces = ["application/xml", "application/json"]
)
fun getPetById(@Parameter(description = "ID of pet to return", required = true) @PathVariable("petId") petId: kotlin.Long,serverHttpRequest: ServerHttpRequest): ResponseEntity<Pet> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["pet",],
summary = "Update an existing pet",
operationId = "updatePet",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "Successful operation"),
ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
ApiResponse(responseCode = "404", description = "Pet not found"),
ApiResponse(responseCode = "405", description = "Validation exception")
],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
)
@RequestMapping(
method = [RequestMethod.PUT],
value = ["/pet"],
consumes = ["application/json", "application/xml"]
)
fun updatePet(@Parameter(description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody pet: Pet,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["pet",],
summary = "Updates a pet in the store with form data",
operationId = "updatePetWithForm",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "Successful operation"),
ApiResponse(responseCode = "405", description = "Invalid input")
],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
)
@RequestMapping(
method = [RequestMethod.POST],
value = ["/pet/{petId}"],
consumes = ["application/x-www-form-urlencoded"]
)
fun updatePetWithForm(@Parameter(description = "ID of pet that needs to be updated", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Updated name of the pet") @RequestParam(value = "name", required = false) name: kotlin.String? ,@Parameter(description = "Updated status of the pet") @RequestParam(value = "status", required = false) status: kotlin.String? ,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["pet",],
summary = "uploads an image",
operationId = "uploadFile",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = ModelApiResponse::class))])
],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
)
@RequestMapping(
method = [RequestMethod.POST],
value = ["/pet/{petId}/uploadImage"],
produces = ["application/json"],
consumes = ["multipart/form-data"]
)
fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource?,serverHttpRequest: ServerHttpRequest): ResponseEntity<ModelApiResponse> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
}

View File

@ -0,0 +1,117 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api
import org.openapitools.model.Order
import io.swagger.v3.oas.annotations.*
import io.swagger.v3.oas.annotations.enums.*
import io.swagger.v3.oas.annotations.media.*
import io.swagger.v3.oas.annotations.responses.*
import io.swagger.v3.oas.annotations.security.*
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.http.server.reactive.ServerHttpRequest
import org.springframework.web.bind.annotation.*
import org.springframework.validation.annotation.Validated
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.beans.factory.annotation.Autowired
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import kotlin.collections.List
import kotlin.collections.Map
@Validated
@RequestMapping("\${api.base-path:/v2}")
interface StoreApi {
@Operation(
tags = ["store",],
summary = "Delete purchase order by ID",
operationId = "deleteOrder",
description = """For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors""",
responses = [
ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
ApiResponse(responseCode = "404", description = "Order not found")
]
)
@RequestMapping(
method = [RequestMethod.DELETE],
value = ["/store/order/{order_id}"]
)
fun deleteOrder(@Parameter(description = "ID of the order that needs to be deleted", required = true) @PathVariable("order_id") orderId: kotlin.String,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["store",],
summary = "Returns pet inventories by status",
operationId = "getInventory",
description = """Returns a map of status codes to quantities""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = kotlin.collections.Map::class))])
],
security = [ SecurityRequirement(name = "api_key") ]
)
@RequestMapping(
method = [RequestMethod.GET],
value = ["/store/inventory"],
produces = ["application/json"]
)
fun getInventory(serverHttpRequest: ServerHttpRequest): ResponseEntity<Map<String, kotlin.Int>> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["store",],
summary = "Find purchase order by ID",
operationId = "getOrderById",
description = """For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Order::class))]),
ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
ApiResponse(responseCode = "404", description = "Order not found")
]
)
@RequestMapping(
method = [RequestMethod.GET],
value = ["/store/order/{order_id}"],
produces = ["application/xml", "application/json"]
)
fun getOrderById(@Min(1L) @Max(5L) @Parameter(description = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") orderId: kotlin.Long,serverHttpRequest: ServerHttpRequest): ResponseEntity<Order> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["store",],
summary = "Place an order for a pet",
operationId = "placeOrder",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Order::class))]),
ApiResponse(responseCode = "400", description = "Invalid Order")
]
)
@RequestMapping(
method = [RequestMethod.POST],
value = ["/store/order"],
produces = ["application/xml", "application/json"],
consumes = ["application/json"]
)
fun placeOrder(@Parameter(description = "order placed for purchasing the pet", required = true) @Valid @RequestBody order: Order,serverHttpRequest: ServerHttpRequest): ResponseEntity<Order> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
}

View File

@ -0,0 +1,187 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.4.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api
import org.openapitools.model.User
import io.swagger.v3.oas.annotations.*
import io.swagger.v3.oas.annotations.enums.*
import io.swagger.v3.oas.annotations.media.*
import io.swagger.v3.oas.annotations.responses.*
import io.swagger.v3.oas.annotations.security.*
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.http.server.reactive.ServerHttpRequest
import org.springframework.web.bind.annotation.*
import org.springframework.validation.annotation.Validated
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.beans.factory.annotation.Autowired
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import kotlin.collections.List
import kotlin.collections.Map
@Validated
@RequestMapping("\${api.base-path:/v2}")
interface UserApi {
@Operation(
tags = ["user",],
summary = "Create user",
operationId = "createUser",
description = """This can only be done by the logged in user.""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation")
]
)
@RequestMapping(
method = [RequestMethod.POST],
value = ["/user"],
consumes = ["application/json"]
)
fun createUser(@Parameter(description = "Created user object", required = true) @Valid @RequestBody user: User,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["user",],
summary = "Creates list of users with given input array",
operationId = "createUsersWithArrayInput",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation")
]
)
@RequestMapping(
method = [RequestMethod.POST],
value = ["/user/createWithArray"],
consumes = ["application/json"]
)
fun createUsersWithArrayInput(@Parameter(description = "List of user object", required = true) @Valid @RequestBody user: kotlin.collections.List<User>,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["user",],
summary = "Creates list of users with given input array",
operationId = "createUsersWithListInput",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation")
]
)
@RequestMapping(
method = [RequestMethod.POST],
value = ["/user/createWithList"],
consumes = ["application/json"]
)
fun createUsersWithListInput(@Parameter(description = "List of user object", required = true) @Valid @RequestBody user: kotlin.collections.List<User>,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["user",],
summary = "Delete user",
operationId = "deleteUser",
description = """This can only be done by the logged in user.""",
responses = [
ApiResponse(responseCode = "400", description = "Invalid username supplied"),
ApiResponse(responseCode = "404", description = "User not found")
]
)
@RequestMapping(
method = [RequestMethod.DELETE],
value = ["/user/{username}"]
)
fun deleteUser(@Parameter(description = "The name that needs to be deleted", required = true) @PathVariable("username") username: kotlin.String,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["user",],
summary = "Get user by user name",
operationId = "getUserByName",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = User::class))]),
ApiResponse(responseCode = "400", description = "Invalid username supplied"),
ApiResponse(responseCode = "404", description = "User not found")
]
)
@RequestMapping(
method = [RequestMethod.GET],
value = ["/user/{username}"],
produces = ["application/xml", "application/json"]
)
fun getUserByName(@Parameter(description = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") username: kotlin.String,serverHttpRequest: ServerHttpRequest): ResponseEntity<User> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["user",],
summary = "Logs user into the system",
operationId = "loginUser",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = kotlin.String::class))]),
ApiResponse(responseCode = "400", description = "Invalid username/password supplied")
]
)
@RequestMapping(
method = [RequestMethod.GET],
value = ["/user/login"],
produces = ["application/xml", "application/json"]
)
fun loginUser(@NotNull @Parameter(description = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Parameter(description = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String,serverHttpRequest: ServerHttpRequest): ResponseEntity<kotlin.String> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["user",],
summary = "Logs out current logged in user session",
operationId = "logoutUser",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "successful operation")
]
)
@RequestMapping(
method = [RequestMethod.GET],
value = ["/user/logout"]
)
fun logoutUser(serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
@Operation(
tags = ["user",],
summary = "Updated user",
operationId = "updateUser",
description = """This can only be done by the logged in user.""",
responses = [
ApiResponse(responseCode = "400", description = "Invalid user supplied"),
ApiResponse(responseCode = "404", description = "User not found")
]
)
@RequestMapping(
method = [RequestMethod.PUT],
value = ["/user/{username}"],
consumes = ["application/json"]
)
fun updateUser(@Parameter(description = "name that need to be deleted", required = true) @PathVariable("username") username: kotlin.String,@Parameter(description = "Updated user object", required = true) @Valid @RequestBody user: User,serverHttpRequest: ServerHttpRequest): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
}

View File

@ -0,0 +1,39 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonSubTypes
import com.fasterxml.jackson.annotation.JsonTypeInfo
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param className
* @param color
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes(
JsonSubTypes.Type(value = Cat::class, name = "CAT"),
JsonSubTypes.Type(value = Dog::class, name = "DOG")
)
interface Animal{
@get:Schema(example = "null", requiredMode = Schema.RequiredMode.REQUIRED, description = "")
val className: kotlin.String
@get:Schema(example = "null", description = "")
val color: kotlin.String?
}

View File

@ -0,0 +1,34 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import org.openapitools.model.Animal
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param declawed
*/
data class Cat(
@Schema(example = "null", required = true, description = "")
@get:JsonProperty("className", required = true) override val className: kotlin.String,
@Schema(example = "null", description = "")
@get:JsonProperty("declawed") val declawed: kotlin.Boolean? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("color") override val color: kotlin.String? = "red"
) : Animal{
}

View File

@ -0,0 +1,31 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param name
* @param id
*/
data class Category(
@Schema(example = "null", required = true, description = "")
@get:JsonProperty("name", required = true) val name: kotlin.String = "default-name",
@Schema(example = "null", description = "")
@get:JsonProperty("id") val id: kotlin.Long? = null
) {
}

View File

@ -0,0 +1,27 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param client
*/
data class Client(
@Schema(example = "null", description = "")
@get:JsonProperty("client") val client: kotlin.String? = null
) {
}

View File

@ -0,0 +1,34 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import org.openapitools.model.Animal
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param breed
*/
data class Dog(
@Schema(example = "null", required = true, description = "")
@get:JsonProperty("className", required = true) override val className: kotlin.String,
@Schema(example = "null", description = "")
@get:JsonProperty("breed") val breed: kotlin.String? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("color") override val color: kotlin.String? = "red"
) : Animal{
}

View File

@ -0,0 +1,27 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param bar
*/
data class Foo(
@Schema(example = "null", description = "")
@get:JsonProperty("bar") val bar: kotlin.String? = "bar"
) {
}

View File

@ -0,0 +1,29 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import org.openapitools.model.Foo
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param string
*/
data class FooGetDefaultResponse(
@field:Valid
@Schema(example = "null", description = "")
@get:JsonProperty("string") val string: Foo? = null
) {
}

View File

@ -0,0 +1,35 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param code
* @param type
* @param message
*/
data class ModelApiResponse(
@Schema(example = "null", description = "")
@get:JsonProperty("code") val code: kotlin.Int? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("type") val type: kotlin.String? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("message") val message: kotlin.String? = null
) {
}

View File

@ -0,0 +1,59 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonValue
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param id
* @param petId
* @param quantity
* @param shipDate
* @param status Order Status
* @param complete
*/
data class Order(
@Schema(example = "null", description = "")
@get:JsonProperty("id") val id: kotlin.Long? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("petId") val petId: kotlin.Long? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("quantity") val quantity: kotlin.Int? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
@Schema(example = "null", description = "Order Status")
@get:JsonProperty("status") val status: Order.Status? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("complete") val complete: kotlin.Boolean? = false
) {
/**
* Order Status
* Values: placed,approved,delivered
*/
enum class Status(val value: kotlin.String) {
@JsonProperty("placed") placed("placed"),
@JsonProperty("approved") approved("approved"),
@JsonProperty("delivered") delivered("delivered")
}
}

View File

@ -0,0 +1,63 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonValue
import org.openapitools.model.Category
import org.openapitools.model.Tag
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param name
* @param photoUrls
* @param id
* @param category
* @param tags
* @param status pet status in the store
*/
data class Pet(
@Schema(example = "doggie", required = true, description = "")
@get:JsonProperty("name", required = true) val name: kotlin.String,
@Schema(example = "null", required = true, description = "")
@get:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.Set<kotlin.String>,
@Schema(example = "null", description = "")
@get:JsonProperty("id") val id: kotlin.Long? = null,
@field:Valid
@Schema(example = "null", description = "")
@get:JsonProperty("category") val category: Category? = null,
@field:Valid
@Schema(example = "null", description = "")
@get:JsonProperty("tags") val tags: kotlin.collections.List<Tag>? = null,
@Schema(example = "null", description = "pet status in the store")
@get:JsonProperty("status") val status: Pet.Status? = null
) {
/**
* pet status in the store
* Values: available,pending,sold
*/
enum class Status(val value: kotlin.String) {
@JsonProperty("available") available("available"),
@JsonProperty("pending") pending("pending"),
@JsonProperty("sold") sold("sold")
}
}

View File

@ -0,0 +1,31 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param id
* @param name
*/
data class Tag(
@Schema(example = "null", description = "")
@get:JsonProperty("id") val id: kotlin.Long? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("name") val name: kotlin.String? = null
) {
}

View File

@ -0,0 +1,55 @@
package org.openapitools.model
import java.util.Objects
import com.fasterxml.jackson.annotation.JsonProperty
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import io.swagger.v3.oas.annotations.media.Schema
/**
*
* @param id
* @param username
* @param firstName
* @param lastName
* @param email
* @param password
* @param phone
* @param userStatus User Status
*/
data class User(
@Schema(example = "null", description = "")
@get:JsonProperty("id") val id: kotlin.Long? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("username") val username: kotlin.String? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("firstName") val firstName: kotlin.String? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("lastName") val lastName: kotlin.String? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("email") val email: kotlin.String? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("password") val password: kotlin.String? = null,
@Schema(example = "null", description = "")
@get:JsonProperty("phone") val phone: kotlin.String? = null,
@Schema(example = "null", description = "User Status")
@get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null
) {
}