Skip to content

ASPNET sample update #10249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions bin/aspnetcore-v2.2-petstore-server-interface-controller.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

SCRIPT="$0"

while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done

if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi

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

if [ ! -f "$executable" ]
then
mvn clean package
fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
ags="$@ generate -l aspnetcore -i modules/swagger-codegen/src/test/resources/3_0_0/petstore.yaml -o samples/server/petstore/aspnetcore-v2.2-interface-controller --interface-controller --aspnet-core-version 2.2"

java $JAVA_OPTS -jar $executable $ags
31 changes: 31 additions & 0 deletions bin/aspnetcore-v2.2-petstore-server-interface.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

SCRIPT="$0"

while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done

if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi

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

if [ ! -f "$executable" ]
then
mvn clean package
fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
ags="$@ generate -l aspnetcore -i modules/swagger-codegen/src/test/resources/3_0_0/petstore.yaml -o samples/server/petstore/aspnetcore-v2.2-interface --interface-only --aspnet-core-version 2.2"

java $JAVA_OPTS -jar $executable $ags
31 changes: 31 additions & 0 deletions bin/aspnetcore-v2.2-petstore-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

SCRIPT="$0"

while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done

if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi

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

if [ ! -f "$executable" ]
then
mvn clean package
fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
ags="$@ generate -l aspnetcore -i modules/swagger-codegen/src/test/resources/3_0_0/petstore.yaml -o samples/server/petstore/aspnetcore-v2.2 --aspnet-core-version 2.2"

java $JAVA_OPTS -jar $executable $ags
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# Visual Studio 15
VisualStudioVersion = 15.0.26114.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{2E40B6D4-6E18-49F1-9AB5-09A7632EE6CA}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{19CBD201-C545-44C5-B34D-1036EB6A3049}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2E40B6D4-6E18-49F1-9AB5-09A7632EE6CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E40B6D4-6E18-49F1-9AB5-09A7632EE6CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E40B6D4-6E18-49F1-9AB5-09A7632EE6CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E40B6D4-6E18-49F1-9AB5-09A7632EE6CA}.Release|Any CPU.Build.0 = Release|Any CPU
{19CBD201-C545-44C5-B34D-1036EB6A3049}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19CBD201-C545-44C5-B34D-1036EB6A3049}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19CBD201-C545-44C5-B34D-1036EB6A3049}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19CBD201-C545-44C5-B34D-1036EB6A3049}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "IO.Swagger.dll"]

ENTRYPOINT ["dotnet", "IO.Swagger.dll"]
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF
}
}
}
}
}
10 changes: 5 additions & 5 deletions samples/server/petstore/aspnetcore-interface-only/IO.Swagger.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# Visual Studio 15
VisualStudioVersion = 15.0.26114.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{B886EFE0-BE62-44D9-B491-7BFAB35169C8}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{A31D0ACE-54F0-4DF2-A17B-2EE10ECC2064}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B886EFE0-BE62-44D9-B491-7BFAB35169C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B886EFE0-BE62-44D9-B491-7BFAB35169C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B886EFE0-BE62-44D9-B491-7BFAB35169C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B886EFE0-BE62-44D9-B491-7BFAB35169C8}.Release|Any CPU.Build.0 = Release|Any CPU
{A31D0ACE-54F0-4DF2-A17B-2EE10ECC2064}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A31D0ACE-54F0-4DF2-A17B-2EE10ECC2064}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A31D0ACE-54F0-4DF2-A17B-2EE10ECC2064}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A31D0ACE-54F0-4DF2-A17B-2EE10ECC2064}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "IO.Swagger.dll"]

ENTRYPOINT ["dotnet", "IO.Swagger.dll"]
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.20-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26114.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{3D6655B2-F3B7-486E-A1EC-04086CB60E5E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3D6655B2-F3B7-486E-A1EC-04086CB60E5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D6655B2-F3B7-486E-A1EC-04086CB60E5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D6655B2-F3B7-486E-A1EC-04086CB60E5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D6655B2-F3B7-486E-A1EC-04086CB60E5E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# IO.Swagger - ASP.NET Core 2.0 Server

This is a sample Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).

## Run

Linux/OS X:

```
sh build.sh
```

Windows:

```
build.bat
```

## Run in Docker

```
cd src/IO.Swagger
docker build -t io.swagger .
docker run -p 5000:5000 io.swagger
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
:: Generated by: https://github.com/swagger-api/swagger-codegen.git
::

@echo off

dotnet restore src\IO.Swagger
dotnet build src\IO.Swagger
echo Now, run the following to start the project: dotnet run -p src\IO.Swagger\IO.Swagger.csproj --launch-profile web.
echo.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#

dotnet restore src/IO.Swagger/ && \
dotnet build src/IO.Swagger/ && \
echo "Now, run the following to start the project: dotnet run -p src/IO.Swagger/IO.Swagger.csproj --launch-profile web"
Loading