[csharp-netcore] Adding additional package metadata (#5065)

* fix(csharp-netcore): Adding license expression

* fix(csharp-netcore): Adding license expression

* fix(csharp-netcore): Adding license expression

* fix(csharp-netcore): Adding license expression

* fix(csharp-netcore): Adding license expression

* fix(csharp-netcore): Adding other package metadata fields

* fix(csharp-netcore): Adding other package metadata fields

* fix(csharp-netcore): Adding other package metadata fields

* fix(csharp-netcore): Minor fixes

* fix(csharp-netcore): Updating example projects

* fix(csharp-netcore): Removed carriage return

* fix(csharp-netcore): Removed carriage return
This commit is contained in:
Sai Giridhar P
2020-01-21 19:40:33 +05:30
committed by William Cheng
parent a1d21f6d3a
commit 6a228e8006
7 changed files with 58 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ sidebar_label: csharp-netcore
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|interfacePrefix|Prefix interfaces with a community standard or widely accepted prefix.| |I|
|licenseId|The identifier of the license| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |PascalCase|
|netCoreProjectFile|Use the new format (.NET Core) for .NET project files (.csproj).| |false|
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.| |false|
@@ -18,7 +19,9 @@ sidebar_label: csharp-netcore
|optionalProjectFile|Generate {PackageName}.csproj.| |true|
|packageGuid|The GUID that will be associated with the C# project| |null|
|packageName|C# package name (convention: Title.Case).| |Org.OpenAPITools|
|packageTags|Tags to identify the package| |null|
|packageVersion|C# package version.| |1.0.0|
|releaseNote|Release note, default to 'Minor update'.| |Minor update|
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src|

View File

@@ -114,6 +114,9 @@ public class CodegenConstants {
public static final String LICENSE_NAME = "licenseName";
public static final String LICENSE_NAME_DESC = "The name of the license";
public static final String LICENSE_ID = "licenseId";
public static final String LICENSE_ID_DESC = "The identifier of the license";
public static final String LICENSE_URL = "licenseUrl";
public static final String LICENSE_URL_DESC = "The URL of the license";
@@ -336,4 +339,7 @@ public class CodegenConstants {
public static final String ENUM_CLASS_PREFIX = "enumClassPrefix";
public static final String ENUM_CLASS_PREFIX_DESC = "Prefix enum with class name";
public static final String PACKAGE_TAGS = "packageTags";
public static final String PACKAGE_TAGS_DESC = "Tags to identify the package";
}

View File

@@ -80,6 +80,9 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
protected boolean nonPublicApi = Boolean.FALSE;
protected boolean caseInsensitiveResponseHeaders = Boolean.FALSE;
protected String releaseNote = "Minor update";
protected String licenseId;
protected String packageTags;
public CSharpNetCoreClientCodegen() {
super();
@@ -163,6 +166,18 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
CodegenConstants.INTERFACE_PREFIX_DESC,
interfacePrefix);
addOption(CodegenConstants.LICENSE_ID,
CodegenConstants.LICENSE_ID_DESC,
this.licenseId);
addOption(CodegenConstants.RELEASE_NOTE,
CodegenConstants.RELEASE_NOTE_DESC,
this.releaseNote);
addOption(CodegenConstants.PACKAGE_TAGS,
CodegenConstants.PACKAGE_TAGS_DESC,
this.packageTags);
CliOption framework = new CliOption(
CodegenConstants.DOTNET_FRAMEWORK,
CodegenConstants.DOTNET_FRAMEWORK_DESC
@@ -699,6 +714,18 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
this.caseInsensitiveResponseHeaders = caseInsensitiveResponseHeaders;
}
public void setLicenseId(String licenseId) {
this.licenseId = licenseId;
}
public void setReleaseNote(String releaseNote) {
this.releaseNote = releaseNote;
}
public void setPackageTags(String packageTags) {
this.packageTags = packageTags;
}
@Override
public String toEnumVarName(String value, String datatype) {
if (value.length() == 0) {

View File

@@ -22,10 +22,17 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>{{packageName}}</RootNamespace>
<AssemblyName>{{packageName}}</AssemblyName>
<Description>{{packageDescription}}</Description>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFramework>{{targetFramework}}</TargetFramework>
<FileAlignment>512</FileAlignment>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\{{packageName}}.xml</DocumentationFile>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\{{packageName}}.xml</DocumentationFile>{{#licenseId}}
<PackageLicenseExpression>{{licenseId}}</PackageLicenseExpression>{{/licenseId}}
<RepositoryUrl>https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}</PackageProjectUrl>{{#releaseNote}}
<PackageReleaseNotes>{{releaseNote}}</PackageReleaseNotes>{{/releaseNote}}{{#packageTags}}
<PackageTags>{{{packageTags}}}</PackageTags>{{/packageTags}}
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->

View File

@@ -16,7 +16,12 @@
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<RootNamespace>{{packageName}}</RootNamespace>
<Version>{{packageVersion}}</Version>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\{{packageName}}.xml</DocumentationFile>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\{{packageName}}.xml</DocumentationFile>{{#licenseId}}
<PackageLicenseExpression>{{licenseId}}</PackageLicenseExpression>{{/licenseId}}
<RepositoryUrl>https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>{{#releaseNote}}
<PackageReleaseNotes>{{releaseNote}}</PackageReleaseNotes>{{/releaseNote}}{{#packageTags}}
<PackageTags>{{{packageTags}}}</PackageTags>{{/packageTags}}
</PropertyGroup>
<ItemGroup>

View File

@@ -18,10 +18,15 @@ The version of the OpenAPI document: 1.0.0
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Org.OpenAPITools</RootNamespace>
<AssemblyName>Org.OpenAPITools</AssemblyName>
<Description>A library generated from a OpenAPI doc</Description>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFramework>netstandard2.0</TargetFramework>
<FileAlignment>512</FileAlignment>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml</DocumentationFile>
<RepositoryUrl>https://github.com/GIT_USER_ID/GIT_REPO_ID.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/GIT_USER_ID/GIT_REPO_ID</PackageProjectUrl>
<PackageReleaseNotes>Minor update</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->

View File

@@ -17,6 +17,9 @@
<RootNamespace>Org.OpenAPITools</RootNamespace>
<Version>1.0.0</Version>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml</DocumentationFile>
<RepositoryUrl>https://github.com/GIT_USER_ID/GIT_REPO_ID.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>Minor update</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>