cl
///
///
///
- protected override CSharpOperationModel CreateOperationModel(SwaggerOperation operation, ClientGeneratorBaseSettings settings)
+ protected override CSharpOperationModel CreateOperationModel(OpenApiOperation operation, ClientGeneratorBaseSettings settings)
{
- return new HttpApiMethod(operation, (SwaggerToCSharpGeneratorSettings)settings, this, (CSharpTypeResolver)Resolver);
+ return new HttpApiMethod(operation, (CSharpGeneratorBaseSettings)settings, this, (CSharpTypeResolver)Resolver);
}
}
@@ -210,8 +211,7 @@ public HttpModelProvider(Swagger swagger)
public HttpModel[] GetHttpModels()
{
return this.GenerateTypes()
- .Artifacts
- .Select(item => new HttpModel(item, this.swagger.Settings.AspNetNamespace))
+ .Select(item => new HttpModel(item, this.swagger.Settings.NameSpace))
.ToArray();
}
}
diff --git a/WebApiClient.Tools.Swagger/Views/HttpApi.cshtml b/WebApiClient.Tools.Swagger/Views/HttpApi.cshtml
index 9de4d6c..d3e6bb0 100644
--- a/WebApiClient.Tools.Swagger/Views/HttpApi.cshtml
+++ b/WebApiClient.Tools.Swagger/Views/HttpApi.cshtml
@@ -17,11 +17,11 @@
using WebApiClient;
using WebApiClient.Attributes;
using WebApiClient.DataAnnotations;
- using WebApiClient.Parameterables;
+ using WebApiClient.Parameterables;
- namespace @(Model.AspNetNamespace)
+ namespace @(Model.NameSpace)
{
@@ -92,21 +92,21 @@
[Required]
}
- if (parameter.VariableName != parameter.Name&& parameter.Kind != SwaggerParameterKind.Header)
+ if (parameter.VariableName != parameter.Name&& parameter.Kind != OpenApiParameterKind.Header)
{
[AliasAs("@(parameter.Name)")]
}
- if (parameter.Kind == SwaggerParameterKind.Path || parameter.Kind == SwaggerParameterKind.Query)
+ if (parameter.Kind == OpenApiParameterKind.Path || parameter.Kind == OpenApiParameterKind.Query)
{
- var schema = parameter.Schema as NSwag.SwaggerParameter;
- if (schema != null && schema.CollectionFormat != SwaggerParameterCollectionFormat.Undefined
- && schema.CollectionFormat != SwaggerParameterCollectionFormat.Multi)
+ var schema = parameter.Schema as NSwag.OpenApiParameter;
+ if (schema != null && schema.CollectionFormat != OpenApiParameterCollectionFormat.Undefined
+ && schema.CollectionFormat != OpenApiParameterCollectionFormat.Multi)
{
[PathQuery(CollectionFormat = CollectionFormat.@(schema.CollectionFormat))]
}
}
- else if (parameter.Kind == SwaggerParameterKind.Header)
+ else if (parameter.Kind == OpenApiParameterKind.Header)
{
[Header("@(parameter.Name)")]
}
@@ -114,11 +114,11 @@
{
[XmlContent]
}
- else if (parameter.Kind == SwaggerParameterKind.Body)
+ else if (parameter.Kind == OpenApiParameterKind.Body)
{
[JsonContent]
}
- else if (parameter.Kind == SwaggerParameterKind.FormData)
+ else if (parameter.Kind == OpenApiParameterKind.FormData)
{
if (parameter.IsFile == false)
{
diff --git a/WebApiClient.Tools.Swagger/Views/HttpModel.cshtml b/WebApiClient.Tools.Swagger/Views/HttpModel.cshtml
index f4188ee..f4899e2 100644
--- a/WebApiClient.Tools.Swagger/Views/HttpModel.cshtml
+++ b/WebApiClient.Tools.Swagger/Views/HttpModel.cshtml
@@ -12,7 +12,7 @@
- namespace @(Model.AspNetNamespace)
+ namespace @(Model.NameSapce)
{
@foreach (var line in Model.Lines)
diff --git a/WebApiClient.Tools.Swagger/WebApiClient.Tools.Swagger.csproj b/WebApiClient.Tools.Swagger/WebApiClient.Tools.Swagger.csproj
index 8e3afdc..a207132 100644
--- a/WebApiClient.Tools.Swagger/WebApiClient.Tools.Swagger.csproj
+++ b/WebApiClient.Tools.Swagger/WebApiClient.Tools.Swagger.csproj
@@ -10,6 +10,10 @@
将swagger的本地或远程json文件解析生成WebApiClient的接口定义代码文件的工具
+
+ AnyCPU
+
+
@@ -19,7 +23,7 @@
-
+