Skip to content

Commit 56da2c0

Browse files
authored
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
1 parent c95bc4d commit 56da2c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+666
-243
lines changed

bin/apache2-petstore-config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -g apache2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o samples/config/petstore/apache2 $@"
30+
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 $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

bin/avro-petstore.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
echo "# START SCRIPT: $SCRIPT"
5+
6+
while [ -h "$SCRIPT" ] ; do
7+
ls=`ls -ld "$SCRIPT"`
8+
link=`expr "$ls" : '.*-> \(.*\)$'`
9+
if expr "$link" : '/.*' > /dev/null; then
10+
SCRIPT="$link"
11+
else
12+
SCRIPT=`dirname "$SCRIPT"`/"$link"
13+
fi
14+
done
15+
16+
if [ ! -d "${APP_DIR}" ]; then
17+
APP_DIR=`dirname "$SCRIPT"`/..
18+
APP_DIR=`cd "${APP_DIR}"; pwd`
19+
fi
20+
21+
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
22+
23+
if [ ! -f "$executable" ]
24+
then
25+
mvn clean package
26+
fi
27+
28+
# if you've executed sbt assembly previously it will use that instead.
29+
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
30+
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 $@"
31+
32+
java $JAVA_OPTS -jar $executable $ags

bin/graphql-schema-petstore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@"
30-
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 $@"
30+
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 $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

bin/mysql-schema-petstore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
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 $@"
30+
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 $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

bin/protobuf-schema-petstore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@"
30-
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 $@"
30+
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 $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

bin/windows/apache2-petstore-config.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ If Not Exist %executable% (
55
)
66

77
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
8-
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g apache2 -o samples\config\petstore\apache2\
8+
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\
99

1010
java %JAVA_OPTS% -jar %executable% %ags%

bin/windows/graphql-schema-petstore.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ If Not Exist %executable% (
55
)
66

77
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
8-
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
8+
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
99

1010
java %JAVA_OPTS% -jar %executable% %ags%

bin/windows/mysql-schema-petstore.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ If Not Exist %executable% (
55
)
66

77
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
8-
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
8+
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
99

1010
java %JAVA_OPTS% -jar %executable% %ags%
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.3-SNAPSHOT
1+
5.0.0-SNAPSHOT

samples/config/petstore/apache2/PetApi.conf

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Location "/v2/pet">
1+
<Location "/v2/pet/pet/">
22
AuthBasicProvider file
33
AuthUserFile "/var/www/html/htpwd"
44
AuthGroupFile "/var/www/html/groups"
@@ -16,7 +16,7 @@
1616
Require group read:pets
1717
</Limit>
1818
</Location>
19-
<Location "/v2/pet/*">
19+
<Location "/v2/pet/{petId}/pet/*/">
2020
AuthBasicProvider file
2121
AuthUserFile "/var/www/html/htpwd"
2222
AuthGroupFile "/var/www/html/groups"
@@ -34,7 +34,7 @@
3434
Require group read:pets
3535
</Limit>
3636
</Location>
37-
<Location "/v2/pet/findByStatus">
37+
<Location "/v2/pet/findByStatus/pet/findByStatus/">
3838
AuthBasicProvider file
3939
AuthUserFile "/var/www/html/htpwd"
4040
AuthGroupFile "/var/www/html/groups"
@@ -44,11 +44,10 @@
4444
Require valid-user
4545
</LimitExcept>
4646
<Limit GET>
47-
Require group write:pets
4847
Require group read:pets
4948
</Limit>
5049
</Location>
51-
<Location "/v2/pet/findByTags">
50+
<Location "/v2/pet/findByTags/pet/findByTags/">
5251
AuthBasicProvider file
5352
AuthUserFile "/var/www/html/htpwd"
5453
AuthGroupFile "/var/www/html/groups"
@@ -58,11 +57,10 @@
5857
Require valid-user
5958
</LimitExcept>
6059
<Limit GET>
61-
Require group write:pets
6260
Require group read:pets
6361
</Limit>
6462
</Location>
65-
<Location "/v2/pet/*/uploadImage">
63+
<Location "/v2/pet/{petId}/uploadImage/pet/*/uploadImage/">
6664
AuthBasicProvider file
6765
AuthUserFile "/var/www/html/htpwd"
6866
AuthGroupFile "/var/www/html/groups"

0 commit comments

Comments
 (0)