diff --git a/eng/PublishRelease.ps1 b/eng/PublishRelease.ps1
index d878eb02..c47a2acf 100644
--- a/eng/PublishRelease.ps1
+++ b/eng/PublishRelease.ps1
@@ -22,7 +22,7 @@ try
cmd /c "npx -q publish-release --token $Token --repo autorest.csharp --owner azure --name $name --tag $devVersion --notes=prerelease-build --prerelease --editRelease false --assets $file --target_commitish $Sha 2>&1"
- Write-Host "##vso[task.setvariable variable=AutorestCSharpVersion;isSecret=false]https://github.com/Azure/autorest.csharp/releases/download/$devVersion/autorest-csharp-v3-$devVersion.tgz"
+ Write-Host "##vso[task.setvariable variable=AutorestCSharpVersion;isSecret=false]https://github.com/Azure/autorest.csharp/releases/download/$devVersion/azure-functions-csharp-$devVersion.tgz"
}
finally
{
diff --git a/package-lock.json b/package-lock.json
index 8385ca1d..45446194 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "@autorest/csharp-v3",
+ "name": "@autorest/azure-functions-csharp",
"requires": true,
"lockfileVersion": 1,
"dependencies": {
diff --git a/readme.md b/readme.md
index 2a703794..d550886a 100644
--- a/readme.md
+++ b/readme.md
@@ -1,823 +1,13 @@
-# C# code generator for AutoRest V3
+# Azure Functions C# code generator for AutoRest V3
## Setup
- [NodeJS](https://nodejs.org/en/) (13.x.x)
- `npm install` (at root)
- [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet-core/3.0) (3.0.100)
- [PowerShell Core](https://github.com/PowerShell/PowerShell/releases/latest)
-- [Java](https://www.java.com/en/download/) (for V2 testserver)
## Build
- `dotnet build` (at root)
-- `./eng/Generate.ps1` (at root in PowerShell Core)
-
-## Test
-- `dotnet test` (at root)
-
-## Customizing the generated code
-
-
-
-- [Make a model internal](#make-a-model-internal)
-- [Rename a model class](#rename-a-model-class)
-- [Change a model namespace](#change-a-model-namespace)
-- [Make model property internal](#make-model-property-internal)
-- [Rename a model property](#rename-a-model-property)
-- [Change a model property type](#change-a-model-property-type)
-- [Preserve raw Json value of a property](#preserve-raw-json-value-of-a-property)
-- [Changing member doc comment](#changing-member-doc-comment)
-- [Customize serialization/deserialization methods](#customize-serializationdeserialization-methods)
-- [Renaming an enum](#renaming-an-enum)
-- [Renaming an enum member](#renaming-an-enum-member)
-- [Make a client internal](#make-a-client-internal)
-- [Rename a client](#rename-a-client)
-- [Replace any generated member](#replace-any-generated-member)
-- [Remove any generated member](#remove-any-generated-member)
-- [Change model namespace or accessability in bulk](#change-model-namespace-or-accessability-in-bulk)
-
-
-
-### Make a model internal
-
-Define a class with the same namespace and name as generated model and use the desired accessibility.
-
-
-
-**Generated code before (Generated/Models/Model.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model { }
-}
-```
-
-**Add customized model (Model.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- internal partial class Model { }
-}
-```
-
-**Generated code after (Generated/Models/Model.cs):**
-
-``` diff
-namespace Azure.Service.Models
-{
-- public partial class Model { }
-+ internal partial class Model { }
-}
-```
-
-
-
-### Rename a model class
-
-Define a class with a desired name and mark it with `[CodeGenModel("OriginalName")]`
-
-
-
-**Generated code before (Generated/Models/Model.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model { }
-}
-```
-
-**Add customized model (NewModelClassName.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- [CodeGenModel("Model")]
- public partial class NewModelClassName { }
-}
-```
-
-**Generated code after (Generated/Models/NewModelClassName.cs):**
-
-``` diff
-namespace Azure.Service.Models
-{
-- public partial class Model { }
-+ public partial class NewModelClassName { }
-}
-```
-
-
-
-### Change a model namespace
-
-Define a class with a desired namespace and mark it with `[CodeGenModel("OriginalName")]`
-
-
-
-**Generated code before (Generated/Models/Model.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model { }
-}
-```
-
-**Add customized model (NewModelClassName.cs)**
-
-``` C#
-namespace Azure.Service
-{
- [CodeGenModel("Model")]
- public partial class Model { }
-}
-```
-
-**Generated code after (Generated/Models/NewModelClassName.cs):**
-
-``` diff
-- namespace Azure.Service.Models
-+ namespace Azure.Service
-{
- public partial class Model { }
-}
-```
-
-
-
-### Make model property internal
-
-Define a class with a property matching a generated property name but with desired accessibility.
-
-
-
-**Generated code before (Generated/Models/Model.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- public string Property { get; }
- }
-}
-```
-
-**Add customized model (Model.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- internal string Property { get; }
- }
-}
-```
-
-**Generated code after (Generated/Models/Model.cs):**
-
-``` diff
-namespace Azure.Service.Models
-{
- public partial class Model
- {
-- public string Property { get; }
- }
-}
-```
-
-
-
-### Rename a model property
-
-Define a partial class with a new property name and mark it with `[CodeGenMember("OriginalName")]` attribute.
-
-**NOTE:** you can also change a property to a field using this mapping.
-
-
-
-**Generated code before (Generated/Models/Model.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- public string Property { get; }
- }
-}
-```
-
-**Add customized model (Model.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- [CodeGenMember("Property")]
- public string RenamedProperty { get; }
- }
-}
-```
-
-**Generated code after (Generated/Models/Model.cs):**
-
-``` diff
-namespace Azure.Service.Models
-{
- public partial class Model
- {
-- public string Property { get; }
-+ // All original Property usages would reference a RenamedProperty
- }
-}
-```
-
-
-
-### Change a model property type
-
-:warning:
-
-**NOTE: This is supported for a narrow set of cases where the underlying serialized type doesn't change**
-
-Scenarios that would work:
-
-1. String <-> TimeSpan (both represented as string in JSON)
-1. Float <-> Int (both are numbers)
-1. String <-> Enums (both strings)
-
-Won't work:
-
-1. String <-> Bool (different json type)
-2. Changing model kinds
-
-If you think you have a valid re-mapping scenario that's not supported file an issue.
-
-:warning:
-
-Define a property with different type than the generated one.
-
-
-
-**Generated code before (Generated/Models/Model.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- public string Property { get; }
- }
-}
-```
-
-**Add customized model (Model.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- public DateTime Property { get; }
- }
-}
-```
-
-**Generated code after (Generated/Models/Model.Serializer.cs):**
-
-``` diff
-namespace Azure.Service.Models
-{
- public partial class Model
- {
-- public string Property { get; }
-+ // Serialization code now reads and writes DateTime value instead of string
- }
-}
-```
-
-
-
-### Preserve raw Json value of a property
-
-Use the [Change a model property type](#Change-a-model-property-type) approach to change property type to `JsonElement`.
-
-
-
-**Generated code before (Generated/Models/Model.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- public string Property { get; }
- }
-}
-```
-
-**Add customized model (Model.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- public JsonElement Property { get; }
- }
-}
-```
-
-**Generated code after (Generated/Models/Model.Serializer.cs):**
-
-``` diff
-namespace Azure.Service.Models
-{
- public partial class Model
- {
-- public string Property { get; }
-+ // Serialization code now reads and writes JsonElement value instead of string
- }
-}
-```
-
-
-
-### Changing member doc comment
-
-Redefine a member in partial class with a new doc comment.
-
-
-
-**Generated code before (Generated/Models/Model.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- /// Subpar doc comment
- public string Property { get; }
- }
-}
-```
-
-**Add customized model (Model.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- /// Great doc comment
- public string Property { get; }
- }
-}
-```
-
-**Generated code after (Generated/Models/Model.cs):**
-
-``` diff
-namespace Azure.Service.Models
-{
- public partial class Model
- {
-- /// Subpar doc comment
-- public string Property { get; }
- }
-}
-```
-
-
-
-### Customize serialization/deserialization methods
-
-Use the [Replace any generated member](#replace-any-generated-member) approach to replace Serialize/Deserialize method with a custom implementation.
-
-
-
-**Generated code before (Generated/Models/Cat.Serialization.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Cat
- {
- internal static Cat DeserializeCat(JsonElement element)
- {
- string color = default;
- string name = default;
- foreach (var property in element.EnumerateObject())
- {
- if (property.NameEquals("color"))
- {
- if (property.Value.ValueKind == JsonValueKind.Null)
- {
- continue;
- }
- color = property.Value.GetString();
- continue;
- }
- if (property.NameEquals("name"))
- {
- if (property.Value.ValueKind == JsonValueKind.Null)
- {
- continue;
- }
- name = property.Value.GetString();
- continue;
- }
- }
- return new Cat(id, name);
- }
- }
-}
-```
-
-**Add customized model (Cat.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Cat
- {
- internal static Cat DeserializeCat(JsonElement element)
- {
- string color = default;
- string name = default;
- foreach (var property in element.EnumerateObject())
- {
- if (property.NameEquals("name"))
- {
- if (property.Value.ValueKind == JsonValueKind.Null)
- {
- continue;
- }
- name = property.Value.GetString();
- continue;
- }
- }
- // WORKAROUND: server never sends color, default to black
- color = "black";
- return new Cat(name, color);
- }
- }
-}
-```
-
-**Generated code after (Generated/Models/Model.cs):**
-
-Generated code won't contain the DeserializeCat method and the custom one would be used for deserialization.
-
-
-
-### Renaming an enum
-
-Redefine an enum with a new name and all the members mark it with `[CodeGenModel("OriginEnumName")]`.
-
-**NOTE: because enums can't be partial all values have to be copied**
-
-
-
-**Generated code before (Generated/Models/Colors.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public enum Colors
- {
- Red,
- Green,
- Blue
- }
-}
-```
-
-**Add customized model (WallColors.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- [CodeGenModel("Colors")]
- public enum WallColors
- {
- Red,
- Green,
- Blue
- }
-}
-```
-
-**Generated code after (Generated/Models/Model.cs):**
-
-``` diff
--namespace Azure.Service.Models
--{
-- public enum Colors
-- {
-- Red,
-- Green,
-- Blue
-- }
--}
-+// Serialization code uses the new WallColors type name
-```
-
-
-
-### Renaming an enum member
-
-Redefine an enum with the same name and all the members, mark renamed member with `[CodeGenMember("OriginEnumMemberName")]`.
-
-**NOTE: because enums can't be partial all values have to be copied but only the ones being renamed should be marked with an attributes**
-
-
-
-**Generated code before (Generated/Models/Colors.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public enum Colors
- {
- Red,
- Green,
- Blue
- }
-}
-```
-
-**Add customized model (Colors.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- public enum Colors
- {
- Red,
- Green,
- [CodeGenMember("Blue")]
- SkyBlue
- }
-}
-```
-
-**Generated code after (Generated/Models/Model.cs):**
-
-``` diff
--namespace Azure.Service.Models
--{
-- public enum Colors
-- {
-- Red,
-- Green,
-- Blue
-- }
--}
-+// Serialization code uses the new SkyBlue member name
-```
-
-
-
-### Make a client internal
-
-Define a class with the same namespace and name as generated client and use the desired accessibility.
-
-
-
-**Generated code before (Generated/Operations/ServiceClient.cs):**
-
-``` C#
-namespace Azure.Service.Operations
-{
- public partial class ServiceClient { }
-}
-```
-
-**Add customized model (Model.cs)**
-
-``` C#
-namespace Azure.Service.Operations
-{
- internal partial class ServiceClient { }
-}
-```
-
-**Generated code after (Generated/Operations/ServiceClient.cs):**
-
-``` diff
-namespace Azure.Service.Operations
-{
-- public partial class ServiceClient { }
-+ internal partial class ServiceClient { }
-}
-```
-
-
-
-
-### Rename a client
-
-Define a partial client class with a new name and mark it with `[CodeGenClient("OriginalName")]`
-
-
-
-**Generated code before (Generated/Operations/ServiceClient.cs):**
-
-``` C#
-namespace Azure.Service.Operations
-{
- public partial class ServiceClient {}
-}
-```
-
-**Add customized model (Model.cs)**
-
-``` C#
-namespace Azure.Service.Operations
-{
- [CodeGenClient("ServiceClient")]
- public partial class TableClient { }
-}
-```
-
-**Generated code after (Generated/Operations/ServiceClient.cs):**
-
-``` diff
-namespace Azure.Service.Operations
-{
-- public partial class ServiceClient { }
-+ public partial class TableClient { }
-}
-```
-
-
-
-
-### Replace any generated member
-
-Works for model and client properties, methods, constructors etc.
-
-Define a partial class with member with the same name and for methods same parameters.
-
-
-
-**Generated code before (Generated/Models/Model.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- public Model()
- {
- Property = "a";
- }
-
- public string Property { get; set; }
- }
-}
-```
-
-**Add customized model (Model.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- internal Model()
- {
- Property = "b";
- }
- }
-}
-```
-
-**Generated code after (Generated/Models/Model.cs):**
-
-``` diff
-namespace Azure.Service.Models
-{
- public partial class Model
- {
-- public Model()
-- {
-- Property = "a";
-- }
- }
-}
-```
-
-
-
-### Remove any generated member
-
-Works for model and client properties, methods, constructors etc.
-
-Define a partial class with `[CodeGenSuppress("NameOfMember", typeof(Parameter1Type), typeof(Parameter2Type))]` attribute.
-
-
-
-**Generated code before (Generated/Models/Model.cs):**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model
- {
- public Model()
- {
- Property = "a";
- }
-
- public Model(string property)
- {
- Property = property;
- }
-
- public string Property { get; set; }
- }
-}
-```
-
-**Add customized model (Model.cs)**
-
-``` C#
-namespace Azure.Service.Models
-{
- [CodeGenSuppress("Model", typeof(string))]
- public partial class Model
- {
- }
-}
-```
-
-**Generated code after (Generated/Models/Model.cs):**
-
-``` diff
-namespace Azure.Service.Models
-{
- public partial class Model
- {
-- public Model(string property)
-- {
-- Property = property;
-- }
- }
-}
-```
-
-
-
-### Change model namespace or accessability in bulk
-
-**Generated code before:**
-
-``` C#
-namespace Azure.Service.Models
-{
- public partial class Model1 {}
- public partial class Model2 {}
- public partial class Model3 {}
- public partial class Model4 {}
-}
-```
-
-**Add autorest.md transformation**
-
-``` yaml
-directive:
- from: swagger-document
- where: $.definitions.*
- transform: >
- $["x-namespace"] = "Azure.Search.Documents.Indexes.Models"
- $["x-accessibility"] = "internal"
-```
-
-**Generated code after:**
-
-``` diff
--namespace Azure.Service
-+namespace Azure.Service.Models
-{
-- public partial class Model1 {}
-+ internal partial class Model1 {}
-- public partial class Model2 {}
-+ internal partial class Model2 {}
-- public partial class Model3 {}
-+ internal partial class Model3 {}
-- public partial class Model4 {}
-+ internal partial class Model4 {}
-}
-```
-
-
## Configuration
```yaml
@@ -829,9 +19,9 @@ use: $(this-folder)/artifacts/bin/AutoRest.CSharp.V3/Debug/netcoreapp3.0/
clear-output-folder: false
public-clients: true
pipeline:
- csharpproj:
+ azure-functions-csharpproj:
input: modelerfour/identity
- csharpproj/emitter:
- input: csharpproj
+ azure-functions-csharpproj/emitter:
+ input: azure-functions-csharpproj
scope: output-scope
```
diff --git a/src/AutoRest.CSharp.V3/AutoRest/Plugins/CSharpGen.cs b/src/AutoRest.CSharp.V3/AutoRest/Plugins/CSharpGen.cs
index fce71455..2e2f3ca4 100644
--- a/src/AutoRest.CSharp.V3/AutoRest/Plugins/CSharpGen.cs
+++ b/src/AutoRest.CSharp.V3/AutoRest/Plugins/CSharpGen.cs
@@ -25,7 +25,7 @@ using Diagnostic = Microsoft.CodeAnalysis.Diagnostic;
namespace AutoRest.CSharp.V3.AutoRest.Plugins
{
- [PluginName("csharpgen")]
+ [PluginName("azure-functions-csharp")]
internal class CSharpGen : IPlugin
{
diff --git a/src/AutoRest.CSharp.V3/AutoRest/Plugins/CSharpProj.cs b/src/AutoRest.CSharp.V3/AutoRest/Plugins/CSharpProj.cs
index 4a55ae02..5b9a7707 100644
--- a/src/AutoRest.CSharp.V3/AutoRest/Plugins/CSharpProj.cs
+++ b/src/AutoRest.CSharp.V3/AutoRest/Plugins/CSharpProj.cs
@@ -8,7 +8,7 @@ using AutoRest.CSharp.V3.Input;
namespace AutoRest.CSharp.V3.AutoRest.Plugins
{
// ReSharper disable once StringLiteralTypo
- [PluginName("csharpproj")]
+ [PluginName("azure-functions-csharpproj")]
// ReSharper disable once IdentifierTypo
internal class CSharpProj : IPlugin
{
diff --git a/src/AutoRest.CSharp.V3/package.json b/src/AutoRest.CSharp.V3/package.json
index c7f346df..36ba1861 100644
--- a/src/AutoRest.CSharp.V3/package.json
+++ b/src/AutoRest.CSharp.V3/package.json
@@ -1,11 +1,11 @@
{
- "version": "3.0.0",
- "name": "@autorest/csharp-v3",
- "description": "See readme.md for details",
- "scripts": {
- "start": "dotnet ./AutoRest.CSharp.V3.dll --server"
- },
- "devDependencies": {
- },
- "dependencies": {}
+ "version": "3.0.0",
+ "name": "@autorest/azure-functions-csharp",
+ "description": "See readme.md for details",
+ "scripts": {
+ "start": "dotnet ./AutoRest.CSharp.V3.dll --server"
+ },
+ "devDependencies": {
+ },
+ "dependencies": {}
}
diff --git a/src/AutoRest.CSharp.V3/readme.md b/src/AutoRest.CSharp.V3/readme.md
index 218a505f..fbc3574d 100644
--- a/src/AutoRest.CSharp.V3/readme.md
+++ b/src/AutoRest.CSharp.V3/readme.md
@@ -11,10 +11,10 @@ modelerfour:
flatten-payloads: true
group-parameters: true
pipeline:
- csharpgen:
+ azure-functions-csharp:
input: modelerfour/identity
- csharpgen/emitter:
- input: csharpgen
+ azure-functions-csharp/emitter:
+ input: azure-functions-csharp
scope: output-scope
output-scope:
output-artifact: source-file-csharp