diff --git a/modules/swagger-codegen/src/main/resources/aspnetcore/Dockerfile.mustache b/modules/swagger-codegen/src/main/resources/aspnetcore/Dockerfile.mustache index 553d5ce5ce9..e9d80c52833 100644 --- a/modules/swagger-codegen/src/main/resources/aspnetcore/Dockerfile.mustache +++ b/modules/swagger-codegen/src/main/resources/aspnetcore/Dockerfile.mustache @@ -1,11 +1,18 @@ -FROM microsoft/dotnet:1.0.3-sdk-projectjson +FROM microsoft/aspnetcore-build:2.0 AS build-env +WORKDIR /app ENV DOTNET_CLI_TELEMETRY_OPTOUT 1 -WORKDIR /app/{{packageName}} -COPY . /app/{{packageName}} +# copy csproj and restore as distinct layers +COPY *.csproj ./ +RUN dotnet restore -EXPOSE 5000/tcp +# copy everything else and build +COPY . ./ +RUN dotnet publish -c Release -o out -RUN ["dotnet", "restore"] -ENTRYPOINT ["dotnet", "run", "-p", "project.json", "web"] +# build runtime image +FROM microsoft/aspnetcore:2.0 +WORKDIR /app +COPY --from=build-env /app/out . +ENTRYPOINT ["dotnet", "{{packageName}}.dll"] diff --git a/samples/server/petstore/aspnetcore/.swagger-codegen/VERSION b/samples/server/petstore/aspnetcore/.swagger-codegen/VERSION index 855ff9501eb..717311e32e3 100644 --- a/samples/server/petstore/aspnetcore/.swagger-codegen/VERSION +++ b/samples/server/petstore/aspnetcore/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +unset \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/PetApi.cs index 88dfc690ef1..e68878ee03f 100644 --- a/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/PetApi.cs +++ b/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/PetApi.cs @@ -92,7 +92,7 @@ namespace IO.Swagger.Controllers string exampleJson = null; exampleJson = "\n 123456789\n doggie\n \n aeiou\n \n \n \n aeiou\n"; - exampleJson = "[ {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}, {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n} ]"; + exampleJson = "[ {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}, {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n} ]"; var example = exampleJson != null ? JsonConvert.DeserializeObject>(exampleJson) @@ -123,7 +123,7 @@ namespace IO.Swagger.Controllers string exampleJson = null; exampleJson = "\n 123456789\n doggie\n \n aeiou\n \n \n \n aeiou\n"; - exampleJson = "[ {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}, {\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n} ]"; + exampleJson = "[ {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}, {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n} ]"; var example = exampleJson != null ? JsonConvert.DeserializeObject>(exampleJson) @@ -158,7 +158,7 @@ namespace IO.Swagger.Controllers string exampleJson = null; exampleJson = "\n 123456789\n doggie\n \n aeiou\n \n \n \n aeiou\n"; - exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}"; + exampleJson = "{\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}"; var example = exampleJson != null ? JsonConvert.DeserializeObject(exampleJson) @@ -234,7 +234,7 @@ namespace IO.Swagger.Controllers // return StatusCode(200, default(ApiResponse)); string exampleJson = null; - exampleJson = "{\n \"code\" : 0,\n \"type\" : \"type\",\n \"message\" : \"message\"\n}"; + exampleJson = "{\r\n \"code\" : 0,\r\n \"type\" : \"type\",\r\n \"message\" : \"message\"\r\n}"; var example = exampleJson != null ? JsonConvert.DeserializeObject(exampleJson) diff --git a/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/StoreApi.cs b/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/StoreApi.cs index d2ee6867e7f..9630f97869c 100644 --- a/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/StoreApi.cs +++ b/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/StoreApi.cs @@ -70,7 +70,7 @@ namespace IO.Swagger.Controllers // return StatusCode(200, default(Dictionary)); string exampleJson = null; - exampleJson = "{\n \"key\" : 0\n}"; + exampleJson = "{\r\n \"key\" : 0\r\n}"; var example = exampleJson != null ? JsonConvert.DeserializeObject>(exampleJson) @@ -105,7 +105,7 @@ namespace IO.Swagger.Controllers string exampleJson = null; exampleJson = "\n 123456789\n 123456789\n 123\n 2000-01-23T04:56:07.000Z\n aeiou\n true\n"; - exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}"; + exampleJson = "{\r\n \"petId\" : 6,\r\n \"quantity\" : 1,\r\n \"id\" : 0,\r\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"complete\" : false,\r\n \"status\" : \"placed\"\r\n}"; var example = exampleJson != null ? JsonConvert.DeserializeObject(exampleJson) @@ -136,7 +136,7 @@ namespace IO.Swagger.Controllers string exampleJson = null; exampleJson = "\n 123456789\n 123456789\n 123\n 2000-01-23T04:56:07.000Z\n aeiou\n true\n"; - exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}"; + exampleJson = "{\r\n \"petId\" : 6,\r\n \"quantity\" : 1,\r\n \"id\" : 0,\r\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"complete\" : false,\r\n \"status\" : \"placed\"\r\n}"; var example = exampleJson != null ? JsonConvert.DeserializeObject(exampleJson) diff --git a/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/UserApi.cs index 5a616057f9c..627c39bc46b 100644 --- a/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/UserApi.cs +++ b/samples/server/petstore/aspnetcore/src/IO.Swagger/Controllers/UserApi.cs @@ -115,7 +115,7 @@ namespace IO.Swagger.Controllers /// Get user by user name /// - /// The name that needs to be fetched. Use user1 for testing. + /// The name that needs to be fetched. Use user1 for testing. /// successful operation /// Invalid username supplied /// User not found @@ -137,7 +137,7 @@ namespace IO.Swagger.Controllers string exampleJson = null; exampleJson = "\n 123456789\n aeiou\n aeiou\n aeiou\n aeiou\n aeiou\n aeiou\n 123\n"; - exampleJson = "{\n \"firstName\" : \"firstName\",\n \"lastName\" : \"lastName\",\n \"password\" : \"password\",\n \"userStatus\" : 6,\n \"phone\" : \"phone\",\n \"id\" : 0,\n \"email\" : \"email\",\n \"username\" : \"username\"\n}"; + exampleJson = "{\r\n \"firstName\" : \"firstName\",\r\n \"lastName\" : \"lastName\",\r\n \"password\" : \"password\",\r\n \"userStatus\" : 6,\r\n \"phone\" : \"phone\",\r\n \"id\" : 0,\r\n \"email\" : \"email\",\r\n \"username\" : \"username\"\r\n}"; var example = exampleJson != null ? JsonConvert.DeserializeObject(exampleJson) diff --git a/samples/server/petstore/aspnetcore/src/IO.Swagger/Dockerfile b/samples/server/petstore/aspnetcore/src/IO.Swagger/Dockerfile index 66c2e7fdd23..6b07232e561 100644 --- a/samples/server/petstore/aspnetcore/src/IO.Swagger/Dockerfile +++ b/samples/server/petstore/aspnetcore/src/IO.Swagger/Dockerfile @@ -1,11 +1,18 @@ -FROM microsoft/dotnet:1.0.3-sdk-projectjson +FROM microsoft/aspnetcore-build:2.0 AS build-env +WORKDIR /app ENV DOTNET_CLI_TELEMETRY_OPTOUT 1 -WORKDIR /app/IO.Swagger -COPY . /app/IO.Swagger +# copy csproj and restore as distinct layers +COPY *.csproj ./ +RUN dotnet restore -EXPOSE 5000/tcp +# copy everything else and build +COPY . ./ +RUN dotnet publish -c Release -o out -RUN ["dotnet", "restore"] -ENTRYPOINT ["dotnet", "run", "-p", "project.json", "web"] +# build runtime image +FROM microsoft/aspnetcore:2.0 +WORKDIR /app +COPY --from=build-env /app/out . +ENTRYPOINT ["dotnet", "IO.Swagger.dll"] diff --git a/samples/server/petstore/aspnetcore/src/IO.Swagger/wwwroot/swagger-original.json b/samples/server/petstore/aspnetcore/src/IO.Swagger/wwwroot/swagger-original.json index 723ce2eb47a..d43d131d4de 100644 --- a/samples/server/petstore/aspnetcore/src/IO.Swagger/wwwroot/swagger-original.json +++ b/samples/server/petstore/aspnetcore/src/IO.Swagger/wwwroot/swagger-original.json @@ -563,7 +563,7 @@ "parameters" : [ { "name" : "username", "in" : "path", - "description" : "The name that needs to be fetched. Use user1 for testing. ", + "description" : "The name that needs to be fetched. Use user1 for testing.", "required" : true, "type" : "string" } ],