From 56da2c00ca66ab5bd2c1c0851e48088b0181224a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 14 May 2020 17:24:19 +0800 Subject: [PATCH] Migrate schema samples to use OAS3 samples instead (#6294) * migrate mysql samples to oas 3.0 * update apache2 to use oas3 spec * migrate graphql samples to use oas3 spec * move avro script under bin * update protobuf samples to use openapi3 spec * add new files --- bin/apache2-petstore-config.sh | 2 +- bin/avro-petstore.sh | 32 ++ bin/graphql-schema-petstore.sh | 2 +- bin/mysql-schema-petstore.sh | 2 +- bin/protobuf-schema-petstore.sh | 2 +- bin/windows/apache2-petstore-config.bat | 2 +- bin/windows/graphql-schema-petstore.bat | 2 +- bin/windows/mysql-schema-petstore.bat | 2 +- .../apache2/.openapi-generator/VERSION | 2 +- samples/config/petstore/apache2/PetApi.conf | 12 +- samples/config/petstore/apache2/StoreApi.conf | 6 +- samples/config/petstore/apache2/UserApi.conf | 48 +-- .../graphql-schema/.openapi-generator/VERSION | 2 +- .../petstore/api/pet_api.graphql | 14 +- .../petstore/api/store_api.graphql | 6 +- .../petstore/api/user_api.graphql | 18 +- .../petstore/model/api_response.graphql | 2 +- .../petstore/model/category.graphql | 2 +- .../petstore/model/inline_object.graphql | 15 + .../petstore/model/inline_object_1.graphql | 15 + .../petstore/model/order.graphql | 2 +- .../graphql-schema/petstore/model/pet.graphql | 2 +- .../graphql-schema/petstore/model/tag.graphql | 2 +- .../petstore/model/user.graphql | 2 +- .../.openapi-generator/VERSION | 2 +- .../models/inline_object.proto | 24 ++ .../models/inline_object1.proto | 24 ++ .../services/pet_service.proto | 8 +- .../services/store_service.proto | 2 +- .../services/user_service.proto | 8 +- .../mysql/Model/AdditionalPropertiesClass.sql | 6 +- .../schema/petstore/mysql/Model/EnumTest.sql | 6 +- samples/schema/petstore/mysql/Model/Foo.sql | 26 ++ .../petstore/mysql/Model/FormatTest.sql | 6 +- .../mysql/Model/HealthCheckResult.sql | 26 ++ .../petstore/mysql/Model/InlineObject.sql | 26 ++ .../petstore/mysql/Model/InlineObject1.sql | 26 ++ .../petstore/mysql/Model/InlineObject2.sql | 26 ++ .../petstore/mysql/Model/InlineObject3.sql | 26 ++ .../petstore/mysql/Model/InlineObject4.sql | 26 ++ .../petstore/mysql/Model/InlineObject5.sql | 26 ++ .../mysql/Model/InlineResponseDefault.sql | 26 ++ .../petstore/mysql/Model/NullableClass.sql | 26 ++ .../mysql/Model/OuterEnumDefaultValue.sql | 26 ++ .../petstore/mysql/Model/OuterEnumInteger.sql | 26 ++ .../Model/OuterEnumIntegerDefaultValue.sql | 26 ++ .../petstore/mysql/Model/SpecialModelName.sql | 26 ++ .../schema/petstore/mysql/mysql_schema.sql | 283 ++++++++---------- 48 files changed, 676 insertions(+), 253 deletions(-) create mode 100755 bin/avro-petstore.sh create mode 100644 samples/config/petstore/graphql-schema/petstore/model/inline_object.graphql create mode 100644 samples/config/petstore/graphql-schema/petstore/model/inline_object_1.graphql create mode 100644 samples/config/petstore/protobuf-schema/models/inline_object.proto create mode 100644 samples/config/petstore/protobuf-schema/models/inline_object1.proto create mode 100644 samples/schema/petstore/mysql/Model/Foo.sql create mode 100644 samples/schema/petstore/mysql/Model/HealthCheckResult.sql create mode 100644 samples/schema/petstore/mysql/Model/InlineObject.sql create mode 100644 samples/schema/petstore/mysql/Model/InlineObject1.sql create mode 100644 samples/schema/petstore/mysql/Model/InlineObject2.sql create mode 100644 samples/schema/petstore/mysql/Model/InlineObject3.sql create mode 100644 samples/schema/petstore/mysql/Model/InlineObject4.sql create mode 100644 samples/schema/petstore/mysql/Model/InlineObject5.sql create mode 100644 samples/schema/petstore/mysql/Model/InlineResponseDefault.sql create mode 100644 samples/schema/petstore/mysql/Model/NullableClass.sql create mode 100644 samples/schema/petstore/mysql/Model/OuterEnumDefaultValue.sql create mode 100644 samples/schema/petstore/mysql/Model/OuterEnumInteger.sql create mode 100644 samples/schema/petstore/mysql/Model/OuterEnumIntegerDefaultValue.sql create mode 100644 samples/schema/petstore/mysql/Model/SpecialModelName.sql diff --git a/bin/apache2-petstore-config.sh b/bin/apache2-petstore-config.sh index 867d6c25aa11..ee7f1e05cc6e 100755 --- a/bin/apache2-petstore-config.sh +++ b/bin/apache2-petstore-config.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -g apache2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o samples/config/petstore/apache2 $@" +ags="generate -g apache2 -t modules/openapi-generator/src/main/resources/apache2/ -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o samples/config/petstore/apache2 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/avro-petstore.sh b/bin/avro-petstore.sh new file mode 100755 index 000000000000..7b8045fcf88f --- /dev/null +++ b/bin/avro-petstore.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -t modules/openapi-generator/src/main/resources/avro-schema -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g avro-schema -o samples/openapi3/schema/petstore/avro-schema $@" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/graphql-schema-petstore.sh b/bin/graphql-schema-petstore.sh index c6f36de2b5e9..b99d3bba8774 100755 --- a/bin/graphql-schema-petstore.sh +++ b/bin/graphql-schema-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@" -ags="generate -t modules/openapi-generator/src/main/resources/graphql-schema -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g graphql-schema -o samples/config/petstore/graphql-schema --additional-properties packageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/graphql-schema -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g graphql-schema -o samples/config/petstore/graphql-schema --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/mysql-schema-petstore.sh b/bin/mysql-schema-petstore.sh index 6964d2571640..ed35c12a07be 100755 --- a/bin/mysql-schema-petstore.sh +++ b/bin/mysql-schema-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/mysql-schema -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g mysql-schema -o samples/schema/petstore/mysql $@" +ags="generate -t modules/openapi-generator/src/main/resources/mysql-schema -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g mysql-schema -o samples/schema/petstore/mysql $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/protobuf-schema-petstore.sh b/bin/protobuf-schema-petstore.sh index 3c79de0a907e..09b132ad26b5 100755 --- a/bin/protobuf-schema-petstore.sh +++ b/bin/protobuf-schema-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@" -ags="generate -t modules/openapi-generator/src/main/resources/protobuf-schema -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g protobuf-schema -o samples/config/petstore/protobuf-schema --additional-properties packageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/protobuf-schema -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g protobuf-schema -o samples/config/petstore/protobuf-schema --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/apache2-petstore-config.bat b/bin/windows/apache2-petstore-config.bat index 34f39b7e02e0..135ddabc5733 100644 --- a/bin/windows/apache2-petstore-config.bat +++ b/bin/windows/apache2-petstore-config.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g apache2 -o samples\config\petstore\apache2\ +set ags=generate -t modules\openapi-generator\src\main\resources\apache2\ -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g apache2 -o samples\config\petstore\apache2\ java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/graphql-schema-petstore.bat b/bin/windows/graphql-schema-petstore.bat index 5a5f44ef61c5..ad9d5c5fde94 100755 --- a/bin/windows/graphql-schema-petstore.bat +++ b/bin/windows/graphql-schema-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -t modules\openapi-generator\src\main\resources\graphql-schema -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g graphql-schema -o samples\config\petstore\graphql-schema +set ags=generate -t modules\openapi-generator\src\main\resources\graphql-schema -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g graphql-schema -o samples\config\petstore\graphql-schema java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/mysql-schema-petstore.bat b/bin/windows/mysql-schema-petstore.bat index 327b9671fae4..7590d2c0a7e9 100755 --- a/bin/windows/mysql-schema-petstore.bat +++ b/bin/windows/mysql-schema-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g mysql-schema -o samples\schema\petstore\mysql +set ags=generate -i modules\openapi-generator\src\test\resources\3_0\petstore-with-fake-endpoints-models-for-testing.yaml -g mysql-schema -o samples\schema\petstore\mysql java %JAVA_OPTS% -jar %executable% %ags% diff --git a/samples/config/petstore/apache2/.openapi-generator/VERSION b/samples/config/petstore/apache2/.openapi-generator/VERSION index 7fea99011a6f..d99e7162d01f 100644 --- a/samples/config/petstore/apache2/.openapi-generator/VERSION +++ b/samples/config/petstore/apache2/.openapi-generator/VERSION @@ -1 +1 @@ -2.2.3-SNAPSHOT \ No newline at end of file +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/config/petstore/apache2/PetApi.conf b/samples/config/petstore/apache2/PetApi.conf index c92843e2610f..180699be5380 100644 --- a/samples/config/petstore/apache2/PetApi.conf +++ b/samples/config/petstore/apache2/PetApi.conf @@ -1,4 +1,4 @@ - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" @@ -16,7 +16,7 @@ Require group read:pets - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" @@ -34,7 +34,7 @@ Require group read:pets - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" @@ -44,11 +44,10 @@ Require valid-user - Require group write:pets Require group read:pets - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" @@ -58,11 +57,10 @@ Require valid-user - Require group write:pets Require group read:pets - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" diff --git a/samples/config/petstore/apache2/StoreApi.conf b/samples/config/petstore/apache2/StoreApi.conf index f0fb742f55ac..b223a8816ba6 100644 --- a/samples/config/petstore/apache2/StoreApi.conf +++ b/samples/config/petstore/apache2/StoreApi.conf @@ -1,4 +1,4 @@ - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" @@ -14,7 +14,7 @@ Require valid-user - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" @@ -24,7 +24,7 @@ Require valid-user - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" diff --git a/samples/config/petstore/apache2/UserApi.conf b/samples/config/petstore/apache2/UserApi.conf index b01bb509728a..226bcf8affff 100644 --- a/samples/config/petstore/apache2/UserApi.conf +++ b/samples/config/petstore/apache2/UserApi.conf @@ -1,4 +1,4 @@ - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" @@ -7,11 +7,8 @@ Require valid-user - - Require valid-user - - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" @@ -20,11 +17,8 @@ Require valid-user - - Require valid-user - - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" @@ -33,30 +27,8 @@ Require valid-user - - Require valid-user - - - AuthBasicProvider file - AuthUserFile "/var/www/html/htpwd" - AuthGroupFile "/var/www/html/groups" - AuthType basic - AuthName "api" - - Require valid-user - - - Require valid-user - - - Require valid-user - - - Require valid-user - - - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" @@ -69,7 +41,7 @@ Require valid-user - + AuthBasicProvider file AuthUserFile "/var/www/html/htpwd" AuthGroupFile "/var/www/html/groups" @@ -82,3 +54,13 @@ Require valid-user + + AuthBasicProvider file + AuthUserFile "/var/www/html/htpwd" + AuthGroupFile "/var/www/html/groups" + AuthType basic + AuthName "api" + + Require valid-user + + diff --git a/samples/config/petstore/graphql-schema/.openapi-generator/VERSION b/samples/config/petstore/graphql-schema/.openapi-generator/VERSION index afa636560641..d99e7162d01f 100644 --- a/samples/config/petstore/graphql-schema/.openapi-generator/VERSION +++ b/samples/config/petstore/graphql-schema/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/config/petstore/graphql-schema/petstore/api/pet_api.graphql b/samples/config/petstore/graphql-schema/petstore/api/pet_api.graphql index 07bdf0c0adb4..30ba80b7ad63 100644 --- a/samples/config/petstore/graphql-schema/petstore/api/pet_api.graphql +++ b/samples/config/petstore/graphql-schema/petstore/api/pet_api.graphql @@ -1,6 +1,6 @@ # 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. -# OpenAPI spec version: 1.0.0 +# The version of the OpenAPI document: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -10,9 +10,9 @@ type mutation { # Add a new pet to the store - # @param Pet body Pet object that needs to be added to the store - # @return [null] - AddPet(body: Pet): null + # @param Pet pet Pet object that needs to be added to the store + # @return [Pet] + AddPet(pet: Pet): Pet # Deletes a pet # @param Int! petId Pet id to delete @@ -21,9 +21,9 @@ type mutation { DeletePet(petId: Int!, apiKey: String!): null # Update an existing pet - # @param Pet body Pet object that needs to be added to the store - # @return [null] - UpdatePet(body: Pet): null + # @param Pet pet Pet object that needs to be added to the store + # @return [Pet] + UpdatePet(pet: Pet): Pet # Updates a pet in the store with form data # @param Int! petId ID of pet that needs to be updated diff --git a/samples/config/petstore/graphql-schema/petstore/api/store_api.graphql b/samples/config/petstore/graphql-schema/petstore/api/store_api.graphql index 30e2a034f20a..e65b6520bb27 100644 --- a/samples/config/petstore/graphql-schema/petstore/api/store_api.graphql +++ b/samples/config/petstore/graphql-schema/petstore/api/store_api.graphql @@ -1,6 +1,6 @@ # 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. -# OpenAPI spec version: 1.0.0 +# The version of the OpenAPI document: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -16,9 +16,9 @@ type mutation { DeleteOrder(orderId: String!): null # Place an order for a pet - # @param Order body order placed for purchasing the pet + # @param Order order order placed for purchasing the pet # @return [Order] - PlaceOrder(body: Order): Order + PlaceOrder(order: Order): Order } diff --git a/samples/config/petstore/graphql-schema/petstore/api/user_api.graphql b/samples/config/petstore/graphql-schema/petstore/api/user_api.graphql index 12335c2207e5..5c07d7f10e58 100644 --- a/samples/config/petstore/graphql-schema/petstore/api/user_api.graphql +++ b/samples/config/petstore/graphql-schema/petstore/api/user_api.graphql @@ -1,6 +1,6 @@ # 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. -# OpenAPI spec version: 1.0.0 +# The version of the OpenAPI document: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # @@ -11,19 +11,19 @@ type mutation { # Create user # This can only be done by the logged in user. - # @param User body Created user object + # @param User user Created user object # @return [null] - CreateUser(body: User): null + CreateUser(user: User): null # Creates list of users with given input array - # @param [User] body List of user object + # @param [User] user List of user object # @return [null] - CreateUsersWithArrayInput(body: [User]): null + CreateUsersWithArrayInput(user: [User]): null # Creates list of users with given input array - # @param [User] body List of user object + # @param [User] user List of user object # @return [null] - CreateUsersWithListInput(body: [User]): null + CreateUsersWithListInput(user: [User]): null # Delete user # This can only be done by the logged in user. @@ -34,9 +34,9 @@ type mutation { # Updated user # This can only be done by the logged in user. # @param String! username name that need to be deleted - # @param User body Updated user object + # @param User user Updated user object # @return [null] - UpdateUser(username: String!, body: User): null + UpdateUser(username: String!, user: User): null } diff --git a/samples/config/petstore/graphql-schema/petstore/model/api_response.graphql b/samples/config/petstore/graphql-schema/petstore/model/api_response.graphql index 2f8221d6f776..9db63eae5b9d 100644 --- a/samples/config/petstore/graphql-schema/petstore/model/api_response.graphql +++ b/samples/config/petstore/graphql-schema/petstore/model/api_response.graphql @@ -1,6 +1,6 @@ # 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. -# OpenAPI spec version: 1.0.0 +# The version of the OpenAPI document: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/config/petstore/graphql-schema/petstore/model/category.graphql b/samples/config/petstore/graphql-schema/petstore/model/category.graphql index eeeef5998ae4..b75961d86df7 100644 --- a/samples/config/petstore/graphql-schema/petstore/model/category.graphql +++ b/samples/config/petstore/graphql-schema/petstore/model/category.graphql @@ -1,6 +1,6 @@ # 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. -# OpenAPI spec version: 1.0.0 +# The version of the OpenAPI document: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/config/petstore/graphql-schema/petstore/model/inline_object.graphql b/samples/config/petstore/graphql-schema/petstore/model/inline_object.graphql new file mode 100644 index 000000000000..20629c5a17d6 --- /dev/null +++ b/samples/config/petstore/graphql-schema/petstore/model/inline_object.graphql @@ -0,0 +1,15 @@ +# 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 OpenAPI Generator: https://openapi-generator.tech +# + +type InlineObject { + + # Updated name of the pet + name: String! + + # Updated status of the pet + status: String! + +} diff --git a/samples/config/petstore/graphql-schema/petstore/model/inline_object_1.graphql b/samples/config/petstore/graphql-schema/petstore/model/inline_object_1.graphql new file mode 100644 index 000000000000..f7568342d423 --- /dev/null +++ b/samples/config/petstore/graphql-schema/petstore/model/inline_object_1.graphql @@ -0,0 +1,15 @@ +# 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 OpenAPI Generator: https://openapi-generator.tech +# + +type InlineObject1 { + + # Additional data to pass to server + additionalMetadata: String! + + # file to upload + file: String! + +} diff --git a/samples/config/petstore/graphql-schema/petstore/model/order.graphql b/samples/config/petstore/graphql-schema/petstore/model/order.graphql index a76301107ac2..af6f699f8a95 100644 --- a/samples/config/petstore/graphql-schema/petstore/model/order.graphql +++ b/samples/config/petstore/graphql-schema/petstore/model/order.graphql @@ -1,6 +1,6 @@ # 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. -# OpenAPI spec version: 1.0.0 +# The version of the OpenAPI document: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/config/petstore/graphql-schema/petstore/model/pet.graphql b/samples/config/petstore/graphql-schema/petstore/model/pet.graphql index e8ce58e93da3..c346af193587 100644 --- a/samples/config/petstore/graphql-schema/petstore/model/pet.graphql +++ b/samples/config/petstore/graphql-schema/petstore/model/pet.graphql @@ -1,6 +1,6 @@ # 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. -# OpenAPI spec version: 1.0.0 +# The version of the OpenAPI document: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/config/petstore/graphql-schema/petstore/model/tag.graphql b/samples/config/petstore/graphql-schema/petstore/model/tag.graphql index 9fc620141a8c..a5002f44c9c1 100644 --- a/samples/config/petstore/graphql-schema/petstore/model/tag.graphql +++ b/samples/config/petstore/graphql-schema/petstore/model/tag.graphql @@ -1,6 +1,6 @@ # 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. -# OpenAPI spec version: 1.0.0 +# The version of the OpenAPI document: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/config/petstore/graphql-schema/petstore/model/user.graphql b/samples/config/petstore/graphql-schema/petstore/model/user.graphql index da66c49fb83e..2f678c28ea7b 100644 --- a/samples/config/petstore/graphql-schema/petstore/model/user.graphql +++ b/samples/config/petstore/graphql-schema/petstore/model/user.graphql @@ -1,6 +1,6 @@ # 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. -# OpenAPI spec version: 1.0.0 +# The version of the OpenAPI document: 1.0.0 # Generated by OpenAPI Generator: https://openapi-generator.tech # diff --git a/samples/config/petstore/protobuf-schema/.openapi-generator/VERSION b/samples/config/petstore/protobuf-schema/.openapi-generator/VERSION index c3a2c7076fa8..d99e7162d01f 100644 --- a/samples/config/petstore/protobuf-schema/.openapi-generator/VERSION +++ b/samples/config/petstore/protobuf-schema/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.0-SNAPSHOT \ No newline at end of file +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/config/petstore/protobuf-schema/models/inline_object.proto b/samples/config/petstore/protobuf-schema/models/inline_object.proto new file mode 100644 index 000000000000..90f288aaa3b4 --- /dev/null +++ b/samples/config/petstore/protobuf-schema/models/inline_object.proto @@ -0,0 +1,24 @@ +/* + 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 OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package petstore; + + +message InlineObject { + + // Updated name of the pet + string name = 1; + + // Updated status of the pet + string status = 2; + +} diff --git a/samples/config/petstore/protobuf-schema/models/inline_object1.proto b/samples/config/petstore/protobuf-schema/models/inline_object1.proto new file mode 100644 index 000000000000..7a8b209cf731 --- /dev/null +++ b/samples/config/petstore/protobuf-schema/models/inline_object1.proto @@ -0,0 +1,24 @@ +/* + 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 OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package petstore; + + +message InlineObject1 { + + // Additional data to pass to server + string additionalMetadata = 1; + + // file to upload + string file = 2; + +} diff --git a/samples/config/petstore/protobuf-schema/services/pet_service.proto b/samples/config/petstore/protobuf-schema/services/pet_service.proto index 2b7ae553ad4e..808f3d2e3cde 100644 --- a/samples/config/petstore/protobuf-schema/services/pet_service.proto +++ b/samples/config/petstore/protobuf-schema/services/pet_service.proto @@ -17,7 +17,7 @@ import public "models/api_response.proto"; import public "models/pet.proto"; service PetService { - rpc AddPet (AddPetRequest) returns (google.protobuf.Empty); + rpc AddPet (AddPetRequest) returns (Pet); rpc DeletePet (DeletePetRequest) returns (google.protobuf.Empty); @@ -27,7 +27,7 @@ service PetService { rpc GetPetById (GetPetByIdRequest) returns (Pet); - rpc UpdatePet (UpdatePetRequest) returns (google.protobuf.Empty); + rpc UpdatePet (UpdatePetRequest) returns (Pet); rpc UpdatePetWithForm (UpdatePetWithFormRequest) returns (google.protobuf.Empty); @@ -37,7 +37,7 @@ service PetService { message AddPetRequest { // Pet object that needs to be added to the store - Pet body = 1; + Pet pet = 1; } @@ -76,7 +76,7 @@ message GetPetByIdRequest { message UpdatePetRequest { // Pet object that needs to be added to the store - Pet body = 1; + Pet pet = 1; } diff --git a/samples/config/petstore/protobuf-schema/services/store_service.proto b/samples/config/petstore/protobuf-schema/services/store_service.proto index 8adea52f7547..cb25b37d6666 100644 --- a/samples/config/petstore/protobuf-schema/services/store_service.proto +++ b/samples/config/petstore/protobuf-schema/services/store_service.proto @@ -44,7 +44,7 @@ message GetOrderByIdRequest { message PlaceOrderRequest { // order placed for purchasing the pet - Order body = 1; + Order order = 1; } diff --git a/samples/config/petstore/protobuf-schema/services/user_service.proto b/samples/config/petstore/protobuf-schema/services/user_service.proto index 8f3f762bd4ce..43fd415beaa1 100644 --- a/samples/config/petstore/protobuf-schema/services/user_service.proto +++ b/samples/config/petstore/protobuf-schema/services/user_service.proto @@ -36,19 +36,19 @@ service UserService { message CreateUserRequest { // Created user object - User body = 1; + User user = 1; } message CreateUsersWithArrayInputRequest { // List of user object - repeated User body = 1; + repeated User user = 1; } message CreateUsersWithListInputRequest { // List of user object - repeated User body = 1; + repeated User user = 1; } @@ -80,7 +80,7 @@ message UpdateUserRequest { // name that need to be deleted string username = 1; // Updated user object - User body = 2; + User user = 2; } diff --git a/samples/schema/petstore/mysql/Model/AdditionalPropertiesClass.sql b/samples/schema/petstore/mysql/Model/AdditionalPropertiesClass.sql index d0a4dcf0c7bd..4c83dae03993 100644 --- a/samples/schema/petstore/mysql/Model/AdditionalPropertiesClass.sql +++ b/samples/schema/petstore/mysql/Model/AdditionalPropertiesClass.sql @@ -7,17 +7,17 @@ -- -- SELECT template for table `AdditionalPropertiesClass` -- -SELECT `map_string`, `map_number`, `map_integer`, `map_boolean`, `map_array_integer`, `map_array_anytype`, `map_map_string`, `map_map_anytype`, `anytype_1`, `anytype_2`, `anytype_3` FROM `AdditionalPropertiesClass` WHERE 1; +SELECT `map_property`, `map_of_map_property` FROM `AdditionalPropertiesClass` WHERE 1; -- -- INSERT template for table `AdditionalPropertiesClass` -- -INSERT INTO `AdditionalPropertiesClass`(`map_string`, `map_number`, `map_integer`, `map_boolean`, `map_array_integer`, `map_array_anytype`, `map_map_string`, `map_map_anytype`, `anytype_1`, `anytype_2`, `anytype_3`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); +INSERT INTO `AdditionalPropertiesClass`(`map_property`, `map_of_map_property`) VALUES (?, ?); -- -- UPDATE template for table `AdditionalPropertiesClass` -- -UPDATE `AdditionalPropertiesClass` SET `map_string` = ?, `map_number` = ?, `map_integer` = ?, `map_boolean` = ?, `map_array_integer` = ?, `map_array_anytype` = ?, `map_map_string` = ?, `map_map_anytype` = ?, `anytype_1` = ?, `anytype_2` = ?, `anytype_3` = ? WHERE 1; +UPDATE `AdditionalPropertiesClass` SET `map_property` = ?, `map_of_map_property` = ? WHERE 1; -- -- DELETE template for table `AdditionalPropertiesClass` diff --git a/samples/schema/petstore/mysql/Model/EnumTest.sql b/samples/schema/petstore/mysql/Model/EnumTest.sql index fb411ce12b20..3e3d9e4b65b2 100644 --- a/samples/schema/petstore/mysql/Model/EnumTest.sql +++ b/samples/schema/petstore/mysql/Model/EnumTest.sql @@ -7,17 +7,17 @@ -- -- SELECT template for table `Enum_Test` -- -SELECT `enum_string`, `enum_string_required`, `enum_integer`, `enum_number`, `outerEnum` FROM `Enum_Test` WHERE 1; +SELECT `enum_string`, `enum_string_required`, `enum_integer`, `enum_number`, `outerEnum`, `outerEnumInteger`, `outerEnumDefaultValue`, `outerEnumIntegerDefaultValue` FROM `Enum_Test` WHERE 1; -- -- INSERT template for table `Enum_Test` -- -INSERT INTO `Enum_Test`(`enum_string`, `enum_string_required`, `enum_integer`, `enum_number`, `outerEnum`) VALUES (?, ?, ?, ?, ?); +INSERT INTO `Enum_Test`(`enum_string`, `enum_string_required`, `enum_integer`, `enum_number`, `outerEnum`, `outerEnumInteger`, `outerEnumDefaultValue`, `outerEnumIntegerDefaultValue`) VALUES (?, ?, ?, ?, ?, ?, ?, ?); -- -- UPDATE template for table `Enum_Test` -- -UPDATE `Enum_Test` SET `enum_string` = ?, `enum_string_required` = ?, `enum_integer` = ?, `enum_number` = ?, `outerEnum` = ? WHERE 1; +UPDATE `Enum_Test` SET `enum_string` = ?, `enum_string_required` = ?, `enum_integer` = ?, `enum_number` = ?, `outerEnum` = ?, `outerEnumInteger` = ?, `outerEnumDefaultValue` = ?, `outerEnumIntegerDefaultValue` = ? WHERE 1; -- -- DELETE template for table `Enum_Test` diff --git a/samples/schema/petstore/mysql/Model/Foo.sql b/samples/schema/petstore/mysql/Model/Foo.sql new file mode 100644 index 000000000000..566088268d02 --- /dev/null +++ b/samples/schema/petstore/mysql/Model/Foo.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'Foo' definition. +-- + + +-- +-- SELECT template for table `Foo` +-- +SELECT `bar` FROM `Foo` WHERE 1; + +-- +-- INSERT template for table `Foo` +-- +INSERT INTO `Foo`(`bar`) VALUES (?); + +-- +-- UPDATE template for table `Foo` +-- +UPDATE `Foo` SET `bar` = ? WHERE 1; + +-- +-- DELETE template for table `Foo` +-- +DELETE FROM `Foo` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/FormatTest.sql b/samples/schema/petstore/mysql/Model/FormatTest.sql index 2ff0a26f98ff..205353c54aad 100644 --- a/samples/schema/petstore/mysql/Model/FormatTest.sql +++ b/samples/schema/petstore/mysql/Model/FormatTest.sql @@ -7,17 +7,17 @@ -- -- SELECT template for table `format_test` -- -SELECT `integer`, `int32`, `int64`, `number`, `float`, `double`, `string`, `byte`, `binary`, `date`, `dateTime`, `uuid`, `password`, `BigDecimal` FROM `format_test` WHERE 1; +SELECT `integer`, `int32`, `int64`, `number`, `float`, `double`, `string`, `byte`, `binary`, `date`, `dateTime`, `uuid`, `password`, `pattern_with_digits`, `pattern_with_digits_and_delimiter` FROM `format_test` WHERE 1; -- -- INSERT template for table `format_test` -- -INSERT INTO `format_test`(`integer`, `int32`, `int64`, `number`, `float`, `double`, `string`, `byte`, `binary`, `date`, `dateTime`, `uuid`, `password`, `BigDecimal`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); +INSERT INTO `format_test`(`integer`, `int32`, `int64`, `number`, `float`, `double`, `string`, `byte`, `binary`, `date`, `dateTime`, `uuid`, `password`, `pattern_with_digits`, `pattern_with_digits_and_delimiter`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); -- -- UPDATE template for table `format_test` -- -UPDATE `format_test` SET `integer` = ?, `int32` = ?, `int64` = ?, `number` = ?, `float` = ?, `double` = ?, `string` = ?, `byte` = ?, `binary` = ?, `date` = ?, `dateTime` = ?, `uuid` = ?, `password` = ?, `BigDecimal` = ? WHERE 1; +UPDATE `format_test` SET `integer` = ?, `int32` = ?, `int64` = ?, `number` = ?, `float` = ?, `double` = ?, `string` = ?, `byte` = ?, `binary` = ?, `date` = ?, `dateTime` = ?, `uuid` = ?, `password` = ?, `pattern_with_digits` = ?, `pattern_with_digits_and_delimiter` = ? WHERE 1; -- -- DELETE template for table `format_test` diff --git a/samples/schema/petstore/mysql/Model/HealthCheckResult.sql b/samples/schema/petstore/mysql/Model/HealthCheckResult.sql new file mode 100644 index 000000000000..151b51a67d13 --- /dev/null +++ b/samples/schema/petstore/mysql/Model/HealthCheckResult.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'HealthCheckResult' definition. +-- + + +-- +-- SELECT template for table `HealthCheckResult` +-- +SELECT `NullableMessage` FROM `HealthCheckResult` WHERE 1; + +-- +-- INSERT template for table `HealthCheckResult` +-- +INSERT INTO `HealthCheckResult`(`NullableMessage`) VALUES (?); + +-- +-- UPDATE template for table `HealthCheckResult` +-- +UPDATE `HealthCheckResult` SET `NullableMessage` = ? WHERE 1; + +-- +-- DELETE template for table `HealthCheckResult` +-- +DELETE FROM `HealthCheckResult` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/InlineObject.sql b/samples/schema/petstore/mysql/Model/InlineObject.sql new file mode 100644 index 000000000000..efc38026656c --- /dev/null +++ b/samples/schema/petstore/mysql/Model/InlineObject.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'inline_object' definition. +-- + + +-- +-- SELECT template for table `inline_object` +-- +SELECT `name`, `status` FROM `inline_object` WHERE 1; + +-- +-- INSERT template for table `inline_object` +-- +INSERT INTO `inline_object`(`name`, `status`) VALUES (?, ?); + +-- +-- UPDATE template for table `inline_object` +-- +UPDATE `inline_object` SET `name` = ?, `status` = ? WHERE 1; + +-- +-- DELETE template for table `inline_object` +-- +DELETE FROM `inline_object` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/InlineObject1.sql b/samples/schema/petstore/mysql/Model/InlineObject1.sql new file mode 100644 index 000000000000..fb000207accc --- /dev/null +++ b/samples/schema/petstore/mysql/Model/InlineObject1.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'inline_object_1' definition. +-- + + +-- +-- SELECT template for table `inline_object_1` +-- +SELECT `additionalMetadata`, `file` FROM `inline_object_1` WHERE 1; + +-- +-- INSERT template for table `inline_object_1` +-- +INSERT INTO `inline_object_1`(`additionalMetadata`, `file`) VALUES (?, ?); + +-- +-- UPDATE template for table `inline_object_1` +-- +UPDATE `inline_object_1` SET `additionalMetadata` = ?, `file` = ? WHERE 1; + +-- +-- DELETE template for table `inline_object_1` +-- +DELETE FROM `inline_object_1` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/InlineObject2.sql b/samples/schema/petstore/mysql/Model/InlineObject2.sql new file mode 100644 index 000000000000..3f488010d346 --- /dev/null +++ b/samples/schema/petstore/mysql/Model/InlineObject2.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'inline_object_2' definition. +-- + + +-- +-- SELECT template for table `inline_object_2` +-- +SELECT `enum_form_string_array`, `enum_form_string` FROM `inline_object_2` WHERE 1; + +-- +-- INSERT template for table `inline_object_2` +-- +INSERT INTO `inline_object_2`(`enum_form_string_array`, `enum_form_string`) VALUES (?, ?); + +-- +-- UPDATE template for table `inline_object_2` +-- +UPDATE `inline_object_2` SET `enum_form_string_array` = ?, `enum_form_string` = ? WHERE 1; + +-- +-- DELETE template for table `inline_object_2` +-- +DELETE FROM `inline_object_2` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/InlineObject3.sql b/samples/schema/petstore/mysql/Model/InlineObject3.sql new file mode 100644 index 000000000000..3ebdc7280fbe --- /dev/null +++ b/samples/schema/petstore/mysql/Model/InlineObject3.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'inline_object_3' definition. +-- + + +-- +-- SELECT template for table `inline_object_3` +-- +SELECT `integer`, `int32`, `int64`, `number`, `float`, `double`, `string`, `pattern_without_delimiter`, `byte`, `binary`, `date`, `dateTime`, `password`, `callback` FROM `inline_object_3` WHERE 1; + +-- +-- INSERT template for table `inline_object_3` +-- +INSERT INTO `inline_object_3`(`integer`, `int32`, `int64`, `number`, `float`, `double`, `string`, `pattern_without_delimiter`, `byte`, `binary`, `date`, `dateTime`, `password`, `callback`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); + +-- +-- UPDATE template for table `inline_object_3` +-- +UPDATE `inline_object_3` SET `integer` = ?, `int32` = ?, `int64` = ?, `number` = ?, `float` = ?, `double` = ?, `string` = ?, `pattern_without_delimiter` = ?, `byte` = ?, `binary` = ?, `date` = ?, `dateTime` = ?, `password` = ?, `callback` = ? WHERE 1; + +-- +-- DELETE template for table `inline_object_3` +-- +DELETE FROM `inline_object_3` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/InlineObject4.sql b/samples/schema/petstore/mysql/Model/InlineObject4.sql new file mode 100644 index 000000000000..0770da98748a --- /dev/null +++ b/samples/schema/petstore/mysql/Model/InlineObject4.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'inline_object_4' definition. +-- + + +-- +-- SELECT template for table `inline_object_4` +-- +SELECT `param`, `param2` FROM `inline_object_4` WHERE 1; + +-- +-- INSERT template for table `inline_object_4` +-- +INSERT INTO `inline_object_4`(`param`, `param2`) VALUES (?, ?); + +-- +-- UPDATE template for table `inline_object_4` +-- +UPDATE `inline_object_4` SET `param` = ?, `param2` = ? WHERE 1; + +-- +-- DELETE template for table `inline_object_4` +-- +DELETE FROM `inline_object_4` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/InlineObject5.sql b/samples/schema/petstore/mysql/Model/InlineObject5.sql new file mode 100644 index 000000000000..12bb3e9f6065 --- /dev/null +++ b/samples/schema/petstore/mysql/Model/InlineObject5.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'inline_object_5' definition. +-- + + +-- +-- SELECT template for table `inline_object_5` +-- +SELECT `additionalMetadata`, `requiredFile` FROM `inline_object_5` WHERE 1; + +-- +-- INSERT template for table `inline_object_5` +-- +INSERT INTO `inline_object_5`(`additionalMetadata`, `requiredFile`) VALUES (?, ?); + +-- +-- UPDATE template for table `inline_object_5` +-- +UPDATE `inline_object_5` SET `additionalMetadata` = ?, `requiredFile` = ? WHERE 1; + +-- +-- DELETE template for table `inline_object_5` +-- +DELETE FROM `inline_object_5` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/InlineResponseDefault.sql b/samples/schema/petstore/mysql/Model/InlineResponseDefault.sql new file mode 100644 index 000000000000..b117d6cdf160 --- /dev/null +++ b/samples/schema/petstore/mysql/Model/InlineResponseDefault.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'inline_response_default' definition. +-- + + +-- +-- SELECT template for table `inline_response_default` +-- +SELECT `string` FROM `inline_response_default` WHERE 1; + +-- +-- INSERT template for table `inline_response_default` +-- +INSERT INTO `inline_response_default`(`string`) VALUES (?); + +-- +-- UPDATE template for table `inline_response_default` +-- +UPDATE `inline_response_default` SET `string` = ? WHERE 1; + +-- +-- DELETE template for table `inline_response_default` +-- +DELETE FROM `inline_response_default` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/NullableClass.sql b/samples/schema/petstore/mysql/Model/NullableClass.sql new file mode 100644 index 000000000000..8ef28bcbcaf5 --- /dev/null +++ b/samples/schema/petstore/mysql/Model/NullableClass.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'NullableClass' definition. +-- + + +-- +-- SELECT template for table `NullableClass` +-- +SELECT `integer_prop`, `number_prop`, `boolean_prop`, `string_prop`, `date_prop`, `datetime_prop`, `array_nullable_prop`, `array_and_items_nullable_prop`, `array_items_nullable`, `object_nullable_prop`, `object_and_items_nullable_prop`, `object_items_nullable` FROM `NullableClass` WHERE 1; + +-- +-- INSERT template for table `NullableClass` +-- +INSERT INTO `NullableClass`(`integer_prop`, `number_prop`, `boolean_prop`, `string_prop`, `date_prop`, `datetime_prop`, `array_nullable_prop`, `array_and_items_nullable_prop`, `array_items_nullable`, `object_nullable_prop`, `object_and_items_nullable_prop`, `object_items_nullable`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); + +-- +-- UPDATE template for table `NullableClass` +-- +UPDATE `NullableClass` SET `integer_prop` = ?, `number_prop` = ?, `boolean_prop` = ?, `string_prop` = ?, `date_prop` = ?, `datetime_prop` = ?, `array_nullable_prop` = ?, `array_and_items_nullable_prop` = ?, `array_items_nullable` = ?, `object_nullable_prop` = ?, `object_and_items_nullable_prop` = ?, `object_items_nullable` = ? WHERE 1; + +-- +-- DELETE template for table `NullableClass` +-- +DELETE FROM `NullableClass` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/OuterEnumDefaultValue.sql b/samples/schema/petstore/mysql/Model/OuterEnumDefaultValue.sql new file mode 100644 index 000000000000..82ee1a12b546 --- /dev/null +++ b/samples/schema/petstore/mysql/Model/OuterEnumDefaultValue.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'OuterEnumDefaultValue' definition. +-- + + +-- +-- SELECT template for table `OuterEnumDefaultValue` +-- +SELECT FROM `OuterEnumDefaultValue` WHERE 1; + +-- +-- INSERT template for table `OuterEnumDefaultValue` +-- +INSERT INTO `OuterEnumDefaultValue`() VALUES (); + +-- +-- UPDATE template for table `OuterEnumDefaultValue` +-- +UPDATE `OuterEnumDefaultValue` SET WHERE 1; + +-- +-- DELETE template for table `OuterEnumDefaultValue` +-- +DELETE FROM `OuterEnumDefaultValue` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/OuterEnumInteger.sql b/samples/schema/petstore/mysql/Model/OuterEnumInteger.sql new file mode 100644 index 000000000000..46f23ec056ae --- /dev/null +++ b/samples/schema/petstore/mysql/Model/OuterEnumInteger.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'OuterEnumInteger' definition. +-- + + +-- +-- SELECT template for table `OuterEnumInteger` +-- +SELECT FROM `OuterEnumInteger` WHERE 1; + +-- +-- INSERT template for table `OuterEnumInteger` +-- +INSERT INTO `OuterEnumInteger`() VALUES (); + +-- +-- UPDATE template for table `OuterEnumInteger` +-- +UPDATE `OuterEnumInteger` SET WHERE 1; + +-- +-- DELETE template for table `OuterEnumInteger` +-- +DELETE FROM `OuterEnumInteger` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/OuterEnumIntegerDefaultValue.sql b/samples/schema/petstore/mysql/Model/OuterEnumIntegerDefaultValue.sql new file mode 100644 index 000000000000..4414cd0cef13 --- /dev/null +++ b/samples/schema/petstore/mysql/Model/OuterEnumIntegerDefaultValue.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'OuterEnumIntegerDefaultValue' definition. +-- + + +-- +-- SELECT template for table `OuterEnumIntegerDefaultValue` +-- +SELECT FROM `OuterEnumIntegerDefaultValue` WHERE 1; + +-- +-- INSERT template for table `OuterEnumIntegerDefaultValue` +-- +INSERT INTO `OuterEnumIntegerDefaultValue`() VALUES (); + +-- +-- UPDATE template for table `OuterEnumIntegerDefaultValue` +-- +UPDATE `OuterEnumIntegerDefaultValue` SET WHERE 1; + +-- +-- DELETE template for table `OuterEnumIntegerDefaultValue` +-- +DELETE FROM `OuterEnumIntegerDefaultValue` WHERE 0; + diff --git a/samples/schema/petstore/mysql/Model/SpecialModelName.sql b/samples/schema/petstore/mysql/Model/SpecialModelName.sql new file mode 100644 index 000000000000..adef5ac7123f --- /dev/null +++ b/samples/schema/petstore/mysql/Model/SpecialModelName.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for '_special_model.name_' definition. +-- + + +-- +-- SELECT template for table `_special_model.name_` +-- +SELECT `$special[property.name]` FROM `_special_model.name_` WHERE 1; + +-- +-- INSERT template for table `_special_model.name_` +-- +INSERT INTO `_special_model.name_`(`$special[property.name]`) VALUES (?); + +-- +-- UPDATE template for table `_special_model.name_` +-- +UPDATE `_special_model.name_` SET `$special[property.name]` = ? WHERE 1; + +-- +-- DELETE template for table `_special_model.name_` +-- +DELETE FROM `_special_model.name_` WHERE 0; + diff --git a/samples/schema/petstore/mysql/mysql_schema.sql b/samples/schema/petstore/mysql/mysql_schema.sql index 21198e1355ac..a0e04a9b0188 100644 --- a/samples/schema/petstore/mysql/mysql_schema.sql +++ b/samples/schema/petstore/mysql/mysql_schema.sql @@ -5,14 +5,6 @@ -- -------------------------------------------------------- --- --- Table structure for table `$special[model.name]` generated from model 'DollarspecialLeft_Square_BracketmodelPeriodnameRight_Square_Bracket' --- - -CREATE TABLE IF NOT EXISTS `$special[model.name]` ( - `$special[property.name]` BIGINT DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - -- -- Table structure for table `200_response` generated from model '200Underscoreresponse' -- Model for testing model name starting with number @@ -23,78 +15,13 @@ CREATE TABLE IF NOT EXISTS `200_response` ( `class` TEXT DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Model for testing model name starting with number'; --- --- Table structure for table `AdditionalPropertiesAnyType` generated from model 'AdditionalPropertiesAnyType' --- - -CREATE TABLE IF NOT EXISTS `AdditionalPropertiesAnyType` ( - `name` TEXT DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- --- Table structure for table `AdditionalPropertiesArray` generated from model 'AdditionalPropertiesArray' --- - -CREATE TABLE IF NOT EXISTS `AdditionalPropertiesArray` ( - `name` TEXT DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- --- Table structure for table `AdditionalPropertiesBoolean` generated from model 'AdditionalPropertiesBoolean' --- - -CREATE TABLE IF NOT EXISTS `AdditionalPropertiesBoolean` ( - `name` TEXT DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - -- -- Table structure for table `AdditionalPropertiesClass` generated from model 'AdditionalPropertiesClass' -- CREATE TABLE IF NOT EXISTS `AdditionalPropertiesClass` ( - `map_string` JSON DEFAULT NULL, - `map_number` JSON DEFAULT NULL, - `map_integer` JSON DEFAULT NULL, - `map_boolean` JSON DEFAULT NULL, - `map_array_integer` JSON DEFAULT NULL, - `map_array_anytype` JSON DEFAULT NULL, - `map_map_string` JSON DEFAULT NULL, - `map_map_anytype` JSON DEFAULT NULL, - `anytype_1` JSON DEFAULT NULL, - `anytype_2` JSON DEFAULT NULL, - `anytype_3` JSON DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- --- Table structure for table `AdditionalPropertiesInteger` generated from model 'AdditionalPropertiesInteger' --- - -CREATE TABLE IF NOT EXISTS `AdditionalPropertiesInteger` ( - `name` TEXT DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- --- Table structure for table `AdditionalPropertiesNumber` generated from model 'AdditionalPropertiesNumber' --- - -CREATE TABLE IF NOT EXISTS `AdditionalPropertiesNumber` ( - `name` TEXT DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- --- Table structure for table `AdditionalPropertiesObject` generated from model 'AdditionalPropertiesObject' --- - -CREATE TABLE IF NOT EXISTS `AdditionalPropertiesObject` ( - `name` TEXT DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- --- Table structure for table `AdditionalPropertiesString` generated from model 'AdditionalPropertiesString' --- - -CREATE TABLE IF NOT EXISTS `AdditionalPropertiesString` ( - `name` TEXT DEFAULT NULL + `map_property` JSON DEFAULT NULL, + `map_of_map_property` JSON DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- @@ -142,25 +69,6 @@ CREATE TABLE IF NOT EXISTS `ArrayTest` ( `array_array_of_model` JSON DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; --- --- Table structure for table `BigCat` generated from model 'BigCat' --- - -CREATE TABLE IF NOT EXISTS `BigCat` ( - `className` TEXT NOT NULL, - `color` TEXT, - `declawed` TINYINT(1) DEFAULT NULL, - `kind` ENUM('lions', 'tigers', 'leopards', 'jaguars') DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- --- Table structure for table `BigCat_allOf` generated from model 'BigCatUnderscoreallOf' --- - -CREATE TABLE IF NOT EXISTS `BigCat_allOf` ( - `kind` ENUM('lions', 'tigers', 'leopards', 'jaguars') DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - -- -- Table structure for table `Capitalization` generated from model 'Capitalization' -- @@ -254,7 +162,10 @@ CREATE TABLE IF NOT EXISTS `Enum_Test` ( `enum_string_required` ENUM('UPPER', 'lower', '') NOT NULL, `enum_integer` ENUM('1', '-1') DEFAULT NULL, `enum_number` ENUM('1.1', '-1.2') DEFAULT NULL, - `outerEnum` TEXT DEFAULT NULL + `outerEnum` TEXT DEFAULT NULL, + `outerEnumInteger` TEXT DEFAULT NULL, + `outerEnumDefaultValue` TEXT DEFAULT NULL, + `outerEnumIntegerDefaultValue` TEXT DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- @@ -275,6 +186,14 @@ CREATE TABLE IF NOT EXISTS `FileSchemaTestClass` ( `files` JSON DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- Table structure for table `Foo` generated from model 'Foo' +-- + +CREATE TABLE IF NOT EXISTS `Foo` ( + `bar` TEXT +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `format_test` generated from model 'formatUnderscoretest' -- @@ -293,7 +212,8 @@ CREATE TABLE IF NOT EXISTS `format_test` ( `dateTime` DATETIME DEFAULT NULL, `uuid` TEXT DEFAULT NULL, `password` VARCHAR(64) NOT NULL, - `BigDecimal` DECIMAL(20, 9) DEFAULT NULL + `pattern_with_digits` TEXT DEFAULT NULL COMMENT 'A string that is a 10 digit number. Can have leading zeros.', + `pattern_with_digits_and_delimiter` TEXT DEFAULT NULL COMMENT 'A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- @@ -305,6 +225,89 @@ CREATE TABLE IF NOT EXISTS `hasOnlyReadOnly` ( `foo` TEXT DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- Table structure for table `HealthCheckResult` generated from model 'HealthCheckResult' +-- Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +-- + +CREATE TABLE IF NOT EXISTS `HealthCheckResult` ( + `NullableMessage` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.'; + +-- +-- Table structure for table `inline_object` generated from model 'inlineUnderscoreobject' +-- + +CREATE TABLE IF NOT EXISTS `inline_object` ( + `name` TEXT DEFAULT NULL COMMENT 'Updated name of the pet', + `status` TEXT DEFAULT NULL COMMENT 'Updated status of the pet' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `inline_object_1` generated from model 'inlineUnderscoreobjectUnderscore1' +-- + +CREATE TABLE IF NOT EXISTS `inline_object_1` ( + `additionalMetadata` TEXT DEFAULT NULL COMMENT 'Additional data to pass to server', + `file` MEDIUMBLOB DEFAULT NULL COMMENT 'file to upload' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `inline_object_2` generated from model 'inlineUnderscoreobjectUnderscore2' +-- + +CREATE TABLE IF NOT EXISTS `inline_object_2` ( + `enum_form_string_array` JSON DEFAULT NULL COMMENT 'Form parameter enum test (string array)', + `enum_form_string` ENUM('_abc', '-efg', '(xyz)') DEFAULT '-efg' COMMENT 'Form parameter enum test (string)' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `inline_object_3` generated from model 'inlineUnderscoreobjectUnderscore3' +-- + +CREATE TABLE IF NOT EXISTS `inline_object_3` ( + `integer` TINYINT UNSIGNED DEFAULT NULL COMMENT 'None', + `int32` TINYINT UNSIGNED DEFAULT NULL COMMENT 'None', + `int64` BIGINT DEFAULT NULL COMMENT 'None', + `number` DECIMAL(20, 9) UNSIGNED NOT NULL COMMENT 'None', + `float` DECIMAL(20, 9) DEFAULT NULL COMMENT 'None', + `double` DECIMAL(20, 9) UNSIGNED NOT NULL COMMENT 'None', + `string` TEXT DEFAULT NULL COMMENT 'None', + `pattern_without_delimiter` TEXT NOT NULL COMMENT 'None', + `byte` MEDIUMBLOB NOT NULL COMMENT 'None', + `binary` MEDIUMBLOB DEFAULT NULL COMMENT 'None', + `date` DATE DEFAULT NULL COMMENT 'None', + `dateTime` DATETIME DEFAULT NULL COMMENT 'None', + `password` VARCHAR(64) DEFAULT NULL COMMENT 'None', + `callback` TEXT DEFAULT NULL COMMENT 'None' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `inline_object_4` generated from model 'inlineUnderscoreobjectUnderscore4' +-- + +CREATE TABLE IF NOT EXISTS `inline_object_4` ( + `param` TEXT NOT NULL COMMENT 'field1', + `param2` TEXT NOT NULL COMMENT 'field2' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `inline_object_5` generated from model 'inlineUnderscoreobjectUnderscore5' +-- + +CREATE TABLE IF NOT EXISTS `inline_object_5` ( + `additionalMetadata` TEXT DEFAULT NULL COMMENT 'Additional data to pass to server', + `requiredFile` MEDIUMBLOB NOT NULL COMMENT 'file to upload' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `inline_response_default` generated from model 'inlineUnderscoreresponseUnderscoredefault' +-- + +CREATE TABLE IF NOT EXISTS `inline_response_default` ( + `string` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `List` generated from model 'List' -- @@ -346,6 +349,25 @@ CREATE TABLE IF NOT EXISTS `Name` ( `123Number` INT DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Model for testing model name same as property name'; +-- +-- Table structure for table `NullableClass` generated from model 'NullableClass' +-- + +CREATE TABLE IF NOT EXISTS `NullableClass` ( + `integer_prop` INT DEFAULT NULL, + `number_prop` DECIMAL(20, 9) DEFAULT NULL, + `boolean_prop` TINYINT(1) DEFAULT NULL, + `string_prop` TEXT DEFAULT NULL, + `date_prop` DATE DEFAULT NULL, + `datetime_prop` DATETIME DEFAULT NULL, + `array_nullable_prop` JSON DEFAULT NULL, + `array_and_items_nullable_prop` JSON DEFAULT NULL, + `array_items_nullable` JSON DEFAULT NULL, + `object_nullable_prop` JSON DEFAULT NULL, + `object_and_items_nullable_prop` JSON DEFAULT NULL, + `object_items_nullable` JSON DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `NumberOnly` generated from model 'NumberOnly' -- @@ -408,6 +430,14 @@ CREATE TABLE IF NOT EXISTS `Return` ( `return` INT DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Model for testing reserved words'; +-- +-- Table structure for table `_special_model.name_` generated from model 'UnderscorespecialUnderscoremodelPeriodnameUnderscore' +-- + +CREATE TABLE IF NOT EXISTS `_special_model.name_` ( + `$special[property.name]` BIGINT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `Tag` generated from model 'Tag' -- @@ -417,31 +447,6 @@ CREATE TABLE IF NOT EXISTS `Tag` ( `name` TEXT DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; --- --- Table structure for table `TypeHolderDefault` generated from model 'TypeHolderDefault' --- - -CREATE TABLE IF NOT EXISTS `TypeHolderDefault` ( - `string_item` TEXT NOT NULL, - `number_item` DECIMAL(20, 9) NOT NULL, - `integer_item` INT NOT NULL, - `bool_item` TINYINT(1) NOT NULL, - `array_item` JSON NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- --- Table structure for table `TypeHolderExample` generated from model 'TypeHolderExample' --- - -CREATE TABLE IF NOT EXISTS `TypeHolderExample` ( - `string_item` TEXT NOT NULL, - `number_item` DECIMAL(20, 9) NOT NULL, - `float_item` DECIMAL(20, 9) NOT NULL, - `integer_item` INT NOT NULL, - `bool_item` TINYINT(1) NOT NULL, - `array_item` JSON NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - -- -- Table structure for table `User` generated from model 'User' -- @@ -457,42 +462,6 @@ CREATE TABLE IF NOT EXISTS `User` ( `userStatus` INT DEFAULT NULL COMMENT 'User Status' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; --- --- Table structure for table `XmlItem` generated from model 'XmlItem' --- - -CREATE TABLE IF NOT EXISTS `XmlItem` ( - `attribute_string` TEXT DEFAULT NULL, - `attribute_number` DECIMAL(20, 9) DEFAULT NULL, - `attribute_integer` INT DEFAULT NULL, - `attribute_boolean` TINYINT(1) DEFAULT NULL, - `wrapped_array` JSON DEFAULT NULL, - `name_string` TEXT DEFAULT NULL, - `name_number` DECIMAL(20, 9) DEFAULT NULL, - `name_integer` INT DEFAULT NULL, - `name_boolean` TINYINT(1) DEFAULT NULL, - `name_array` JSON DEFAULT NULL, - `name_wrapped_array` JSON DEFAULT NULL, - `prefix_string` TEXT DEFAULT NULL, - `prefix_number` DECIMAL(20, 9) DEFAULT NULL, - `prefix_integer` INT DEFAULT NULL, - `prefix_boolean` TINYINT(1) DEFAULT NULL, - `prefix_array` JSON DEFAULT NULL, - `prefix_wrapped_array` JSON DEFAULT NULL, - `namespace_string` TEXT DEFAULT NULL, - `namespace_number` DECIMAL(20, 9) DEFAULT NULL, - `namespace_integer` INT DEFAULT NULL, - `namespace_boolean` TINYINT(1) DEFAULT NULL, - `namespace_array` JSON DEFAULT NULL, - `namespace_wrapped_array` JSON DEFAULT NULL, - `prefix_ns_string` TEXT DEFAULT NULL, - `prefix_ns_number` DECIMAL(20, 9) DEFAULT NULL, - `prefix_ns_integer` INT DEFAULT NULL, - `prefix_ns_boolean` TINYINT(1) DEFAULT NULL, - `prefix_ns_array` JSON DEFAULT NULL, - `prefix_ns_wrapped_array` JSON DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - -- -- OAuth2 framework tables