diff --git a/bin/all-petstore.sh b/bin/all-petstore.sh
index 5ca48a53ae0..62dfae74542 100755
--- a/bin/all-petstore.sh
+++ b/bin/all-petstore.sh
@@ -20,6 +20,7 @@ fi
cd $APP_DIR
./bin/akka-scala-petstore.sh
./bin/android-petstore.sh
+./bin/aspnet5-petstore-server.sh
./bin/clojure-petstore.sh
./bin/csharp-petstore.sh
./bin/dynamic-html.sh
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java
index 099d049707b..8b73275984a 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AspNet5ServerCodegen.java
@@ -84,14 +84,22 @@ public void processOpts() {
apiPackage = packageName + ".Controllers";
modelPackage = packageName + ".Models";
+ supportingFiles.add(new SupportingFile("NuGet.Config", "", "NuGet.Config"));
supportingFiles.add(new SupportingFile("global.json", "", "global.json"));
- supportingFiles.add(new SupportingFile("build.mustache", "", "build.sh"));
+ supportingFiles.add(new SupportingFile("build.sh.mustache", "", "build.sh"));
+ supportingFiles.add(new SupportingFile("build.bat.mustache", "", "build.bat"));
+ supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
+ supportingFiles.add(new SupportingFile("Solution.mustache", "", this.packageName + ".sln"));
supportingFiles.add(new SupportingFile("Dockerfile.mustache", this.sourceFolder, "Dockerfile"));
supportingFiles.add(new SupportingFile("gitignore", this.sourceFolder, ".gitignore"));
supportingFiles.add(new SupportingFile("appsettings.json", this.sourceFolder, "appsettings.json"));
- supportingFiles.add(new SupportingFile("project.mustache", this.sourceFolder, "project.json"));
+ supportingFiles.add(new SupportingFile("project.json.mustache", this.sourceFolder, "project.json"));
supportingFiles.add(new SupportingFile("Startup.mustache", this.sourceFolder, "Startup.cs"));
+ supportingFiles.add(new SupportingFile("Program.mustache", this.sourceFolder, "Program.cs"));
+ supportingFiles.add(new SupportingFile("web.config", this.sourceFolder, "web.config"));
+
+ supportingFiles.add(new SupportingFile("Project.xproj.mustache", this.sourceFolder, this.packageName + ".xproj"));
supportingFiles.add(new SupportingFile("Properties" + File.separator + "launchSettings.json", this.sourceFolder + File.separator + "Properties", "launchSettings.json"));
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/Dockerfile.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/Dockerfile.mustache
index 8ff1b8faeed..0765ead2db2 100644
--- a/modules/swagger-codegen/src/main/resources/aspnet5/Dockerfile.mustache
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/Dockerfile.mustache
@@ -1,10 +1,12 @@
-FROM microsoft/aspnet:1.0.0-rc1-final
+FROM microsoft/dotnet:latest
+
+ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
RUN mkdir -p /app/{{packageName}}
COPY . /app/{{packageName}}
WORKDIR /app/{{packageName}}
-RUN ["dnu", "restore"]
-RUN ["dnu", "pack", "--out", "artifacts"]
EXPOSE 5000/tcp
-ENTRYPOINT ["dnx", "-p", "project.json", "web"]
+
+RUN ["dotnet", "restore"]
+ENTRYPOINT ["dotnet", "run", "-p", "project.json", "web"]
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/NuGet.Config b/modules/swagger-codegen/src/main/resources/aspnet5/NuGet.Config
new file mode 100644
index 00000000000..01f3d1f203f
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/NuGet.Config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/Program.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/Program.mustache
new file mode 100644
index 00000000000..ab465c42516
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/Program.mustache
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Builder;
+
+namespace {{packageName}}
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ var host = new WebHostBuilder()
+ .UseKestrel(options =>
+ {
+ // options.ThreadCount = 4;
+ // options.UseHttps("cert.pfx", "certpassword");
+ options.NoDelay = true;
+ options.UseConnectionLogging();
+ })
+ .UseUrls("http://+:5000" /*, "https://+:5001" */)
+ .UseContentRoot(Directory.GetCurrentDirectory())
+ .UseIISIntegration()
+ .UseStartup()
+ .Build();
+
+ host.Run();
+ }
+ }
+}
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/Project.xproj.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/Project.xproj.mustache
new file mode 100644
index 00000000000..22123b97009
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/Project.xproj.mustache
@@ -0,0 +1,19 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ {{projectGuid}}
+ Sample
+ .\obj
+ .\bin\
+ v4.6
+
+
+ 2.0
+
+
+
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/Properties/launchSettings.json b/modules/swagger-codegen/src/main/resources/aspnet5/Properties/launchSettings.json
index 7d41a0f84b9..45a5f3319a5 100644
--- a/modules/swagger-codegen/src/main/resources/aspnet5/Properties/launchSettings.json
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/Properties/launchSettings.json
@@ -1,12 +1,28 @@
{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:50352/",
+ "sslPort": 0
+ }
+ },
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
- "launchUrl": "swagger/ui",
+ "launchUrl": "swagger/ui/index.html",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "web": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "launchUrl": "http://localhost:5000/swagger/ui/index.html",
"environmentVariables": {
- "ASPNET_ENV": "Development"
+ "ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/README.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/README.mustache
new file mode 100644
index 00000000000..451508ad676
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/README.mustache
@@ -0,0 +1,27 @@
+# {{packageName}} - ASP.NET Core 1.0 Server
+
+{{#appDescription}}
+{{{appDescription}}}
+{{/appDescription}}
+
+## Run
+
+Linux/OS X:
+
+```
+sh build.sh
+```
+
+Windows:
+
+```
+build.bat
+```
+
+## Run in Docker
+
+```
+cd src/{{packageName}}
+docker build -t {{packageName}} .
+docker run -p 5000:5000 {{packageName}}
+```
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/Solution.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/Solution.mustache
new file mode 100644
index 00000000000..4ea98f8e492
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/Solution.mustache
@@ -0,0 +1,32 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{815BE834-0656-4C12-84A4-43F2BA4B8BDE}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AFF6BF88-8A7D-4736-AF81-31BCE86B19BD}"
+ ProjectSection(SolutionItems) = preProject
+ global.json = global.json
+ EndProjectSection
+EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "{{packageName}}", "src\{{packageName}}\{{packageName}}.xproj", "{{packageGuid}}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3B5990B3-40F1-4148-89B5-84AC71432557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3B5990B3-40F1-4148-89B5-84AC71432557}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3B5990B3-40F1-4148-89B5-84AC71432557}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3B5990B3-40F1-4148-89B5-84AC71432557}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {{packageGuid}} = {815BE834-0656-4C12-84A4-43F2BA4B8BDE}
+ EndGlobalSection
+EndGlobal
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/Startup.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/Startup.mustache
index c4e9d328cc7..80709bd068f 100644
--- a/modules/swagger-codegen/src/main/resources/aspnet5/Startup.mustache
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/Startup.mustache
@@ -1,136 +1,81 @@
+{{>partial_header}}
using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
-using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Hosting;
+using System.Threading.Tasks;
+using System.Xml.XPath;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.PlatformAbstractions;
using Newtonsoft.Json.Serialization;
-using Swashbuckle.SwaggerGen;
-using Swashbuckle.SwaggerGen.XmlComments;
+using Swashbuckle.Swagger.Model;
+using Swashbuckle.SwaggerGen.Annotations;
namespace {{packageName}}
{
public class Startup
{
private readonly IHostingEnvironment _hostingEnv;
- private readonly IApplicationEnvironment _appEnv;
- public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
+ public IConfigurationRoot Configuration { get; }
+
+ public Startup(IHostingEnvironment env)
{
_hostingEnv = env;
- _appEnv = appEnv;
- // Set up configuration sources.
var builder = new ConfigurationBuilder()
- .AddJsonFile("appsettings.json")
+ .SetBasePath(env.ContentRootPath)
+ .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
+ .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
-
- public IConfigurationRoot Configuration { get; set; }
-
+
+
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
- string xmlComments = string.Format(@"{0}{4}artifacts{4}{1}{4}{2}{3}{4}{{packageName}}.xml",
- GetSolutionBasePath(),
- _appEnv.Configuration,
- _appEnv.RuntimeFramework.Identifier.ToLower(),
- _appEnv.RuntimeFramework.Version.ToString().Replace(".", string.Empty),
- Path.DirectorySeparatorChar);
-
// Add framework services.
services.AddMvc()
.AddJsonOptions(
opts => { opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); });
-
- // Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
- // You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
- // services.AddWebApiConventions();
-
+
services.AddSwaggerGen();
- services.ConfigureSwaggerDocument(options =>
+
+ services.ConfigureSwaggerGen(options =>
{
options.SingleApiVersion(new Info
{
Version = "v1",
Title = "{{packageName}}",
- Description = "{{packageName}} (ASP.NET 5 Web API 2.x)"
+ Description = "{{packageName}} (ASP.NET Core 1.0)"
});
-
- options.OperationFilter(new ApplyXmlActionCommentsFixed(xmlComments));
- });
- services.ConfigureSwaggerSchema(options => {
- options.DescribeAllEnumsAsStrings = true;
- options.ModelFilter(new ApplyXmlTypeCommentsFixed(xmlComments));
+ options.DescribeAllEnumsAsStrings();
+
+ var comments = new XPathDocument($"{AppContext.BaseDirectory}{Path.DirectorySeparatorChar}{_hostingEnv.ApplicationName}.xml");
+ options.OperationFilter(comments);
+ options.ModelFilter(comments);
});
+
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
- loggerFactory.MinimumLevel = LogLevel.Information;
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
- app.UseIISPlatformHandler();
-
+ app.UseMvc();
+
app.UseDefaultFiles();
app.UseStaticFiles();
- app.UseMvc();
-
- app.UseSwaggerGen();
+ app.UseSwagger();
app.UseSwaggerUi();
}
-
- // Taken from https://github.com/domaindrivendev/Ahoy/blob/master/test/WebSites/Basic/Startup.cs
- private string GetSolutionBasePath()
- {
- var dir = Directory.CreateDirectory(_appEnv.ApplicationBasePath);
- while (dir.Parent != null)
- {
- if (dir.GetDirectories("artifacts").Any())
- return dir.FullName;
-
- dir = dir.Parent;
- }
- throw new InvalidOperationException("Failed to detect solution base path - artifacts not found. Did you run dnu pack --out artifacts?");
- }
-
- // Entry point for the application.
- public static void Main(string[] args) => WebApplication.Run(args);
- }
-
-
- // using Swashbuckle.SwaggerGen.XmlComments;
- public class ApplyXmlTypeCommentsFixed : ApplyXmlTypeComments
- {
- public ApplyXmlTypeCommentsFixed() : base("")
- {
- throw new NotImplementedException();
- }
-
- public ApplyXmlTypeCommentsFixed(string filePath): base(filePath)
- {
-
- }
- }
-
- public class ApplyXmlActionCommentsFixed : ApplyXmlActionComments
- {
- public ApplyXmlActionCommentsFixed() : base("")
- {
- throw new NotImplementedException();
- }
-
- public ApplyXmlActionCommentsFixed(string filePath): base(filePath)
- {
-
- }
}
-}
\ No newline at end of file
+}
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/appsettings.json b/modules/swagger-codegen/src/main/resources/aspnet5/appsettings.json
index e5472e562b7..c6af7d9b069 100644
--- a/modules/swagger-codegen/src/main/resources/aspnet5/appsettings.json
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/appsettings.json
@@ -2,7 +2,7 @@
"Logging": {
"IncludeScopes": false,
"LogLevel": {
- "Default": "Verbose",
+ "Default": "Information",
"System": "Information",
"Microsoft": "Information"
}
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/build.bat.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/build.bat.mustache
new file mode 100644
index 00000000000..b39b7232a1c
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/build.bat.mustache
@@ -0,0 +1,20 @@
+:: Generated by: https://github.com/swagger-api/swagger-codegen.git
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+:: http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+
+@echo off
+
+dotnet restore src\{{packageName}}
+dotnet build src\{{packageName}}
+echo Now, run the following to start the project: dotnet run -p src\{{packageName}}\project.json web.
+echo.
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/build.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/build.mustache
deleted file mode 100644
index 0a63bfeaf3d..00000000000
--- a/modules/swagger-codegen/src/main/resources/aspnet5/build.mustache
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env bash
-
-if ! type dnvm > /dev/null 2>&1; then
- source /usr/local/lib/dnx/bin/dnvm.sh
-fi
-
-if ! type dnu > /dev/null 2>&1 || [ -z "$SKIP_DNX_INSTALL" ]; then
- dnvm install latest -runtime coreclr -alias default
- dnvm install default -runtime mono -alias default
-else
- dnvm use default -runtime mono
-fi
-
-dnu restore src/{{packageName}}/ && \
- dnu build src/{{packageName}}/ && \
- dnu pack src/{{packageName}}/ --out artifacts && \
- echo "Now, run the following to start the project: dnx --project src/{{packageName}}/project.json web"
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/build.sh.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/build.sh.mustache
new file mode 100644
index 00000000000..179fe5fb61f
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/build.sh.mustache
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+#
+# Generated by: https://github.com/swagger-api/swagger-codegen.git
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+dotnet restore src/{{packageName}}/ && \
+ dotnet build src/{{packageName}}/ && \
+ echo "Now, run the following to start the project: dotnet run -p src/{{packageName}}/project.json web"
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/controller.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/controller.mustache
index 592ef42362b..bfeb2307ff8 100644
--- a/modules/swagger-codegen/src/main/resources/aspnet5/controller.mustache
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/controller.mustache
@@ -1,3 +1,4 @@
+{{>partial_header}}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -6,7 +7,7 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
-using Microsoft.AspNet.Mvc;
+using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Swashbuckle.SwaggerGen.Annotations;
using {{packageName}}.Models;
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/global.json b/modules/swagger-codegen/src/main/resources/aspnet5/global.json
index 4a6d1feac95..e5360d025ec 100644
--- a/modules/swagger-codegen/src/main/resources/aspnet5/global.json
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/global.json
@@ -1,8 +1,7 @@
{
- "projects": [ "src", "." ],
+ "projects": [ "src", "test" ],
"sdk": {
- "version": "1.0.0-rc1-final",
- "runtime": "coreclr",
- "architecture": "x64"
+ "version": "1.0.0-preview2-003121",
+ "runtime": "coreclr"
}
}
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/model.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/model.mustache
index 08aaed01f3d..5af9183b1dc 100644
--- a/modules/swagger-codegen/src/main/resources/aspnet5/model.mustache
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/model.mustache
@@ -1,3 +1,4 @@
+{{>partial_header}}
using System;
using System.Linq;
using System.IO;
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/partial_header.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/partial_header.mustache
new file mode 100644
index 00000000000..f7477da5c47
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/partial_header.mustache
@@ -0,0 +1,25 @@
+/*
+ {{#appName}}
+ * {{{appName}}}
+ *
+ {{/appName}}
+ {{#appDescription}}
+ * {{{appDescription}}}
+ *
+ {{/appDescription}}
+ * {{#version}}OpenAPI spec version: {{{version}}}{{/version}}
+ * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/project.json.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/project.json.mustache
new file mode 100644
index 00000000000..432ba86d5a9
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/project.json.mustache
@@ -0,0 +1,88 @@
+{
+ "title": "Swagger UI",
+ "version": "{{packageVersion}}-*",
+ "copyright": "{{packageName}}",
+ "description": "{{packageName}}",
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "version": "1.0.0",
+ "type": "platform"
+ },
+ "Microsoft.AspNetCore.Mvc": "1.0.0",
+ "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
+ "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
+ "Microsoft.AspNetCore.Server.Kestrel.Https": "1.0.0",
+ "Microsoft.AspNetCore.StaticFiles": "1.0.0",
+ "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
+ "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
+ "Microsoft.Extensions.Configuration.Json": "1.0.0",
+ "Microsoft.Extensions.Logging": "1.0.0",
+ "Microsoft.Extensions.Logging.Console": "1.0.0",
+ "Microsoft.Extensions.Logging.Debug": "1.0.0",
+ "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
+ "Microsoft.EntityFrameworkCore": "1.0.0",
+ "Swashbuckle.SwaggerGen": "6.0.0-beta901",
+ "Swashbuckle.SwaggerUi": "6.0.0-beta901"
+ },
+
+ "tools": {
+ "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
+
+ "Microsoft.Extensions.SecretManager.Tools": {
+ "imports": [
+ "netstandard1.6",
+ "portable-net45+win8+dnxcore50",
+ "portable-net45+win8"
+ ],
+ "version": "1.0.0-preview2-final"
+ }
+ },
+
+ "frameworks": {
+ "netcoreapp1.0": {
+ "imports": [
+ "dotnet5.6",
+ "dnxcore50",
+ "netstandard1.6",
+ "portable-net452+win81"
+ ]
+ }
+ },
+
+ "buildOptions": {
+ "emitEntryPoint": true,
+ "preserveCompilationContext": true,
+ "xmlDoc": true,
+ "compile": {
+ "exclude": [
+ "wwwroot",
+ "node_modules",
+ "bower_components"
+ ]
+ }
+ },
+
+ "runtimeOptions": {
+ "configProperties": {
+ "System.GC.Server": true
+ }
+ },
+
+ "publishOptions": {
+ "include": [
+ "wwwroot",
+ "Views",
+ "Areas/**/Views",
+ "appsettings.json",
+ "web.config"
+ ],
+ "exclude": [
+ "**.user",
+ "**.vspscc"
+ ]
+ },
+
+ "scripts": {
+ "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
+ }
+}
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/project.mustache b/modules/swagger-codegen/src/main/resources/aspnet5/project.mustache
deleted file mode 100644
index 018084bc7e1..00000000000
--- a/modules/swagger-codegen/src/main/resources/aspnet5/project.mustache
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "version": "{{packageVersion}}-*",
- "compilationOptions": {
- "emitEntryPoint": true
- },
- "tooling": {
- "defaultNamespace": "{{packageName}}"
- },
-
- "dependencies": {
- "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
- "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
- "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
- "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
- "Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-final",
- "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
- "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
- "Microsoft.Extensions.Logging.Debug" : "1.0.0-rc1-final",
- "Swashbuckle.SwaggerGen": "6.0.0-rc1-final",
- "Swashbuckle.SwaggerUi": "6.0.0-rc1-final"
- },
-
- "commands": {
- "web": "Microsoft.AspNet.Server.Kestrel --server.urls http://0.0.0.0:5000"
- },
-
- "frameworks": {
- "dnx451": { },
- "dnxcore50": { }
- },
-
- "exclude": [
- "wwwroot",
- "node_modules",
- "bower_components"
- ],
- "publishExclude": [
- "**.user",
- "**.vspscc"
- ]
-}
diff --git a/modules/swagger-codegen/src/main/resources/aspnet5/web.config b/modules/swagger-codegen/src/main/resources/aspnet5/web.config
new file mode 100644
index 00000000000..a3b9f6add9c
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/aspnet5/web.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/server/petstore/aspnet5/.gitignore b/samples/server/petstore/aspnet5/.gitignore
deleted file mode 100644
index e4349f244a1..00000000000
--- a/samples/server/petstore/aspnet5/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-artifacts/
\ No newline at end of file
diff --git a/samples/server/petstore/aspnet5/.swagger-codegen-ignore b/samples/server/petstore/aspnet5/.swagger-codegen-ignore
new file mode 100644
index 00000000000..c5fa491b4c5
--- /dev/null
+++ b/samples/server/petstore/aspnet5/.swagger-codegen-ignore
@@ -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
diff --git a/samples/server/petstore/aspnet5/IO.Swagger.sln b/samples/server/petstore/aspnet5/IO.Swagger.sln
new file mode 100644
index 00000000000..5337cb4c2cb
--- /dev/null
+++ b/samples/server/petstore/aspnet5/IO.Swagger.sln
@@ -0,0 +1,32 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{815BE834-0656-4C12-84A4-43F2BA4B8BDE}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AFF6BF88-8A7D-4736-AF81-31BCE86B19BD}"
+ ProjectSection(SolutionItems) = preProject
+ global.json = global.json
+ EndProjectSection
+EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.xproj", ""
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3B5990B3-40F1-4148-89B5-84AC71432557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3B5990B3-40F1-4148-89B5-84AC71432557}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3B5990B3-40F1-4148-89B5-84AC71432557}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3B5990B3-40F1-4148-89B5-84AC71432557}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ = {815BE834-0656-4C12-84A4-43F2BA4B8BDE}
+ EndGlobalSection
+EndGlobal
\ No newline at end of file
diff --git a/samples/server/petstore/aspnet5/LICENSE b/samples/server/petstore/aspnet5/LICENSE
new file mode 100644
index 00000000000..8dada3edaf5
--- /dev/null
+++ b/samples/server/petstore/aspnet5/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/samples/server/petstore/aspnet5/NuGet.Config b/samples/server/petstore/aspnet5/NuGet.Config
new file mode 100644
index 00000000000..01f3d1f203f
--- /dev/null
+++ b/samples/server/petstore/aspnet5/NuGet.Config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/samples/server/petstore/aspnet5/README.md b/samples/server/petstore/aspnet5/README.md
new file mode 100644
index 00000000000..2bdca9e4d48
--- /dev/null
+++ b/samples/server/petstore/aspnet5/README.md
@@ -0,0 +1,7 @@
+# {{packageName}} - ASP.NET Core 1.0 Server
+
+{{#appDescription}}
+{{{appDescription}}}
+{{/appDescription}}
+
+
diff --git a/samples/server/petstore/aspnet5/build.bat b/samples/server/petstore/aspnet5/build.bat
new file mode 100644
index 00000000000..85f9c4463e7
--- /dev/null
+++ b/samples/server/petstore/aspnet5/build.bat
@@ -0,0 +1,20 @@
+:: Generated by: https://github.com/swagger-api/swagger-codegen.git
+::
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+:: http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+
+@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\project.json web.
+echo.
diff --git a/samples/server/petstore/aspnet5/build.sh b/samples/server/petstore/aspnet5/build.sh
old mode 100755
new mode 100644
index 5d6402baee7..f7592a16bb0
--- a/samples/server/petstore/aspnet5/build.sh
+++ b/samples/server/petstore/aspnet5/build.sh
@@ -1,17 +1,19 @@
#!/usr/bin/env bash
+#
+# Generated by: https://github.com/swagger-api/swagger-codegen.git
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
-if ! type dnvm > /dev/null 2>&1; then
- source /usr/local/lib/dnx/bin/dnvm.sh
-fi
-
-if ! type dnu > /dev/null 2>&1 || [ -z "$SKIP_DNX_INSTALL" ]; then
- dnvm install latest -runtime coreclr -alias default
- dnvm install default -runtime mono -alias default
-else
- dnvm use default -runtime mono
-fi
-
-dnu restore src/IO.Swagger/ && \
- dnu build src/IO.Swagger/ && \
- dnu pack src/IO.Swagger/ --out artifacts && \
- echo "Now, run the following to start the project: dnx --project src/IO.Swagger/project.json web"
\ No newline at end of file
+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/project.json web"
\ No newline at end of file
diff --git a/samples/server/petstore/aspnet5/global.json b/samples/server/petstore/aspnet5/global.json
index 4a6d1feac95..e5360d025ec 100644
--- a/samples/server/petstore/aspnet5/global.json
+++ b/samples/server/petstore/aspnet5/global.json
@@ -1,8 +1,7 @@
{
- "projects": [ "src", "." ],
+ "projects": [ "src", "test" ],
"sdk": {
- "version": "1.0.0-rc1-final",
- "runtime": "coreclr",
- "architecture": "x64"
+ "version": "1.0.0-preview2-003121",
+ "runtime": "coreclr"
}
}
\ No newline at end of file
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/PetApi.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/PetApi.cs
index 18fefec1cba..8b6c8f3e09f 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/PetApi.cs
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/PetApi.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This is a sample server 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/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -6,7 +28,7 @@
using System.Linq;
using System.Net;
using System.Threading.Tasks;
-using Microsoft.AspNet.Mvc;
+using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Swashbuckle.SwaggerGen.Annotations;
using IO.Swagger.Models;
@@ -53,7 +75,7 @@ public virtual void DeletePet([FromRoute]long? petId, [FromHeader]string apiKey)
///
/// Finds Pets by status
///
- /// Multiple status values can be provided with comma seperated strings
+ /// Multiple status values can be provided with comma separated strings
/// Status values that need to be considered for filter
/// successful operation
/// Invalid status value
@@ -75,7 +97,7 @@ public virtual IActionResult FindPetsByStatus([FromQuery]List status)
///
/// Finds Pets by tags
///
- /// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
+ /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
/// Tags to filter by
/// successful operation
/// Invalid tag value
@@ -97,8 +119,8 @@ public virtual IActionResult FindPetsByTags([FromQuery]List tags)
///
/// Find pet by ID
///
- /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- /// ID of pet that needs to be fetched
+ /// Returns a single pet
+ /// ID of pet to return
/// successful operation
/// Invalid ID supplied
/// Pet not found
@@ -145,7 +167,7 @@ public virtual void UpdatePet([FromBody]Pet body)
[HttpPost]
[Route("/pet/{petId}")]
[SwaggerOperation("UpdatePetWithForm")]
- public virtual void UpdatePetWithForm([FromRoute]string petId, [FromForm]string name, [FromForm]string status)
+ public virtual void UpdatePetWithForm([FromRoute]long? petId, [FromForm]string name, [FromForm]string status)
{
throw new NotImplementedException();
}
@@ -158,13 +180,19 @@ public virtual void UpdatePetWithForm([FromRoute]string petId, [FromForm]string
/// ID of pet to update
/// Additional data to pass to server
/// file to upload
- /// successful operation
+ /// successful operation
[HttpPost]
[Route("/pet/{petId}/uploadImage")]
[SwaggerOperation("UploadFile")]
- public virtual void UploadFile([FromRoute]long? petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file)
+ [SwaggerResponse(200, type: typeof(ApiResponse))]
+ public virtual IActionResult UploadFile([FromRoute]long? petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file)
{
- throw new NotImplementedException();
+ string exampleJson = null;
+
+ var example = exampleJson != null
+ ? JsonConvert.DeserializeObject(exampleJson)
+ : default(ApiResponse);
+ return new ObjectResult(example);
}
}
}
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/StoreApi.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/StoreApi.cs
index 0ba31771bbb..26784668ba6 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/StoreApi.cs
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/StoreApi.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This is a sample server 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/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -6,7 +28,7 @@
using System.Linq;
using System.Net;
using System.Threading.Tasks;
-using Microsoft.AspNet.Mvc;
+using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Swashbuckle.SwaggerGen.Annotations;
using IO.Swagger.Models;
@@ -67,7 +89,7 @@ public virtual IActionResult GetInventory()
[Route("/store/order/{orderId}")]
[SwaggerOperation("GetOrderById")]
[SwaggerResponse(200, type: typeof(Order))]
- public virtual IActionResult GetOrderById([FromRoute]string orderId)
+ public virtual IActionResult GetOrderById([FromRoute]long? orderId)
{
string exampleJson = null;
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/UserApi.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/UserApi.cs
index b73cdd23c8f..1cfacdd09a7 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/UserApi.cs
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Controllers/UserApi.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This is a sample server 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/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -6,7 +28,7 @@
using System.Linq;
using System.Net;
using System.Threading.Tasks;
-using Microsoft.AspNet.Mvc;
+using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Swashbuckle.SwaggerGen.Annotations;
using IO.Swagger.Models;
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Dockerfile b/samples/server/petstore/aspnet5/src/IO.Swagger/Dockerfile
index af879b80ab0..5a44639a7b0 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Dockerfile
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Dockerfile
@@ -1,10 +1,16 @@
-FROM microsoft/aspnet:1.0.0-rc1-final
+FROM microsoft/dotnet:latest
+
+RUN groupadd -r app && useradd -r -g app app
+
+ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
RUN mkdir -p /app/IO.Swagger
COPY . /app/IO.Swagger
WORKDIR /app/IO.Swagger
-RUN ["dnu", "restore"]
-RUN ["dnu", "pack", "--out", "artifacts"]
EXPOSE 5000/tcp
-ENTRYPOINT ["dnx", "-p", "project.json", "web"]
+
+USER app
+
+RUN ["dotnet", "restore"]
+ENTRYPOINT ["dotnet", "run", "-p", "project.json", "web"]
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/IO.Swagger.xproj b/samples/server/petstore/aspnet5/src/IO.Swagger/IO.Swagger.xproj
new file mode 100644
index 00000000000..4002eaeb995
--- /dev/null
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/IO.Swagger.xproj
@@ -0,0 +1,19 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+
+ Sample
+ .\obj
+ .\bin\
+ v4.6
+
+
+ 2.0
+
+
+
\ No newline at end of file
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/ApiResponse.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/ApiResponse.cs
index 886f22c21bf..cdde768afcc 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/ApiResponse.cs
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/ApiResponse.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This is a sample server 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/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.Linq;
using System.IO;
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Category.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Category.cs
index e412db81ee2..410079fb6bf 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Category.cs
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Category.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This is a sample server 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/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.Linq;
using System.IO;
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Order.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Order.cs
index 80c3bcfb69e..357eed81bd1 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Order.cs
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Order.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This is a sample server 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/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.Linq;
using System.IO;
@@ -23,7 +45,7 @@ public partial class Order : IEquatable
/// Quantity.
/// ShipDate.
/// Order Status.
- /// Complete.
+ /// Complete (default to false).
public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, string Status = null, bool? Complete = null)
{
this.Id = Id;
@@ -31,7 +53,15 @@ public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime
this.Quantity = Quantity;
this.ShipDate = ShipDate;
this.Status = Status;
- this.Complete = Complete;
+ // use default value if no "Complete" provided
+ if (Complete == null)
+ {
+ this.Complete = false;
+ }
+ else
+ {
+ this.Complete = Complete;
+ }
}
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Pet.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Pet.cs
index 70a3992c294..ff8bec1056f 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Pet.cs
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Pet.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This is a sample server 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/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.Linq;
using System.IO;
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Tag.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Tag.cs
index 77697097379..4520f8af533 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Tag.cs
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/Tag.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This is a sample server 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/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.Linq;
using System.IO;
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/User.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/User.cs
index c8373712db9..620f1c69f21 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Models/User.cs
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Models/User.cs
@@ -1,3 +1,25 @@
+/*
+ * Swagger Petstore
+ *
+ * This is a sample server 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/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
using System.Linq;
using System.IO;
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Program.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Program.cs
new file mode 100644
index 00000000000..8990e6b48ad
--- /dev/null
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Program.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Builder;
+
+namespace IO.Swagger
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ var host = new WebHostBuilder()
+ .UseKestrel(options =>
+ {
+ // options.ThreadCount = 4;
+ // options.UseHttps("cert.pfx", "certpassword");
+ options.NoDelay = true;
+ options.UseConnectionLogging();
+ })
+ .UseUrls("http://+:5000" /*, "https://+:5001" */)
+ .UseContentRoot(Directory.GetCurrentDirectory())
+ .UseIISIntegration()
+ .UseStartup()
+ .Build();
+
+ host.Run();
+ }
+ }
+}
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Properties/launchSettings.json b/samples/server/petstore/aspnet5/src/IO.Swagger/Properties/launchSettings.json
index 7d41a0f84b9..45a5f3319a5 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Properties/launchSettings.json
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Properties/launchSettings.json
@@ -1,12 +1,28 @@
{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:50352/",
+ "sslPort": 0
+ }
+ },
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
- "launchUrl": "swagger/ui",
+ "launchUrl": "swagger/ui/index.html",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "web": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "launchUrl": "http://localhost:5000/swagger/ui/index.html",
"environmentVariables": {
- "ASPNET_ENV": "Development"
+ "ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
-}
+}
\ No newline at end of file
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/Startup.cs b/samples/server/petstore/aspnet5/src/IO.Swagger/Startup.cs
index 21cb3aa6042..e94c6e37d84 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/Startup.cs
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/Startup.cs
@@ -1,136 +1,102 @@
+/*
+ * Swagger Petstore
+ *
+ * This is a sample server 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/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
-using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Hosting;
+using System.Threading.Tasks;
+using System.Xml.XPath;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.PlatformAbstractions;
using Newtonsoft.Json.Serialization;
-using Swashbuckle.SwaggerGen;
-using Swashbuckle.SwaggerGen.XmlComments;
+using Swashbuckle.Swagger.Model;
+using Swashbuckle.SwaggerGen.Annotations;
namespace IO.Swagger
{
public class Startup
{
private readonly IHostingEnvironment _hostingEnv;
- private readonly IApplicationEnvironment _appEnv;
- public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
+ public IConfigurationRoot Configuration { get; }
+
+ public Startup(IHostingEnvironment env)
{
_hostingEnv = env;
- _appEnv = appEnv;
- // Set up configuration sources.
var builder = new ConfigurationBuilder()
- .AddJsonFile("appsettings.json")
+ .SetBasePath(env.ContentRootPath)
+ .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
+ .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
-
- public IConfigurationRoot Configuration { get; set; }
-
+
+
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
- string xmlComments = string.Format(@"{0}{4}artifacts{4}{1}{4}{2}{3}{4}IO.Swagger.xml",
- GetSolutionBasePath(),
- _appEnv.Configuration,
- _appEnv.RuntimeFramework.Identifier.ToLower(),
- _appEnv.RuntimeFramework.Version.ToString().Replace(".", string.Empty),
- Path.DirectorySeparatorChar);
-
// Add framework services.
services.AddMvc()
.AddJsonOptions(
opts => { opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); });
-
- // Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
- // You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
- // services.AddWebApiConventions();
-
+
services.AddSwaggerGen();
- services.ConfigureSwaggerDocument(options =>
+
+ services.ConfigureSwaggerGen(options =>
{
options.SingleApiVersion(new Info
{
Version = "v1",
Title = "IO.Swagger",
- Description = "IO.Swagger (ASP.NET 5 Web API 2.x)"
+ Description = "IO.Swagger (ASP.NET Core 1.0)"
});
-
- options.OperationFilter(new ApplyXmlActionCommentsFixed(xmlComments));
- });
- services.ConfigureSwaggerSchema(options => {
- options.DescribeAllEnumsAsStrings = true;
- options.ModelFilter(new ApplyXmlTypeCommentsFixed(xmlComments));
+ options.DescribeAllEnumsAsStrings();
+
+ var comments = new XPathDocument($"{AppContext.BaseDirectory}{Path.DirectorySeparatorChar}{_hostingEnv.ApplicationName}.xml");
+ options.OperationFilter(comments);
+ options.ModelFilter(comments);
});
+
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
- loggerFactory.MinimumLevel = LogLevel.Information;
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
- app.UseIISPlatformHandler();
-
+ app.UseMvc();
+
app.UseDefaultFiles();
app.UseStaticFiles();
- app.UseMvc();
-
- app.UseSwaggerGen();
+ app.UseSwagger();
app.UseSwaggerUi();
}
-
- // Taken from https://github.com/domaindrivendev/Ahoy/blob/master/test/WebSites/Basic/Startup.cs
- private string GetSolutionBasePath()
- {
- var dir = Directory.CreateDirectory(_appEnv.ApplicationBasePath);
- while (dir.Parent != null)
- {
- if (dir.GetDirectories("artifacts").Any())
- return dir.FullName;
-
- dir = dir.Parent;
- }
- throw new InvalidOperationException("Failed to detect solution base path - artifacts not found. Did you run dnu pack --out artifacts?");
- }
-
- // Entry point for the application.
- public static void Main(string[] args) => WebApplication.Run(args);
- }
-
-
- // using Swashbuckle.SwaggerGen.XmlComments;
- public class ApplyXmlTypeCommentsFixed : ApplyXmlTypeComments
- {
- public ApplyXmlTypeCommentsFixed() : base("")
- {
- throw new NotImplementedException();
- }
-
- public ApplyXmlTypeCommentsFixed(string filePath): base(filePath)
- {
-
- }
- }
-
- public class ApplyXmlActionCommentsFixed : ApplyXmlActionComments
- {
- public ApplyXmlActionCommentsFixed() : base("")
- {
- throw new NotImplementedException();
- }
-
- public ApplyXmlActionCommentsFixed(string filePath): base(filePath)
- {
-
- }
}
-}
\ No newline at end of file
+}
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/appsettings.json b/samples/server/petstore/aspnet5/src/IO.Swagger/appsettings.json
index e5472e562b7..c6af7d9b069 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/appsettings.json
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/appsettings.json
@@ -2,7 +2,7 @@
"Logging": {
"IncludeScopes": false,
"LogLevel": {
- "Default": "Verbose",
+ "Default": "Information",
"System": "Information",
"Microsoft": "Information"
}
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/project.json b/samples/server/petstore/aspnet5/src/IO.Swagger/project.json
index 7317a7c0d0c..ca8ac967209 100644
--- a/samples/server/petstore/aspnet5/src/IO.Swagger/project.json
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/project.json
@@ -1,41 +1,88 @@
{
+ "title": "Swagger UI",
"version": "1.0.0-*",
- "compilationOptions": {
- "emitEntryPoint": true
+ "copyright": "IO.Swagger",
+ "description": "IO.Swagger",
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "version": "1.0.0",
+ "type": "platform"
+ },
+ "Microsoft.AspNetCore.Mvc": "1.0.0",
+ "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
+ "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
+ "Microsoft.AspNetCore.Server.Kestrel.Https": "1.0.0",
+ "Microsoft.AspNetCore.StaticFiles": "1.0.0",
+ "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
+ "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
+ "Microsoft.Extensions.Configuration.Json": "1.0.0",
+ "Microsoft.Extensions.Logging": "1.0.0",
+ "Microsoft.Extensions.Logging.Console": "1.0.0",
+ "Microsoft.Extensions.Logging.Debug": "1.0.0",
+ "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
+ "Microsoft.EntityFrameworkCore": "1.0.0",
+ "Swashbuckle.SwaggerGen": "6.0.0-beta901",
+ "Swashbuckle.SwaggerUi": "6.0.0-beta901"
},
- "tooling": {
- "defaultNamespace": "IO.Swagger"
+
+ "tools": {
+ "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
+
+ "Microsoft.Extensions.SecretManager.Tools": {
+ "imports": [
+ "netstandard1.6",
+ "portable-net45+win8+dnxcore50",
+ "portable-net45+win8"
+ ],
+ "version": "1.0.0-preview2-final"
+ }
},
- "dependencies": {
- "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
- "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
- "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
- "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
- "Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-final",
- "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
- "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
- "Microsoft.Extensions.Logging.Debug" : "1.0.0-rc1-final",
- "Swashbuckle.SwaggerGen": "6.0.0-rc1-final",
- "Swashbuckle.SwaggerUi": "6.0.0-rc1-final"
+ "frameworks": {
+ "netcoreapp1.0": {
+ "imports": [
+ "dotnet5.6",
+ "dnxcore50",
+ "netstandard1.6",
+ "portable-net452+win81"
+ ]
+ }
},
- "commands": {
- "web": "Microsoft.AspNet.Server.Kestrel --server.urls http://0.0.0.0:5000"
+ "buildOptions": {
+ "emitEntryPoint": true,
+ "preserveCompilationContext": true,
+ "xmlDoc": true,
+ "compile": {
+ "exclude": [
+ "wwwroot",
+ "node_modules",
+ "bower_components"
+ ]
+ }
},
- "frameworks": {
- "dnx451": { },
- "dnxcore50": { }
+ "runtimeOptions": {
+ "configProperties": {
+ "System.GC.Server": true
+ }
+ },
+
+ "publishOptions": {
+ "include": [
+ "wwwroot",
+ "Views",
+ "Areas/**/Views",
+ "appsettings.json",
+ "web.config"
+ ],
+ "exclude": [
+ "**.user",
+ "**.vspscc"
+ ]
},
- "exclude": [
- "wwwroot",
- "node_modules",
- "bower_components"
- ],
- "publishExclude": [
- "**.user",
- "**.vspscc"
- ]
+ "scripts": {
+ "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
+ }
}
diff --git a/samples/server/petstore/aspnet5/src/IO.Swagger/web.config b/samples/server/petstore/aspnet5/src/IO.Swagger/web.config
new file mode 100644
index 00000000000..a3b9f6add9c
--- /dev/null
+++ b/samples/server/petstore/aspnet5/src/IO.Swagger/web.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+