Skip to content

Commit

Permalink
New Release
Browse files Browse the repository at this point in the history
  • Loading branch information
wemogy-admin authored Nov 3, 2023
2 parents 04bd88d + df434c4 commit f0e8e1f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"generators"
],
"devDependencies": {
"@types/update-notifier": "^5.1.0",
"@types/glob": "^7.1.4",
"@types/lodash": "^4.14.168",
"@types/node": "^16.4.13",
"@types/update-notifier": "^5.1.0",
"@types/yeoman-generator": "5.2.2",
"@types/yosay": "^2.0.0",
"copyfiles": "^2.4.1",
Expand Down
28 changes: 24 additions & 4 deletions src/sdk-auto-generate-dotnet/templates/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,21 @@ packageName=$5

projectPath=$targetDirectory/$packageName

openApiConfigPath=$targetDirectory/.openapi-generator/csharp-netcore.yaml
openApiConfigPath=$targetDirectory/.openapi-generator/csharp.yaml

# Verify that openapi-generator is installed
if ! command -v openapi-generator &> /dev/null
then
echo "openapi-generator could not be found"
exit
fi

# Verify that openapi-generator version is 7.0.X
if [[ $(openapi-generator version) != 6.0.* ]];
then
echo "openapi-generator version 7.0.X is required"
exit
fi

# Create target path
mkdir -p $targetDirectory/.openapi-generator
Expand All @@ -34,7 +48,7 @@ dotnet build $webservice -c Release
openapi-generator generate \
-i $swagger \
-o $targetDirectory \
-g csharp-netcore \
-g csharp \
-c $openApiConfigPath

# Remove generated SLN
Expand Down Expand Up @@ -68,9 +82,15 @@ fi
# Add generated project to root sln
dotnet sln $solution add $projectPath/

# Discard changes made to csproj file
git checkout $projectPath/$packageName.csproj

# Install SpaceBlocks.Libs.Sdk into AutoGenerated project
dotnet add $projectPath/$packageName.csproj package SpaceBlocks.Libs.Sdk

# Remove the Newtonsoft.Json dependency because it is already included in SpaceBlocks.Libs.Sdk
dotnet remove $projectPath/$packageName.csproj package Newtonsoft.Json

# Place partial class ApiClient`.cs
cat > $projectPath/Client/ApiClient\`.cs <<EOF
using System;
Expand All @@ -91,8 +111,8 @@ namespace $packageName.Client
_apiKey = apiKey;
_accessTokenProvider =
authUrl != null && authenticationOptions != null
? new SpaceBlocksAccessTokenProvider(authUrl, authenticationOptions)
: null;
? new SpaceBlocksAccessTokenProvider(authUrl, authenticationOptions)
: null;
}
partial void InterceptRequest(RestRequest request)
Expand Down

0 comments on commit f0e8e1f

Please sign in to comment.