Skip to content

Commit

Permalink
Fixes in security examples (OpenAPITools#396)
Browse files Browse the repository at this point in the history
* Regenerate "samples/client/petstore-security-test/java/okhttp-gson/"

* Use correct jar

* Fix sh scripts

* Fix path: modules/swagger-codegen => modules/openapi-generator/
  • Loading branch information
jmini authored and wing328 committed May 9, 2018
1 parent 4852434 commit 2ee05e1
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion bin/security/qt5cpp-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fi

# 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"
ags="$@ generate -t modules/openapi-generator/src/main/resources/qt5cpp -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -l qt5cpp -o samples/client/petstore-security-test/qt5cpp"
ags="$@ generate -t modules/openapi-generator/src/main/resources/qt5cpp -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -l cpp-qt5 -o samples/client/petstore-security-test/qt5cpp"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/security/scala-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fi

# 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"
ags="$@ generate -t modules/openapi-generator/src/main/resources/scala -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -l scala -o samples/client/petstore-security-test/scala"
ags="$@ generate -t modules/openapi-generator/src/main/resources/scala -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -l scala-httpclient -o samples/client/petstore-security-test/scala"

java $JAVA_OPTS -jar $executable $ags
2 changes: 1 addition & 1 deletion bin/security/swift-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ fi

# 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"
ags="$@ generate -t modules/openapi-generator/src/main/resources/swift -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -l swift -o samples/client/petstore-security-test/swift"
ags="$@ generate -t modules/openapi-generator/src/main/resources/swift -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -l swift2-deprecated -o samples/client/petstore-security-test/swift"

java $JAVA_OPTS -jar $executable $ags
4 changes: 2 additions & 2 deletions bin/security/typescript-inversify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`cd "${APP_DIR}"; pwd`
fi

executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"

if [ ! -f "$executable" ]
then
Expand All @@ -27,6 +27,6 @@ fi

# 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"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/typescript-inversify -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l typescript-inversify -o samples/client/petstore-security-test/typescript-inversify"
ags="$@ generate -t modules/openapi-generator/src/main/resources/typescript-inversify -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -l typescript-inversify -o samples/client/petstore-security-test/typescript-inversify"

java $JAVA_OPTS -jar $executable $ags
4 changes: 2 additions & 2 deletions bin/security/windows/csharp-petstore.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
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/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l csharp -o samples/client/petstore-security-test/csharp/SwaggerClient --additional-properties packageGuid={8CE139DF-64BC-4591-85F8-8506C2B67514}
set ags=generate -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -l csharp -o samples/client/petstore-security-test/csharp/SwaggerClient --additional-properties packageGuid={8CE139DF-64BC-4591-85F8-8506C2B67514}

java %JAVA_OPTS% -jar %executable% %ags%
4 changes: 2 additions & 2 deletions bin/security/windows/qt5cpp-petstore.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
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 -t modules/swagger-codegen/src/main/resources/qt5cpp -i modules\swagger-codegen\src\test\resources\2_0\petstore-security-test.yaml -l qt5cpp -o samples\client\petstore-security-test\qt5cpp
set ags=generate -t modules/openapi-generator/src/main/resources/qt5cpp -i modules\openapi-generator\src\test\resources\2_0\petstore-security-test.yaml -l qt5cpp -o samples\client\petstore-security-test\qt5cpp

java %JAVA_OPTS% -jar %executable% %ags%
4 changes: 2 additions & 2 deletions bin/windows/jaxrs-cxf-petstore-server.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
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 -DloggerPath=conf/log4j.properties
set ags=generate -t modules\swagger-codegen\src\main\resources\JavaJaxRS\cxf -i modules\swagger-codegen\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l jaxrs-cxf -o samples\server\petstore\jaxrs-cxf -DhideGenerationTimestamp=true
set ags=generate -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -l jaxrs-cxf -o samples\server\petstore\jaxrs-cxf -DhideGenerationTimestamp=true

java %JAVA_OPTS% -jar %executable% %ags%
4 changes: 2 additions & 2 deletions bin/windows/typescript-fetch-petstore-interfaces.bat
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@ECHO OFF

set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
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\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-fetch -o samples\client\petstore\typescript-fetch\builds\with-interfaces -D withInterfaces=true
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -l typescript-fetch -o samples\client\petstore\typescript-fetch\builds\with-interfaces -D withInterfaces=true

java %JAVA_OPTS% -jar %executable% %ags%
4 changes: 2 additions & 2 deletions bin/windows/typescript-inversify-petstore.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@ECHO OFF

set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar

If Not Exist %executable% (
mvn clean package
Expand All @@ -9,6 +9,6 @@ If Not Exist %executable% (
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M

echo
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-inversify -o samples\client\petstore\typescript-inversify\builds\default
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -l typescript-inversify -o samples\client\petstore\typescript-inversify\builds\default

java %JAVA_OPTS% -jar %executable% %ags%
4 changes: 2 additions & 2 deletions bin/windows/typescript-inversify.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
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\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-inversify -o samples\client\petstore\typescript-inversify
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -l typescript-inversify -o samples\client\petstore\typescript-inversify

java %JAVA_OPTS% -jar %executable% %ags%
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# petstore-okhttp-gson

Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
- API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
Expand Down Expand Up @@ -84,7 +84,7 @@ public class FakeApiExample {
public static void main(String[] args) {

FakeApi apiInstance = new FakeApi();
ERRORUNKNOWN UNKNOWN_BASE_TYPE = new UNKNOWN_BASE_TYPE(); // ERRORUNKNOWN |
Object UNKNOWN_BASE_TYPE = new UNKNOWN_BASE_TYPE(); // Object |
try {
apiInstance.testCodeInjectEndRnNR(UNKNOWN_BASE_TYPE);
} catch (ApiException e) {
Expand Down Expand Up @@ -135,5 +135,5 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea

## Author

[email protected] *_/ ' \" =end -- \\r\\n \\n \\r
[email protected] *_/ ' \" =end -- \\r\\n \\n \\r

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: [email protected] *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand All @@ -14,7 +14,6 @@
package org.openapitools.client.api;

import org.openapitools.client.ApiException;
import org.openapitools.client.model.ERRORUNKNOWN;
import org.junit.Test;
import org.junit.Ignore;

Expand Down Expand Up @@ -42,7 +41,7 @@ public class FakeApiTest {
*/
@Test
public void testCodeInjectEndRnNRTest() throws ApiException {
ERRORUNKNOWN UNKNOWN_BASE_TYPE = null;
Object UNKNOWN_BASE_TYPE = null;
api.testCodeInjectEndRnNR(UNKNOWN_BASE_TYPE);

// TODO: test validations
Expand Down

0 comments on commit 2ee05e1

Please sign in to comment.