@autorest/powershell 4.0.0-dev.3 → 4.0.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/package-deps_build.json +66 -41
- package/.rush/temp/shrinkwrap-deps.json +21 -21
- package/autorest-configuration-for-sdk.md +110 -0
- package/autorest-configuration.md +2 -1
- package/dist/cmdlets/class.d.ts +1 -0
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +168 -86
- package/dist/cmdlets/class.js.map +1 -1
- package/dist/cmdlets/namespace.d.ts.map +1 -1
- package/dist/cmdlets/namespace.js +3 -1
- package/dist/cmdlets/namespace.js.map +1 -1
- package/dist/cmdlets/parameter.js +1 -0
- package/dist/cmdlets/parameter.js.map +1 -1
- package/dist/enums/namespace.js +2 -1
- package/dist/enums/namespace.js.map +1 -1
- package/dist/file-formats/md-file.js +1 -0
- package/dist/file-formats/md-file.js.map +1 -1
- package/dist/file-formats/psd-file.js +1 -0
- package/dist/file-formats/psd-file.js.map +1 -1
- package/dist/file-formats/psscript-file.js +1 -0
- package/dist/file-formats/psscript-file.js.map +1 -1
- package/dist/generators/csproj.js +1 -0
- package/dist/generators/csproj.js.map +1 -1
- package/dist/generators/gitattributes.js +1 -0
- package/dist/generators/gitattributes.js.map +1 -1
- package/dist/generators/gitignore.js +1 -0
- package/dist/generators/gitignore.js.map +1 -1
- package/dist/generators/inputhandler.custom.d.ts +3 -0
- package/dist/generators/inputhandler.custom.d.ts.map +1 -0
- package/dist/generators/inputhandler.custom.js +33 -0
- package/dist/generators/inputhandler.custom.js.map +1 -0
- package/dist/generators/nuspec.js +1 -0
- package/dist/generators/nuspec.js.map +1 -1
- package/dist/generators/psm1.custom.js +1 -0
- package/dist/generators/psm1.custom.js.map +1 -1
- package/dist/generators/psm1.internal.js +1 -0
- package/dist/generators/psm1.internal.js.map +1 -1
- package/dist/generators/psm1.js +2 -1
- package/dist/generators/psm1.js.map +1 -1
- package/dist/generators/readme.js +1 -0
- package/dist/generators/readme.js.map +1 -1
- package/dist/generators/script-cmdlet.js +1 -0
- package/dist/generators/script-cmdlet.js.map +1 -1
- package/dist/internal/name-inferrer.js +1 -0
- package/dist/internal/name-inferrer.js.map +1 -1
- package/dist/internal/powershell-declarations.d.ts +2 -0
- package/dist/internal/powershell-declarations.d.ts.map +1 -1
- package/dist/internal/powershell-declarations.js +2 -0
- package/dist/internal/powershell-declarations.js.map +1 -1
- package/dist/internal/project.d.ts +11 -9
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +6 -2
- package/dist/internal/project.js.map +1 -1
- package/dist/internal/state.js +1 -0
- package/dist/internal/state.js.map +1 -1
- package/dist/internal/verbs.js +1 -0
- package/dist/internal/verbs.js.map +1 -1
- package/dist/llcsharp/clientruntime.d.ts +3 -0
- package/dist/llcsharp/clientruntime.d.ts.map +1 -1
- package/dist/llcsharp/clientruntime.js +4 -0
- package/dist/llcsharp/clientruntime.js.map +1 -1
- package/dist/llcsharp/csharp-declarations.js +1 -0
- package/dist/llcsharp/csharp-declarations.js.map +1 -1
- package/dist/llcsharp/enums/enum.js +2 -1
- package/dist/llcsharp/enums/enum.js.map +1 -1
- package/dist/llcsharp/enums/namespace.js +1 -0
- package/dist/llcsharp/enums/namespace.js.map +1 -1
- package/dist/llcsharp/exports.js +23 -13
- package/dist/llcsharp/exports.js.map +1 -1
- package/dist/llcsharp/generator.js +1 -0
- package/dist/llcsharp/generator.js.map +1 -1
- package/dist/llcsharp/messages.js +1 -0
- package/dist/llcsharp/messages.js.map +1 -1
- package/dist/llcsharp/model/idictionary.js +1 -0
- package/dist/llcsharp/model/idictionary.js.map +1 -1
- package/dist/llcsharp/model/interface.d.ts.map +1 -1
- package/dist/llcsharp/model/interface.js +2 -1
- package/dist/llcsharp/model/interface.js.map +1 -1
- package/dist/llcsharp/model/model-class-dictionary.js +1 -0
- package/dist/llcsharp/model/model-class-dictionary.js.map +1 -1
- package/dist/llcsharp/model/model-class-json.js +1 -0
- package/dist/llcsharp/model/model-class-json.js.map +1 -1
- package/dist/llcsharp/model/model-class-serializer.js +1 -0
- package/dist/llcsharp/model/model-class-serializer.js.map +1 -1
- package/dist/llcsharp/model/model-class.js +10 -9
- package/dist/llcsharp/model/model-class.js.map +1 -1
- package/dist/llcsharp/model/namespace.js +1 -0
- package/dist/llcsharp/model/namespace.js.map +1 -1
- package/dist/llcsharp/model/property.js +1 -0
- package/dist/llcsharp/model/property.js.map +1 -1
- package/dist/llcsharp/operation/api-class.js +1 -0
- package/dist/llcsharp/operation/api-class.js.map +1 -1
- package/dist/llcsharp/operation/method.d.ts.map +1 -1
- package/dist/llcsharp/operation/method.js +20 -27
- package/dist/llcsharp/operation/method.js.map +1 -1
- package/dist/llcsharp/operation/namespace.js +1 -0
- package/dist/llcsharp/operation/namespace.js.map +1 -1
- package/dist/llcsharp/operation/parameter.js +1 -0
- package/dist/llcsharp/operation/parameter.js.map +1 -1
- package/dist/llcsharp/project.d.ts.map +1 -1
- package/dist/llcsharp/project.js +3 -1
- package/dist/llcsharp/project.js.map +1 -1
- package/dist/llcsharp/schema/Uuid.js +1 -0
- package/dist/llcsharp/schema/Uuid.js.map +1 -1
- package/dist/llcsharp/schema/array.js +1 -0
- package/dist/llcsharp/schema/array.js.map +1 -1
- package/dist/llcsharp/schema/binary.js +1 -0
- package/dist/llcsharp/schema/binary.js.map +1 -1
- package/dist/llcsharp/schema/boolean.js +1 -0
- package/dist/llcsharp/schema/boolean.js.map +1 -1
- package/dist/llcsharp/schema/byte-array.js +1 -0
- package/dist/llcsharp/schema/byte-array.js.map +1 -1
- package/dist/llcsharp/schema/char.js +1 -0
- package/dist/llcsharp/schema/char.js.map +1 -1
- package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
- package/dist/llcsharp/schema/date-time.js +1 -0
- package/dist/llcsharp/schema/date-time.js.map +1 -1
- package/dist/llcsharp/schema/date.js +1 -0
- package/dist/llcsharp/schema/date.js.map +1 -1
- package/dist/llcsharp/schema/duration.js +1 -0
- package/dist/llcsharp/schema/duration.js.map +1 -1
- package/dist/llcsharp/schema/enum.js +1 -0
- package/dist/llcsharp/schema/enum.js.map +1 -1
- package/dist/llcsharp/schema/integer.js +1 -0
- package/dist/llcsharp/schema/integer.js.map +1 -1
- package/dist/llcsharp/schema/object.js +1 -0
- package/dist/llcsharp/schema/object.js.map +1 -1
- package/dist/llcsharp/schema/password.js +2 -1
- package/dist/llcsharp/schema/password.js.map +1 -1
- package/dist/llcsharp/schema/primitive.js +1 -0
- package/dist/llcsharp/schema/primitive.js.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.d.ts +2 -3
- package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.js +4 -0
- package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
- package/dist/llcsharp/schema/string.d.ts.map +1 -1
- package/dist/llcsharp/schema/string.js +1 -0
- package/dist/llcsharp/schema/string.js.map +1 -1
- package/dist/llcsharp/schema/uri.d.ts +10 -0
- package/dist/llcsharp/schema/uri.d.ts.map +1 -0
- package/dist/llcsharp/schema/uri.js +25 -0
- package/dist/llcsharp/schema/uri.js.map +1 -0
- package/dist/llcsharp/validations.js +1 -0
- package/dist/llcsharp/validations.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +7 -0
- package/dist/main.js.map +1 -1
- package/dist/models/model-extensions.js +7 -6
- package/dist/models/model-extensions.js.map +1 -1
- package/dist/module/module-class.js +1 -0
- package/dist/module/module-class.js.map +1 -1
- package/dist/module/module-namespace.js +1 -0
- package/dist/module/module-namespace.js.map +1 -1
- package/dist/plugins/add-azure-completers-v2.js +1 -0
- package/dist/plugins/add-azure-completers-v2.js.map +1 -1
- package/dist/plugins/create-commands-v2.d.ts.map +1 -1
- package/dist/plugins/create-commands-v2.js +4 -2
- package/dist/plugins/create-commands-v2.js.map +1 -1
- package/dist/plugins/cs-namer-v2.js +4 -3
- package/dist/plugins/cs-namer-v2.js.map +1 -1
- package/dist/plugins/llcsharp-v2.js +1 -0
- package/dist/plugins/llcsharp-v2.js.map +1 -1
- package/dist/plugins/modifiers-v2.d.ts +4 -0
- package/dist/plugins/modifiers-v2.d.ts.map +1 -1
- package/dist/plugins/modifiers-v2.js +69 -13
- package/dist/plugins/modifiers-v2.js.map +1 -1
- package/dist/plugins/plugin-create-inline-properties.d.ts.map +1 -1
- package/dist/plugins/plugin-create-inline-properties.js +16 -1
- package/dist/plugins/plugin-create-inline-properties.js.map +1 -1
- package/dist/plugins/plugin-tweak-m4-model.js +4 -3
- package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
- package/dist/plugins/plugin-tweak-model-azure-v2.js +4 -3
- package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -1
- package/dist/plugins/plugin-tweak-model.js +15 -14
- package/dist/plugins/plugin-tweak-model.js.map +1 -1
- package/dist/plugins/powershell-v2.d.ts.map +1 -1
- package/dist/plugins/powershell-v2.js +11 -0
- package/dist/plugins/powershell-v2.js.map +1 -1
- package/dist/plugins/ps-namer-v2.js +1 -0
- package/dist/plugins/ps-namer-v2.js.map +1 -1
- package/dist/plugins/sdk-cs-namer.d.ts +3 -0
- package/dist/plugins/sdk-cs-namer.d.ts.map +1 -0
- package/dist/plugins/sdk-cs-namer.js +213 -0
- package/dist/plugins/sdk-cs-namer.js.map +1 -0
- package/dist/plugins/sdk-generate.d.ts +3 -0
- package/dist/plugins/sdk-generate.d.ts.map +1 -0
- package/dist/plugins/sdk-generate.js +60 -0
- package/dist/plugins/sdk-generate.js.map +1 -0
- package/dist/plugins/sdk-tweak-model.d.ts +3 -0
- package/dist/plugins/sdk-tweak-model.d.ts.map +1 -0
- package/dist/plugins/sdk-tweak-model.js +198 -0
- package/dist/plugins/sdk-tweak-model.js.map +1 -0
- package/dist/sdk/project.d.ts +44 -0
- package/dist/sdk/project.d.ts.map +1 -0
- package/dist/sdk/project.js +45 -0
- package/dist/sdk/project.js.map +1 -0
- package/dist/sdk/state.d.ts +23 -0
- package/dist/sdk/state.d.ts.map +1 -0
- package/dist/sdk/state.js +28 -0
- package/dist/sdk/state.js.map +1 -0
- package/dist/sdk/utility.d.ts +5 -0
- package/dist/sdk/utility.d.ts.map +1 -0
- package/dist/sdk/utility.js +17 -0
- package/dist/sdk/utility.js.map +1 -0
- package/dist/utils/PwshModel.js +1 -0
- package/dist/utils/PwshModel.js.map +1 -1
- package/dist/utils/SdkModel.d.ts +7 -0
- package/dist/utils/SdkModel.d.ts.map +1 -0
- package/dist/utils/SdkModel.js +17 -0
- package/dist/utils/SdkModel.js.map +1 -0
- package/dist/utils/command-operation.d.ts +1 -0
- package/dist/utils/command-operation.d.ts.map +1 -1
- package/dist/utils/command-operation.js +2 -2
- package/dist/utils/command-operation.js.map +1 -1
- package/dist/utils/components.d.ts +2 -0
- package/dist/utils/components.d.ts.map +1 -1
- package/dist/utils/components.js +1 -0
- package/dist/utils/components.js.map +1 -1
- package/dist/utils/extensions.js +1 -0
- package/dist/utils/extensions.js.map +1 -1
- package/dist/utils/http-definitions.js +1 -0
- package/dist/utils/http-definitions.js.map +1 -1
- package/dist/utils/http-operation.js +1 -0
- package/dist/utils/http-operation.js.map +1 -1
- package/dist/utils/info.js +1 -0
- package/dist/utils/info.js.map +1 -1
- package/dist/utils/model-state.js +1 -0
- package/dist/utils/model-state.js.map +1 -1
- package/dist/utils/powershell-comment.js +11 -10
- package/dist/utils/powershell-comment.js.map +1 -1
- package/dist/utils/programatic-operation.js +2 -2
- package/dist/utils/programatic-operation.js.map +1 -1
- package/dist/utils/resolve-conflicts.js +1 -0
- package/dist/utils/resolve-conflicts.js.map +1 -1
- package/dist/utils/schema.js +1 -0
- package/dist/utils/schema.js.map +1 -1
- package/dist/utils/security-scheme.js +1 -0
- package/dist/utils/security-scheme.js.map +1 -1
- package/dist/utils/uid.js +1 -0
- package/dist/utils/uid.js.map +1 -1
- package/package.json +6 -5
- package/readme.md +5 -1
- package/resources/psruntime/Attributes/ExternalDocsAttribute.cs +30 -0
- package/resources/psruntime/BuildTime/Models/PsMarkdownTypes.cs +39 -4
- package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +8 -2
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +6 -0
- package/resources/runtime/csharp/client/Context.cs +33 -0
- package/resources/runtime/csharp/client/InfoAttribute.cs +1 -0
- package/resources/runtime/csharp/client/InputHandler.cs +22 -0
- package/resources/runtime/csharp/pipeline/Events.cs +2 -2
- package/resources/templates/azureMethod.ejs +4 -0
- package/resources/templates/azureMethodGroup.ejs +45 -0
- package/resources/templates/azureServiceClient.ejs +71 -0
- package/resources/templates/extensionMethod.ejs +57 -0
- package/resources/templates/extensions.ejs +19 -0
- package/resources/templates/method.ejs +46 -0
- package/resources/templates/methodBodyRestCall.ejs +183 -0
- package/resources/templates/methodGroup.ejs +7 -0
- package/resources/templates/methodGroupInterface.ejs +53 -0
- package/resources/templates/model.ejs +71 -0
- package/resources/templates/serviceClientBody.ejs +305 -0
- package/resources/templates/serviceClientInterface.ejs +54 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<%- project.commentHeader %>
|
|
2
|
+
|
|
3
|
+
namespace <%- project.namespace %>
|
|
4
|
+
{
|
|
5
|
+
using System.Linq;
|
|
6
|
+
using Microsoft.Rest;
|
|
7
|
+
<% project.model.usings.forEach(function(using){ -%>
|
|
8
|
+
using <%- using %>;
|
|
9
|
+
<% }); -%>
|
|
10
|
+
|
|
11
|
+
<% if (project.model.info.description) { -%>
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// <%- project.model.info.description %>
|
|
14
|
+
/// </summary>
|
|
15
|
+
<% } -%>
|
|
16
|
+
<% var client = project.model.info.title -%>
|
|
17
|
+
public partial class <%- client %> : Microsoft.Rest.ServiceClient<<%- client %>>, I<%- client %>, IAzureClient
|
|
18
|
+
{
|
|
19
|
+
<%# ToDo: add ServiceClientBodyTemplate -%>
|
|
20
|
+
<%- include('serviceClientBody', {project: project}) -%>
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// An optional partial-method to perform custom initialization.
|
|
23
|
+
/// </summary>
|
|
24
|
+
partial void CustomInitialize();
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
/// Initializes client properties.
|
|
28
|
+
/// </summary>
|
|
29
|
+
private void Initialize()
|
|
30
|
+
{
|
|
31
|
+
<% project.model.operationGroups.forEach(function(methodGroup){ -%>
|
|
32
|
+
this.<%- methodGroup.$key %> = new <%- methodGroup.$key %>Operations(this);
|
|
33
|
+
<% }); -%>
|
|
34
|
+
this.BaseUri = new System.Uri("https://management.azure.com");
|
|
35
|
+
<% project.model.globalParameters.filter(p => p.language.default.name != '$host' && !!p.clientDefaultValue).forEach(function(parameter){ -%>
|
|
36
|
+
this.<%- parameter.language.default.name %> = <%- parameter.schema.type == 'string' || (parameter.schema.type == 'constant' && parameter.schema.valueType.type == 'string') ? `"${parameter.clientDefaultValue}"`: parameter.clientDefaultValue %>;
|
|
37
|
+
<%}); -%>
|
|
38
|
+
SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
|
|
39
|
+
{
|
|
40
|
+
Formatting = Newtonsoft.Json.Formatting.Indented,
|
|
41
|
+
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
|
|
42
|
+
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
|
|
43
|
+
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
|
|
44
|
+
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
|
|
45
|
+
ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
|
|
46
|
+
Converters = new System.Collections.Generic.List<Newtonsoft.Json.JsonConverter>
|
|
47
|
+
{
|
|
48
|
+
new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
<%# ToDo: need support for NeedsTransformationConverter#1 -%>
|
|
52
|
+
DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
|
|
53
|
+
{
|
|
54
|
+
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
|
|
55
|
+
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
|
|
56
|
+
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
|
|
57
|
+
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
|
|
58
|
+
ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
|
|
59
|
+
Converters = new System.Collections.Generic.List<Newtonsoft.Json.JsonConverter>
|
|
60
|
+
{
|
|
61
|
+
new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
<%# ToDo: need support for polymorphicType -%>
|
|
65
|
+
CustomInitialize();
|
|
66
|
+
<%# ToDo: need support for NeedsTransformationConverter#2 -%>
|
|
67
|
+
DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter());
|
|
68
|
+
<%# ToDo: Add method whose group is empty, and need to check in which case the group is empty.-%>
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<%# ToDo: currently assume the SyncMethodsGenerationMode is Essential type, and need to add support for other types -%>
|
|
2
|
+
/// <summary>
|
|
3
|
+
/// <%=method.language.default.description%>
|
|
4
|
+
<%# ToDo: add support for externaldocsurl -%>
|
|
5
|
+
/// </summary>
|
|
6
|
+
<%# ToDo: add <remarks> if there are both description and summary -%>
|
|
7
|
+
/// <param name='operations'>
|
|
8
|
+
/// The operations group for this extension method.
|
|
9
|
+
/// </param>
|
|
10
|
+
<% if(method.parameters) { method.parameters.filter(p => p.implementation != 'Client').forEach(function (parameter) {-%>
|
|
11
|
+
/// <param name='<%-parameter.language.default.serializedName%>'>
|
|
12
|
+
/// <%=parameter.language.default.description%>
|
|
13
|
+
/// </param>
|
|
14
|
+
<% });}-%>
|
|
15
|
+
<%# ToDo: add support for GetObsoleteAttribute-%>
|
|
16
|
+
<%# ToDo: add support for AccessModifier, assume public for the time being-%>
|
|
17
|
+
public static <%-method.language.default.returnType%> <%-method.language.default.name%>(this I<%-methodGroup.$key%>Operations operations<%- method.language.default.syncMethodParameterDeclaration ? ', ' + method.language.default.syncMethodParameterDeclaration: '' %>)
|
|
18
|
+
{
|
|
19
|
+
<%# ToDo: need to handle different return type, body, header and the others including no return type-%>
|
|
20
|
+
<% if(method.language.default.returnType != 'void') {-%>
|
|
21
|
+
return ((I<%-methodGroup.$key%>Operations)operations).<%-method.language.default.name%>Async(<%-method.language.default.syncMethodInvocationArgs%>).GetAwaiter().GetResult();
|
|
22
|
+
<% } else { -%>
|
|
23
|
+
((I<%-methodGroup.$key%>Operations)operations).<%-method.language.default.name%>Async(<%-method.language.default.syncMethodInvocationArgs%>).GetAwaiter().GetResult();
|
|
24
|
+
<% } -%>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
/// <%=method.language.default.description%>
|
|
29
|
+
<%# ToDo: add support for externaldocsurl -%>
|
|
30
|
+
/// </summary>
|
|
31
|
+
<%# ToDo: add <remarks> if there are both description and summary -%>
|
|
32
|
+
/// <param name='operations'>
|
|
33
|
+
/// The operations group for this extension method.
|
|
34
|
+
/// </param>
|
|
35
|
+
<% if(method.language.default.parameters) { method.parameters.filter(p => p.implementation != 'Client').forEach(function (parameter) {-%>
|
|
36
|
+
/// <param name='<%-parameter.language.default.serializedName%>'>
|
|
37
|
+
/// <%=parameter.language.default.description%>
|
|
38
|
+
/// </param>
|
|
39
|
+
<% });}-%>
|
|
40
|
+
/// <param name='cancellationToken'>
|
|
41
|
+
/// The cancellation token.
|
|
42
|
+
/// </param>
|
|
43
|
+
<%# ToDo: add support for GetObsoleteAttribute-%>
|
|
44
|
+
<%# ToDo: add support for AccessModifier, assume public for the time being-%>
|
|
45
|
+
public static async System.Threading.Tasks.Task<%- method.language.default.returnType != 'void' ? '<' + methodGroup.$key + '>' : ''%> <%-method.language.default.name%>Async(this I<%-methodGroup.$key%>Operations operations<%- method.language.default.asyncMethodParameterDeclaration ? ', ' + method.language.default.asyncMethodParameterDeclaration: '' %>)
|
|
46
|
+
{
|
|
47
|
+
<%# ToDo: need to handle different return type, body, header and the others including no return type-%>
|
|
48
|
+
<% if(method.language.default.returnType != 'void') {-%>
|
|
49
|
+
<%# ToDo: add support for primitive return-%>
|
|
50
|
+
using (var _result = await operations.<%-method.language.default.name%>WithHttpMessagesAsync(null, <%-method.language.default.asyncMethodInvocationArgs%>).ConfigureAwait(false))
|
|
51
|
+
{
|
|
52
|
+
return _result.Body;
|
|
53
|
+
}
|
|
54
|
+
<% } else { -%>
|
|
55
|
+
(await operations.<%-method.language.default.name%>WithHttpMessagesAsync(null, <%-method.language.default.asyncMethodInvocationArgs%>).ConfigureAwait(false)).Dispose();
|
|
56
|
+
<% }-%>
|
|
57
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<%- project.commentHeader %>
|
|
2
|
+
|
|
3
|
+
namespace <%- project.namespace %>
|
|
4
|
+
{
|
|
5
|
+
<% project.model.usings.forEach(function(using){ -%>
|
|
6
|
+
using <%- using %>;
|
|
7
|
+
<% }); -%>
|
|
8
|
+
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// Extension methods for <%- methodGroup.$key %>Operations
|
|
11
|
+
/// </summary>
|
|
12
|
+
public static partial class <%- methodGroup.$key %>OperationsExtensions
|
|
13
|
+
{
|
|
14
|
+
<% methodGroup.operations.forEach(function(method){ -%>
|
|
15
|
+
<%# ToDo: add support for ExcludeFromInterface-%>
|
|
16
|
+
<%- include('extensionMethod', {method: method, group: methodGroup}) %>
|
|
17
|
+
<% }); -%>
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<% if (method.language.default.description) {-%>
|
|
2
|
+
/// <summary>
|
|
3
|
+
/// <%= method.language.default.description%>
|
|
4
|
+
<%# ToDo: add externaldocsurl -%>
|
|
5
|
+
/// </summary>
|
|
6
|
+
<% };-%>
|
|
7
|
+
<%# ToDo: add remark if both description and summary is provided, question here is in m4, there is no summary provided-%>
|
|
8
|
+
<% if(method.parameters) { method.parameters.filter(p => p.implementation != 'Client').forEach(function (parameter) {-%>
|
|
9
|
+
<%# ToDo: should use camel name instead of pascal name here -%>
|
|
10
|
+
/// <param name='<%-parameter.language.default.name%>'>
|
|
11
|
+
/// <%=parameter.language.default.description%>
|
|
12
|
+
/// </param>
|
|
13
|
+
<% });}-%>
|
|
14
|
+
/// <param name='customHeaders'>
|
|
15
|
+
/// Headers that will be added to request.
|
|
16
|
+
/// </param>
|
|
17
|
+
/// <param name='cancellationToken'>
|
|
18
|
+
/// The cancellation token.
|
|
19
|
+
/// </param>
|
|
20
|
+
/// <exception cref="Microsoft.Rest.Azure.CloudException">
|
|
21
|
+
/// Thrown when the operation returned an invalid status code
|
|
22
|
+
/// </exception>
|
|
23
|
+
<% if (method.responses && method.responses.filter(p => p.schema).length > 0) {-%>
|
|
24
|
+
/// <exception cref="Microsoft.Rest.SerializationException">
|
|
25
|
+
/// Thrown when unable to deserialize the response
|
|
26
|
+
/// </exception>
|
|
27
|
+
<% };-%>
|
|
28
|
+
<%# ToDo: add isnullable check -%>
|
|
29
|
+
<% if (method.parameters.filter(p => p.schema.type != 'constant' && p.required)) {-%>
|
|
30
|
+
/// <exception cref="Microsoft.Rest.ValidationException">
|
|
31
|
+
/// Thrown when a required parameter is null
|
|
32
|
+
/// </exception>
|
|
33
|
+
/// <exception cref="System.ArgumentNullException">
|
|
34
|
+
/// Thrown when a required parameter is null
|
|
35
|
+
/// </exception>
|
|
36
|
+
<% };-%>
|
|
37
|
+
/// <return>
|
|
38
|
+
/// A response object containing the response body and response headers.
|
|
39
|
+
/// </return>
|
|
40
|
+
<%# ToDo: add GetObsoleteAttribute -%>
|
|
41
|
+
<%# ToDo: need to check in which case the method is not public(AccessModifier), currently set it to public -%>
|
|
42
|
+
public async System.Threading.Tasks.Task<<%-method.language.default.responseType%>> <%-method.language.default.name%>WithHttpMessagesAsync(<%-method.language.default.asyncMethodParameterDeclarationWithCustomHeader%>)
|
|
43
|
+
{
|
|
44
|
+
<%# ToDo: add support for method.Flavor, currently assume it is RestCall -%>
|
|
45
|
+
<%- include('methodBodyRestCall', {method: method}) -%>
|
|
46
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<% if(method.parameters) { method.parameters.filter(p => (p.schema.type != 'constant' && p.language.default.name != '$host') || p.language.default.name == 'ApiVersion').forEach(function (parameter) {-%>
|
|
2
|
+
<%# ToDo: add check IsNullable with required -%>
|
|
3
|
+
<% var prefix = parameter.implementation == 'Client' ? 'this.Client.' : ''-%>
|
|
4
|
+
<% if (parameter.required) {-%>
|
|
5
|
+
if (<%-prefix%><%-parameter.language.default.name%> == null)
|
|
6
|
+
{
|
|
7
|
+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "<%-prefix%><%-parameter.language.default.name%>");
|
|
8
|
+
}
|
|
9
|
+
<% } -%>
|
|
10
|
+
<%# ToDo: add support for parameter.CanBeValidated && (Model.HttpMethod != HttpMethod.Patch || parameter.Location != ParameterLocation.Body)-%>
|
|
11
|
+
<%});}-%>
|
|
12
|
+
<%# ToDo: add support for p => p.IsConstant && !p.IsClientProperty -%>
|
|
13
|
+
<%# ToDo: add support for BuildInputMappings -%>
|
|
14
|
+
// Tracing
|
|
15
|
+
bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
|
|
16
|
+
string _invocationId = null;
|
|
17
|
+
if (_shouldTrace)
|
|
18
|
+
{
|
|
19
|
+
_invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
|
|
20
|
+
System.Collections.Generic.Dictionary<string, object> tracingParameters = new System.Collections.Generic.Dictionary<string, object>();
|
|
21
|
+
<%# ToDo: add support for Model.LogicalParameters.Where(p => !p.IsClientProperty)-%>
|
|
22
|
+
tracingParameters.Add("cancellationToken", cancellationToken);
|
|
23
|
+
Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "<%-method.language.default.name%>", tracingParameters);
|
|
24
|
+
}
|
|
25
|
+
// Construct URL
|
|
26
|
+
<%# ToDo: may need to support AbsoluteUrl -%>
|
|
27
|
+
var _baseUrl = this.Client.BaseUri.AbsoluteUri;
|
|
28
|
+
<%# ToDo: buildurl, currently only added simple cases, besides we need to handle skip url encoding -%>
|
|
29
|
+
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "<%-method.requests[0].protocol.http.path.substring(1)%>").ToString();
|
|
30
|
+
<%if (method.parameters) { method.parameters.filter(p => p.protocol.http.in == 'path').forEach(function (pathParameter) { -%>
|
|
31
|
+
_url = _url.Replace("{<%-pathParameter.language.default.serializedName%>}", System.Uri.EscapeDataString(this.Client.<%-pathParameter.language.default.name%>));
|
|
32
|
+
<% });}-%>
|
|
33
|
+
System.Collections.Generic.List<string> _queryParameters = new System.Collections.Generic.List<string>();
|
|
34
|
+
<%if (method.parameters) { method.parameters.filter(p => p.protocol.http.in == 'query').forEach(function (queryParameter) { -%>
|
|
35
|
+
<% var prefix = queryParameter.implementation == 'Client' ? 'this.Client.' : ''-%>
|
|
36
|
+
if (<%-prefix%><%-queryParameter.language.default.name%> != null)
|
|
37
|
+
{
|
|
38
|
+
_queryParameters.Add(string.Format("<%-queryParameter.language.default.serializedName%>={0}", System.Uri.EscapeDataString(<%-prefix%><%-queryParameter.language.default.name%>)));
|
|
39
|
+
}
|
|
40
|
+
<% });}-%>
|
|
41
|
+
if (_queryParameters.Count > 0)
|
|
42
|
+
{
|
|
43
|
+
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
|
|
44
|
+
}
|
|
45
|
+
// Create HTTP transport objects
|
|
46
|
+
var _httpRequest = new System.Net.Http.HttpRequestMessage();
|
|
47
|
+
System.Net.Http.HttpResponseMessage _httpResponse = null;
|
|
48
|
+
_httpRequest.Method = new System.Net.Http.HttpMethod("<%-method.requests[0].protocol.http.method.toUpperCase()%>");
|
|
49
|
+
_httpRequest.RequestUri = new System.Uri(_url);
|
|
50
|
+
// Set Headers
|
|
51
|
+
<%# ToDo: Add headers except for following default ones -%>
|
|
52
|
+
if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
|
|
53
|
+
{
|
|
54
|
+
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
|
|
55
|
+
}
|
|
56
|
+
if (this.Client.AcceptLanguage != null)
|
|
57
|
+
{
|
|
58
|
+
if (_httpRequest.Headers.Contains("accept-language"))
|
|
59
|
+
{
|
|
60
|
+
_httpRequest.Headers.Remove("accept-language");
|
|
61
|
+
}
|
|
62
|
+
_httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if (customHeaders != null)
|
|
67
|
+
{
|
|
68
|
+
foreach(var _header in customHeaders)
|
|
69
|
+
{
|
|
70
|
+
if (_httpRequest.Headers.Contains(_header.Key))
|
|
71
|
+
{
|
|
72
|
+
_httpRequest.Headers.Remove(_header.Key);
|
|
73
|
+
}
|
|
74
|
+
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Serialize Request
|
|
78
|
+
string _requestContent = null;
|
|
79
|
+
<%# ToDo: add RequestBody, formdata support-%>
|
|
80
|
+
<%# ToDo: Need to confirm in which case Settings.AddCredentials is false -%>
|
|
81
|
+
// Set Credentials
|
|
82
|
+
if (this.Client.Credentials != null)
|
|
83
|
+
{
|
|
84
|
+
cancellationToken.ThrowIfCancellationRequested();
|
|
85
|
+
await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
|
|
86
|
+
}
|
|
87
|
+
// Send Request
|
|
88
|
+
if (_shouldTrace)
|
|
89
|
+
{
|
|
90
|
+
Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
|
|
91
|
+
}
|
|
92
|
+
cancellationToken.ThrowIfCancellationRequested();
|
|
93
|
+
<%# ToDo: Add support for primary type return and head method-%>
|
|
94
|
+
_httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
|
|
95
|
+
if (_shouldTrace)
|
|
96
|
+
{
|
|
97
|
+
Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
|
|
101
|
+
cancellationToken.ThrowIfCancellationRequested();
|
|
102
|
+
string _responseContent = null;
|
|
103
|
+
|
|
104
|
+
if (<%-method.language.default.failureStatusCodePredicate%>)
|
|
105
|
+
{
|
|
106
|
+
var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
|
|
107
|
+
<%# ToDo: not sure whether there is the case that there is no default response(error). If so, we will need to add support for it -%>
|
|
108
|
+
try
|
|
109
|
+
{
|
|
110
|
+
<%# ToDo: Need to add support for primary type -%>
|
|
111
|
+
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
112
|
+
CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, this.Client.DeserializationSettings);
|
|
113
|
+
if (_errorBody != null)
|
|
114
|
+
{
|
|
115
|
+
ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
|
|
116
|
+
ex.Body = _errorBody;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (Newtonsoft.Json.JsonException)
|
|
120
|
+
{
|
|
121
|
+
// Ignore the exception
|
|
122
|
+
}
|
|
123
|
+
ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
|
|
124
|
+
ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
|
|
125
|
+
if (_httpResponse.Headers.Contains("x-ms-request-id"))
|
|
126
|
+
{
|
|
127
|
+
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
|
|
128
|
+
}
|
|
129
|
+
if (_shouldTrace)
|
|
130
|
+
{
|
|
131
|
+
Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
|
|
132
|
+
}
|
|
133
|
+
_httpRequest.Dispose();
|
|
134
|
+
if (_httpResponse != null)
|
|
135
|
+
{
|
|
136
|
+
_httpResponse.Dispose();
|
|
137
|
+
}
|
|
138
|
+
throw ex;
|
|
139
|
+
}
|
|
140
|
+
// Create Result
|
|
141
|
+
var _result = new <%-method.language.default.responseType%>();
|
|
142
|
+
_result.Request = _httpRequest;
|
|
143
|
+
_result.Response = _httpResponse;
|
|
144
|
+
<%# Todo: need to add support for head method, see InitializeResponseBody for details-%>
|
|
145
|
+
if (_httpResponse.Headers.Contains("x-ms-request-id"))
|
|
146
|
+
{
|
|
147
|
+
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
|
|
148
|
+
}
|
|
149
|
+
<%method.responses.filter(r => r.schema).forEach(function(resp) {-%>
|
|
150
|
+
// Deserialize Response
|
|
151
|
+
if ((int)_statusCode == <%-resp.protocol.http.statusCodes[0]%>)
|
|
152
|
+
{
|
|
153
|
+
<%# ToDo: Need to add support for primary type -%>
|
|
154
|
+
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
|
|
155
|
+
<%# ToDo: support for XmlSerialization, guess we do not need it actually -%>
|
|
156
|
+
try
|
|
157
|
+
{
|
|
158
|
+
<%# ToDo: we assume the return is object, need to add support for other types including support nullable -%>
|
|
159
|
+
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<<%-resp.schema.language.csharp.name%>>(_responseContent, this.Client.DeserializationSettings);
|
|
160
|
+
}
|
|
161
|
+
catch (Newtonsoft.Json.JsonException ex)
|
|
162
|
+
{
|
|
163
|
+
_httpRequest.Dispose();
|
|
164
|
+
if (_httpResponse != null)
|
|
165
|
+
{
|
|
166
|
+
_httpResponse.Dispose();
|
|
167
|
+
}
|
|
168
|
+
throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
<% });-%>
|
|
172
|
+
<%# ToDo: add support for case Model.ReturnType.Body != null && Model.DefaultResponse.Body != null && !Model.Responses.Any()-%>
|
|
173
|
+
<%# ToDo: add support for case there are return in headers-%>
|
|
174
|
+
if (_shouldTrace)
|
|
175
|
+
{
|
|
176
|
+
Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
|
|
177
|
+
}
|
|
178
|
+
return _result;
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<%- project.commentHeader %>
|
|
2
|
+
|
|
3
|
+
namespace <%- project.namespace %>
|
|
4
|
+
{
|
|
5
|
+
<% project.model.usings.forEach(function(using){ -%>
|
|
6
|
+
using <%- using %>;
|
|
7
|
+
<% }); -%>
|
|
8
|
+
|
|
9
|
+
<% var typeName = methodGroup.$key + 'Operations' -%>
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// <%- typeName %> operations.
|
|
12
|
+
/// </summary>
|
|
13
|
+
public partial interface I<%- typeName%>
|
|
14
|
+
{
|
|
15
|
+
<% methodGroup.operations.forEach(function(method){ -%>
|
|
16
|
+
<%# ToDo: support for ExcludeFromInterface -%>
|
|
17
|
+
<% if(method.language.default.description) {-%>
|
|
18
|
+
/// <summary>
|
|
19
|
+
/// <%= method.language.default.description%>
|
|
20
|
+
<%# ToDo: support for ExternalDocsUrl -%>
|
|
21
|
+
/// </summary>
|
|
22
|
+
/// <remarks>
|
|
23
|
+
/// <%= method.language.default.description%>
|
|
24
|
+
/// </remarks>
|
|
25
|
+
<% };-%>
|
|
26
|
+
<% method.parameters.filter(p=>p.implementation != 'Client').forEach(function(parameter){-%>
|
|
27
|
+
/// <param name='<%-parameter.language.default.name%>'>
|
|
28
|
+
/// <%= parameter.language.default.description%>
|
|
29
|
+
/// </param>
|
|
30
|
+
<% }); -%>
|
|
31
|
+
/// <param name='customHeaders'>
|
|
32
|
+
/// The headers that will be added to request.
|
|
33
|
+
/// </param>
|
|
34
|
+
/// <param name='cancellationToken'>
|
|
35
|
+
/// </param>
|
|
36
|
+
<%# ToDo: Need to figure out whether we could hand code the exception here -%>
|
|
37
|
+
/// <exception cref="Microsoft.Rest.Azure.CloudException">
|
|
38
|
+
/// </exception>
|
|
39
|
+
<% if (method.responses.filter(r => r.schema).length > 0) {-%>
|
|
40
|
+
/// <exception cref="Microsoft.Rest.SerializationException">
|
|
41
|
+
/// Thrown when unable to deserialize the response
|
|
42
|
+
/// </exception>
|
|
43
|
+
<% }; -%>
|
|
44
|
+
<% if (method.parameters.filter(p => p.required && p.nullable).length > 0) {-%>
|
|
45
|
+
/// <exception cref="Microsoft.Rest.ValidationException">
|
|
46
|
+
/// Thrown when a required parameter is null
|
|
47
|
+
/// </exception>
|
|
48
|
+
<% }; -%>
|
|
49
|
+
<%# ToDo: support GetObsoleteAttribute, deprecated message?-%>
|
|
50
|
+
System.Threading.Tasks.Task<<%-method.language.default.responseType %>> <%- method.language.default.name%>WithHttpMessagesAsync(<%-method.language.default.asyncMethodParameterDeclarationWithCustomHeader%>);
|
|
51
|
+
<% }); -%>
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<%- project.commentHeader %>
|
|
2
|
+
|
|
3
|
+
namespace <%- project.namespace %>.Models
|
|
4
|
+
{
|
|
5
|
+
using System.Linq;
|
|
6
|
+
|
|
7
|
+
<%# ToDo: need to populate effectiveDocumentation in the model-%>
|
|
8
|
+
<% if (model.language.default.description) {-%>
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// <%=model.language.default.description%>
|
|
11
|
+
/// </summary>
|
|
12
|
+
<% }-%>
|
|
13
|
+
<% if (model.summary && model.language.default.description) { -%>
|
|
14
|
+
/// <remarks>
|
|
15
|
+
/// <%=model.language.default.description %>
|
|
16
|
+
/// </remarks>
|
|
17
|
+
<% } -%>
|
|
18
|
+
<%# ToDo: support NeedsPolymorphicConverter-%>
|
|
19
|
+
<%# ToDo: support NeedsTransformationConverter-%>
|
|
20
|
+
<%# ToDo: support ObsoleteAttribute-%>
|
|
21
|
+
public partial class <%-model.language.default.name%><%- model.parents ? " : " + model.parents.immediate[0].language.default.name: ""%>
|
|
22
|
+
{
|
|
23
|
+
/// <summary>
|
|
24
|
+
/// Initializes a new instance of the <%= model.language.default.name%> class.
|
|
25
|
+
/// </summary>
|
|
26
|
+
public <%- model.language.default.name%>()
|
|
27
|
+
{
|
|
28
|
+
<%#ToDo support for object model that contains ContainsConstantProperties-%>
|
|
29
|
+
CustomInit();
|
|
30
|
+
}
|
|
31
|
+
<%#ToDo support for constructorParameters in the model, the constructorParameter is mapped to properties for the time being%>
|
|
32
|
+
<% if (model.properties) {-%>
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Initializes a new instance of the <%=model.language.default.name%> class.
|
|
35
|
+
/// </summary>
|
|
36
|
+
<%#ToDo support for constructorParametersDocumentation in the model, priority 0-%>
|
|
37
|
+
<%model.properties.forEach(function(p) {-%>
|
|
38
|
+
/// <param name="<%-p.language.default.name%>"><%-p.language.default.description%></param>
|
|
39
|
+
<%});-%>
|
|
40
|
+
public <%- model.language.default.name%>(<%-model.language.default.constructorParametersDeclaration%>)
|
|
41
|
+
<%#ToDo support for BaseConstructorCall in the model-%>
|
|
42
|
+
{
|
|
43
|
+
<%#ToDo support for InstanceProperties in the model, non const properties, priority 0-%>
|
|
44
|
+
<%model.properties.forEach(function(p) {-%>
|
|
45
|
+
this.<%-p.language.csharp.name%> = <%-p.language.default.name%>;
|
|
46
|
+
<%});-%>
|
|
47
|
+
CustomInit();
|
|
48
|
+
}
|
|
49
|
+
<% };-%>
|
|
50
|
+
<%#ToDo support for ClassProperties in the model, const properties-%>
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
/// An initialization method that performs custom operations like setting defaults
|
|
54
|
+
/// </summary>
|
|
55
|
+
partial void CustomInit();
|
|
56
|
+
|
|
57
|
+
<%#ToDo support for InstanceProperties in the model, non const properties, priority 0, line 407-%>
|
|
58
|
+
<% if (model.properties) { model.properties.filter(p => p.schema.type != 'constant').forEach(function(p){-%>
|
|
59
|
+
/// <summary>
|
|
60
|
+
/// <%-p.language.csharp.formattedPropertySummary%>
|
|
61
|
+
/// </summary>
|
|
62
|
+
[Newtonsoft.Json.JsonProperty(PropertyName = "<%-p.serializedName%>")]
|
|
63
|
+
<% var type = p.schema.language.csharp.fullname-%>
|
|
64
|
+
<%type = p.schema.type == 'object' || type == 'string' ? type : type + '?'-%>
|
|
65
|
+
public <%-type %> <%-p.language.csharp.name%> {get; <%- p.readOnly ? "private " : ""-%>set; }
|
|
66
|
+
<% });} -%>
|
|
67
|
+
<%#ToDo support for ClassProperties in the model, const properties -%>
|
|
68
|
+
<%#ToDo support for ShouldValidateChain-%>
|
|
69
|
+
<%#ToDo support for ShouldGenerateXmlSerialization, guess we do not need to support it-%>
|
|
70
|
+
}
|
|
71
|
+
}
|