Skip to content

Commit 28a89ee

Browse files
Revert "Merge dev into master (#206)"
This reverts commit 86a1e7c.
1 parent 86a1e7c commit 28a89ee

File tree

21 files changed

+42
-357
lines changed

21 files changed

+42
-357
lines changed

GraphODataTemplateWriter.Test/TypeHelperTests.cs

Lines changed: 0 additions & 95 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,7 @@ and optionally :
109109

110110
Example :
111111

112-
` { "Template": "EntityCollectionPage", "SubProcessor": "NavigationCollectionProperty", "Type": "Request", "Name": "<Class><Property>CollectionPage", "Matches" : "includeThisType", "Exclude" : "ExcludedTypeName;OtherExcludedTypeName" }`
113-
114-
It is important to understand that subprocessors are mapped to methods that query the **OdcmModel** and return a set of OData objects. This mapping is maintained in [TemplateProcess.InitializeSubprocessor()](https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/blob/dev/src/GraphODataTemplateWriter/TemplateProcessor/TemplateProcessor.cs#L54). The language specific mappings exist in the [config directory](https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/tree/dev/src/GraphODataTemplateWriter/.config). Each OData object returned by the subprocessor is applied to the mapped template which results in a code file output per each OData object.
115-
116-
In the above example, the objects in result set of the NavigationCollectionProperty subprocessor will each be applied to the EntityCollectionPage template. Each result will be a code file for each object returned by the NavigationCollectionProperty subprocessor.
112+
` { "Template": "EntityType", "SubProcessor": "EntityType", "Type": "Model", "Name": "<Class>", "Matches" : "includeThisType", "Exclude" : "ExcludedTypeName;OtherExcludedTypeName" }`
117113

118114
#### SubProcessors
119115

Templates/CSharp/Base/EntityRequest.Base.template.tt

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,7 @@ public void AppendUpdateAsyncHeader(string entityName, string lowerCaseEntityNam
350350
{
351351
stringBuilder.Append(Environment.NewLine);
352352
stringBuilder.Append(" /// <param name=\"cancellationToken\">The <see cref=\"CancellationToken\"/> for the request.</param>");
353-
stringBuilder.Append(Environment.NewLine);
354-
stringBuilder.Append(" /// <exception cref=\"ClientException\">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>");
355-
}
353+
}
356354

357355
stringBuilder.Append(Environment.NewLine);
358356
stringBuilder.AppendFormat(" /// <returns>The updated {0}.</returns>", entityName);
@@ -392,58 +390,6 @@ public string GetEntityUpdateAsyncMethod(OdcmClass odcmClass, bool initializeCol
392390
stringBuilder.AppendFormat(" public async System.Threading.Tasks.Task<{0}> UpdateAsync({0} {1}ToUpdate, CancellationToken cancellationToken)", entityName, lowerCaseEntityName);
393391
stringBuilder.Append(Environment.NewLine);
394392
stringBuilder.Append(" {");
395-
stringBuilder.Append(Environment.NewLine);
396-
stringBuilder.AppendFormat(" if ({0}ToUpdate.AdditionalData != null)", lowerCaseEntityName);
397-
stringBuilder.Append(Environment.NewLine);
398-
stringBuilder.Append(" {");
399-
stringBuilder.Append(Environment.NewLine);
400-
stringBuilder.AppendFormat(" if ({0}ToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||", lowerCaseEntityName);
401-
stringBuilder.Append(Environment.NewLine);
402-
stringBuilder.AppendFormat(" {0}ToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))", lowerCaseEntityName);
403-
stringBuilder.Append(Environment.NewLine);
404-
stringBuilder.Append(" {");
405-
stringBuilder.Append(Environment.NewLine);
406-
stringBuilder.Append(" throw new ClientException(");
407-
stringBuilder.Append(Environment.NewLine);
408-
stringBuilder.Append(" new Error");
409-
stringBuilder.Append(Environment.NewLine);
410-
stringBuilder.Append(" {");
411-
stringBuilder.Append(Environment.NewLine);
412-
stringBuilder.Append(" Code = GeneratedErrorConstants.Codes.NotAllowed,");
413-
stringBuilder.Append(Environment.NewLine);
414-
stringBuilder.AppendFormat(" Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, {0}ToUpdate.GetType().Name)", lowerCaseEntityName);
415-
stringBuilder.Append(Environment.NewLine);
416-
stringBuilder.Append(" });");
417-
stringBuilder.Append(Environment.NewLine);
418-
stringBuilder.Append(" }");
419-
stringBuilder.Append(Environment.NewLine);
420-
stringBuilder.Append(" }");
421-
stringBuilder.Append(Environment.NewLine);
422-
stringBuilder.AppendFormat(" if ({0}ToUpdate.AdditionalData != null)", lowerCaseEntityName);
423-
stringBuilder.Append(Environment.NewLine);
424-
stringBuilder.Append(" {");
425-
stringBuilder.Append(Environment.NewLine);
426-
stringBuilder.AppendFormat(" if ({0}ToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||", lowerCaseEntityName);
427-
stringBuilder.Append(Environment.NewLine);
428-
stringBuilder.AppendFormat(" {0}ToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))", lowerCaseEntityName);
429-
stringBuilder.Append(Environment.NewLine);
430-
stringBuilder.Append(" {");
431-
stringBuilder.Append(Environment.NewLine);
432-
stringBuilder.Append(" throw new ClientException(");
433-
stringBuilder.Append(Environment.NewLine);
434-
stringBuilder.Append(" new Error");
435-
stringBuilder.Append(Environment.NewLine);
436-
stringBuilder.Append(" {");
437-
stringBuilder.Append(Environment.NewLine);
438-
stringBuilder.Append(" Code = GeneratedErrorConstants.Codes.NotAllowed,");
439-
stringBuilder.Append(Environment.NewLine);
440-
stringBuilder.AppendFormat(" Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, {0}ToUpdate.GetType().Name)", lowerCaseEntityName);
441-
stringBuilder.Append(Environment.NewLine);
442-
stringBuilder.Append(" });");
443-
stringBuilder.Append(Environment.NewLine);
444-
stringBuilder.Append(" }");
445-
stringBuilder.Append(Environment.NewLine);
446-
stringBuilder.Append(" }");
447393
stringBuilder.Append(Environment.NewLine);
448394
stringBuilder.AppendFormat(" this.ContentType = \"{0}\";", templateWriter.jsonContentType);
449395
stringBuilder.Append(Environment.NewLine);

Templates/CSharp/Base/IEntityRequest.Base.template.tt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@ public void AppendUpdateAsyncMethodHeader(string entityName, string lowerCaseEnt
274274
{
275275
stringBuilder.Append(Environment.NewLine);
276276
stringBuilder.Append(" /// <param name=\"cancellationToken\">The <see cref=\"CancellationToken\"/> for the request.</param>");
277-
stringBuilder.Append(Environment.NewLine);
278-
stringBuilder.Append(" /// <exception cref=\"ClientException\">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>");
279277
}
280278

281279
stringBuilder.Append(Environment.NewLine);

Templates/CSharp/Base/IRequestBuilder.Base.template.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public string GetInterfaceDefinition(string interfaceName)
4040
stringBuilder.Append(Environment.NewLine);
4141
stringBuilder.Append(" /// </summary>");
4242
stringBuilder.Append(Environment.NewLine);
43-
stringBuilder.AppendFormat(" public partial interface I{0} : IBaseRequestBuilder", interfaceName);
43+
stringBuilder.AppendFormat(" public partial interface I{0}", interfaceName);
4444

4545
return stringBuilder.ToString();
4646
}

Templates/CSharp/Base/SharedCSharp.template.tt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ bool logTemplateSrc = true;
1111
<#=writer.WriteHeader()#>
1212

1313
// **NOTE** This file was generated by a tool and any changes will be overwritten.
14-
// <auto-generated/>
1514

1615
<# if (logTemplateSrc) { #>
1716
// Template Source: <#= TemplateName(host.TemplateFile) #>

Templates/CSharp/Model/ComplexType.cs.tt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,10 @@ namespace <#=complex.Namespace.GetNamespaceName()#>
4848
// to disambiguate the type of the descendant class being sent.
4949
if (complex.IsBaseAbstractAndReferencedAsPropertyType() && !complex.IsAbstract)
5050
{
51-
#> /// <summary>
52-
/// Initializes a new instance of the <see cref="<#=complexTypeName#>"/> class.
53-
/// </summary>
54-
public <#=complexTypeName#>()
51+
#> public <#=complexTypeName#>()
5552
{
5653
this.ODataType = "<#=complex.FullName#>";
57-
}
58-
<#
54+
}<#
5955
}
6056
foreach(var property in complex.Properties)
6157
{

Templates/CSharp/Model/EnumType.cs.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace <#=enumT.Namespace.GetNamespaceName()#>
3030
#>
3131

3232
/// <summary>
33-
/// <#=emumMember.Name.ToUpperFirstChar().SplitCamelCase()#>
33+
/// <#=emumMember.Name.SplitCamelCase()#>
3434
/// </summary>
3535
<#=emumMember.Name.ToCheckedCase().GetSanitizedPropertyName()#> = <#=emumMember.Value#>,
3636
<#

Templates/PHP/Model/EnumType.php.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class <#=enumT.Name.ToUpperFirstChar()#> extends Enum
4242
<#
4343
} else {
4444
#>
45-
const <#= value.Name.ToUnderscorePHPEnum().ToUpper()#> = "<#= value.Name.ToCamelize()#>";
45+
const <#= value.Name.ToUnderscore().ToUpper()#> = "<#= value.Name.ToCamelize()#>";
4646
<# }
4747
count++;
4848
}

Templates/TypeScript/src/entity_types.ts.tt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
var enumTypes = model.GetEnumTypes();
1111
var complexTypes = model.GetComplexTypes();
1212
#>
13-
// Type definitions for the Microsoft Graph <VERSION_STRING>
13+
// Type definitions for the Microsoft Graph API
1414
// Project: https://github.com/microsoftgraph/msgraph-typescript-typings
1515
// Definitions by: Microsoft Graph Team <https://github.com/microsoftgraph>
16-
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
17-
// TypeScript Version: 2.1
16+
17+
<#= writer.WriteHeader() #>
1818

1919
export as namespace microsoftgraph;
2020

2121
<# foreach(var enumType in enumTypes) { #>
22-
export type <#= enumType.Name.UpperCaseFirstChar() #> = <#= enumType.GetEnumValues() #>;
22+
export type <#= enumType.Name.UpperCaseFirstChar() #> = <#= enumType.GetEnumValues() #>
2323
<# } #>
2424
<#
2525
foreach(var entityType in entityTypes)
@@ -28,11 +28,13 @@ export type <#= enumType.Name.UpperCaseFirstChar() #> = <#= enumType.GetEnumValu
2828
#>
2929

3030
export interface <#= entityType.Name.UpperCaseFirstChar() #><# if (entityType.Base != null) { #> extends <#= entityType.Base.Name.UpperCaseFirstChar() #><# }#> {
31+
3132
<# foreach(var prop in entityType.Properties.ToList()) { #>
3233
<# if (prop.LongDescription != null || prop.Description != null) { #>
3334
/** <#=prop.GetSanitizedLongDescription()#> */
3435
<# } #>
35-
<#= prop.Name #>?: <#= prop.GetTypeString() #>;
36+
<#= prop.Name #>?: <#= prop.GetTypeString() #>
37+
3638
<# } #>
3739
}
3840
<#
@@ -43,11 +45,13 @@ export interface <#= entityType.Name.UpperCaseFirstChar() #><# if (entityType.Ba
4345
{
4446
#>
4547
export interface <#= complexType.Name.UpperCaseFirstChar()#><# if (complexType.Base != null) { #> extends <#= complexType.Base.Name.UpperCaseFirstChar() #><# }#> {
48+
4649
<# foreach(var prop in complexType.Properties) { #>
4750
<# if (prop.LongDescription != null || prop.Description != null) { #>
4851
/** <#=prop.GetSanitizedLongDescription()#> */
4952
<# } #>
50-
<#= prop.Name #>?: <#= prop.GetTypeString() #>;
53+
<#= prop.Name #>?: <#= prop.GetTypeString() #>
54+
5155
<# } #>
5256
}
5357
<# } #>

0 commit comments

Comments
 (0)