Skip to content

Commit 1686161

Browse files
committed
Updated generator.
1 parent bcd9da9 commit 1686161

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
This is the OpenAPI specification of the RabbitMQ HTTP API.
44

5+
Use [OpenAPI-Generator](https://github.com/OpenAPITools/openapi-generator) to build client and server stubs.
6+
To use ```generator.sh``` included in this project, you must have ```openapi-generator``` command installed on your build environment.
7+
You can also use the node version, to install: ```npm install @openapitools/openapi-generator-cli -g```.
8+
59
For more information, please refer to RabbitMQ [HTTP API](https://cdn.rawgit.com/rabbitmq/rabbitmq-management/v3.7.14/priv/www/api/index.html) official documentation.
610

711
---

generator.sh

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ command -v $GENERATOR >/dev/null 2>&1 || { echo >&2 "I require \"$GENERATOR\" bu
1111

1212
generate_aspnetcore() {
1313
CONFIG_FILE=aspnetcore.json
14-
DESTINATION_DIR=aspnetcore2
14+
DESTINATION_DIR=aspnetcore
1515
DESTINATION_TMP=generated/temp-aspnetcore
1616
# Remove previously generated files
1717
rm -f $CONFIG_FILE
@@ -20,7 +20,7 @@ generate_aspnetcore() {
2020
cat <<EOT >> $CONFIG_FILE
2121
{
2222
"packageName" : "$PACKAGE_NETCORE",
23-
"packageVersion": "1.0.0",
23+
"packageVersion": "1.0.2",
2424
"targetFramework": "netcoreapp2.0",
2525
"hideGenerationTimestamp": true,
2626
"sortParamsByRequiredFlag": true,
@@ -36,16 +36,14 @@ EOT
3636
openapi-generator generate -i $SOURCE_FILE -g csharp-netcore -o $DESTINATION_DIR -c $CONFIG_FILE
3737
openapi-generator generate -i $SOURCE_FILE -g openapi-yaml -o $DESTINATION_DIR/docs -c $CONFIG_FILE
3838
openapi-generator generate -i $SOURCE_FILE -g cwiki -o $DESTINATION_DIR/docs -c $CONFIG_FILE
39-
40-
# Customizations to generated artefacts
41-
sed -i '' 's#netcoreapp2.1#netcoreapp2.2#' $DESTINATION_DIR/src/$PACKAGE_NETCORE/$PACKAGE_NETCORE.csproj
42-
# Compatibility to 2.2
43-
sed -i '' 's#CompatibilityVersion.Version_2_1#CompatibilityVersion.Version_2_2#' $DESTINATION_DIR/src/$PACKAGE_NETCORE/Startup.cs
44-
# Default JSON serialisation preferences
45-
ex -s -c '24i|using Newtonsoft.Json;' -c x $DESTINATION_DIR/src/$PACKAGE_NETCORE/Startup.cs
46-
ex -s -c '59i| opts.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;' -c x $DESTINATION_DIR/src/$PACKAGE_NETCORE/Startup.cs
47-
ex -s -c '60i| opts.SerializerSettings.DateFormatHandling = DateFormatHandling.IsoDateFormat;' -c x $DESTINATION_DIR/src/$PACKAGE_NETCORE/Startup.cs
48-
ex -s -c '61i| opts.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;' -c x $DESTINATION_DIR/src/$PACKAGE_NETCORE/Startup.cs
39+
40+
# Post Generation Customize
41+
sed -i '' 's#<Authors>OpenAPI</Authors>#<Authors>Carlos Lozano Diez</Authors>#' $DESTINATION_DIR/src/$PACKAGE_NETCORE/$PACKAGE_NETCORE.csproj
42+
sed -i '' 's#<Company>OpenAPI</Company>#<Company>ThinkCode</Company>#' $DESTINATION_DIR/src/$PACKAGE_NETCORE/$PACKAGE_NETCORE.csproj
43+
sed -i '' 's#<AssemblyTitle>OpenAPI Library</AssemblyTitle>#<AssemblyTitle>Rabbitmq HTTP API Client</AssemblyTitle>#' $DESTINATION_DIR/src/$PACKAGE_NETCORE/$PACKAGE_NETCORE.csproj
44+
sed -i '' 's#<Copyright>No Copyright</Copyright>#<Copyright>Copyright 2019 Carlos Lozano Diez</Copyright>#' $DESTINATION_DIR/src/$PACKAGE_NETCORE/$PACKAGE_NETCORE.csproj
45+
sed -i '' 's#<Description>A library generated from a OpenAPI doc</Description>#<Description>RabbitMQ HTTP API Client for .netCore, tested with v3.7.x of RabbitMQ</Description>#' $DESTINATION_DIR/src/$PACKAGE_NETCORE/$PACKAGE_NETCORE.csproj
46+
4947
# .gitignore
5048
wget -O $DESTINATION_DIR/.gitignore "https://www.gitignore.io/api/java,maven,macos,aspnetcore,intellij+all,visualstudio,visualstudiocode"
5149
# Clean-up

0 commit comments

Comments
 (0)