Minor enhancements to the MySQL generator (#1148)

* minor enhancements to the mysql generator

* add ybelenko to the README
This commit is contained in:
William Cheng 2018-10-01 19:46:33 +08:00 committed by Yuriy Belenko
parent e4b5f50515
commit 3a5ec0a69d
4 changed files with 83 additions and 71 deletions

View File

@ -46,7 +46,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
**Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed), **Erlang**, **Go**, **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples)), **Kotlin** (Spring Boot), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** ([Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), Scalatra) **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed), **Erlang**, **Go**, **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples)), **Kotlin** (Spring Boot), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** ([Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), Scalatra)
**API documentation generators** | **HTML**, **Confluence Wiki** **API documentation generators** | **HTML**, **Confluence Wiki**
**Configuration files** | [**Apache2**](https://httpd.apache.org/) **Configuration files** | [**Apache2**](https://httpd.apache.org/)
**Others** | **JMeter** **Others** | **JMeter**, **MySQL Schema**
## Table of contents ## Table of contents
@ -603,6 +603,8 @@ Here is a list of template creators:
* Confluence Wiki: @jhitchcock * Confluence Wiki: @jhitchcock
* Configuration * Configuration
* Apache2: @stkrwork * Apache2: @stkrwork
* Schema
* MySQL: @ybelenko
#### How to join the core team #### How to join the core team

View File

@ -26,7 +26,7 @@ then
fi fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" 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/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g mysql-schema -o samples/schema/petstore/mysql $@"
java $JAVA_OPTS -jar $executable $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -0,0 +1,10 @@
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
If Not Exist %executable% (
mvn clean package
)
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
java %JAVA_OPTS% -jar %executable% %ags%

View File

@ -322,7 +322,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
columnDefinition.put("colDataType", "ENUM"); columnDefinition.put("colDataType", "ENUM");
columnDefinition.put("colDataTypeArguments", columnDataTypeArguments); columnDefinition.put("colDataTypeArguments", columnDataTypeArguments);
} else { } else {
if (dataFormat == "int64") { if ("int64".equals(dataFormat)) {
columnDefinition.put("colDataType", "BIGINT"); columnDefinition.put("colDataType", "BIGINT");
} else { } else {
Long min = (minimum != null) ? Long.parseLong(minimum) : null; Long min = (minimum != null) ? Long.parseLong(minimum) : null;