serve original openapi json

This commit is contained in:
2021-11-26 16:36:07 +01:00
parent 238821aed8
commit b0b286a5e7
5 changed files with 37 additions and 3 deletions

View File

@ -85,7 +85,9 @@ if [ "$STAGE2" = "1" ]; then
echo "patch DbService registering into generated startup code"
sed -i output/src/$PACKAGE_NAME/Startup.cs \
-e 's#\(using '$PACKAGE_NAME'.OpenApi;\)#\1\n\n// added by post-processor\nusing '$PACKAGE_NAME'.Services;\n#' \
-e 's#^\([[:space:]]*\)\(// Add framework services.\)#\1// added by post-processor\n\1services.AddTransient<IDbService, DbService>();\n\n\1\2#'
-e 's#^\([[:space:]]*\)\(// Add framework services.\)#\1// added by post-processor\n\1services.AddTransient<IDbService, DbService>();\n\n\1\2#' \
-e 's#\(c.RoutePrefix = "\)openapi\(";\)#\1'$ROUTE_PREFIX'/doc\2#' \
-e 's#\(app.UseHttpsRedirection();\)#// \1#'
echo "disable documentation warnings in generated code"
sed -i output/src/$PACKAGE_NAME/$PACKAGE_NAME.csproj \
@ -101,6 +103,7 @@ if [ "$STAGE2" = "1" ]; then
if [ -f regular.cs ]; then
echo "copy endpoint code into source code tree"
cp regular.cs output/src/$PACKAGE_NAME/Implementations
cp OpenAPIDocCtrl.cs output/src/$PACKAGE_NAME/Controllers
else
echo "implementation not available, forgot to run stage 1?"
fi