Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
e51bfa4
Merge pull request #129 from microsoftgraph/master
MIchaelMainer Apr 24, 2018
7789b6f
Added metadata for April 2018 client library updates.
MIchaelMainer Apr 24, 2018
f7d492c
updated metadata files with clean chars for generation
MIchaelMainer Apr 25, 2018
d693f88
Merge pull request #130 from microsoftgraph/April2018sourceMetadata
MIchaelMainer Apr 26, 2018
cd91356
CSharp template updates to support withReferenceRequest generation
Apr 30, 2018
9c71a24
Add withReferenceRequest methods to Java/Android templates
Apr 30, 2018
7207c8a
Merge pull request #131 from microsoftgraph/withReferenceRequest-dele…
May 2, 2018
0d629f9
Fixing templates for java model generated files import statement for …
deepak2016 May 24, 2018
d8016e1
Update formatting for TemplateWriterSettings.json
MIchaelMainer May 24, 2018
3f208da
IEntityWithRefRequest - removed 2nd argument, it is only used in the …
MIchaelMainer May 24, 2018
91f1248
Updated IEntityWithRefRequest - removed erroneous argument
MIchaelMainer May 29, 2018
01a0640
added metadata for 2018-05-15
MIchaelMainer May 29, 2018
78bcec1
Incorporating review comments for the commit - Checking in changes to…
deepak2016 Jun 11, 2018
0a15fb5
Merge pull request #134 from microsoftgraph/betaMetadata
MIchaelMainer Jun 11, 2018
4397c2f
Merge pull request #133 from microsoftgraph/java-memory-fix
deepak2016 Jun 12, 2018
00d51cb
Fixing BaseMethodBody java template files to use import statements co…
deepak2016 Jun 20, 2018
522901d
Fixing import statements for BaseEntityCollectionPage tempalte. This …
deepak2016 Jun 20, 2018
b5dc00f
Fixing import statements for IBaseMethodRequestBuilder template. This…
deepak2016 Jun 21, 2018
aa01f7e
Merge pull request #135 from microsoftgraph/java-memory-fix
deepak2016 Jun 21, 2018
747a7d1
Merge pull request #136 from microsoftgraph/java-memory-fix
deepak2016 Jun 22, 2018
166fb57
Fixing BaseMethodBodyRequest template import statements. This templat…
deepak2016 Jun 22, 2018
9dc6afb
Fixing IBaseMethodBodyRequest template import statements. This templa…
deepak2016 Jun 22, 2018
8dcc9c7
Fixing BaseEntityCollectionResponse template import statement. This t…
deepak2016 Jun 22, 2018
bdd97cd
Merge pull request #137 from microsoftgraph/java-memory-fix
deepak2016 Jun 23, 2018
fc2d030
Fixing BaseMethodRequestBuilder template import statement. This templ…
deepak2016 Jun 25, 2018
274e9dd
Merge pull request #138 from microsoftgraph/java-memory-fix
deepak2016 Jun 26, 2018
559f045
Fixing BaseMethodRequest template import statements. This template ge…
deepak2016 Jun 26, 2018
7a531fa
Fixing IBaseMethodRequest template import statements. This template g…
deepak2016 Jun 26, 2018
cd9fea2
Refactoring package definition code for BaseMethodRequest to utilize …
deepak2016 Jun 26, 2018
8f821d8
Fixing IBaseEntityRequest template import statements. This template g…
deepak2016 Jun 26, 2018
a4c5796
Merge pull request #139 from microsoftgraph/java-memory-fix
deepak2016 Jun 27, 2018
4922c1a
Fixing BaseEntityRequest template import statement. This file generat…
deepak2016 Jun 27, 2018
717cea8
Fixing IBaseEntityRequestBuilder tempate import statements. This temp…
deepak2016 Jun 27, 2018
b6e190b
Fixing import statements for BaseEntityRequestBuilder template. This …
deepak2016 Jun 28, 2018
99c8390
Merge pull request #140 from microsoftgraph/java-memory-fix
dadheech115 Jun 29, 2018
fb7f0ac
Have put a check for null values of function/action parameters in Met…
Jul 16, 2018
503f200
Merge pull request #142 from microsoftgraph/vidadhee/NullCheck
dadheech115 Jul 16, 2018
b08c615
1. New metadata added under 2018_08_16
muthurathinam-m Aug 16, 2018
cd88bb3
Fix ClassCastException during delete API call by accepting correct me…
Aug 22, 2018
51d6168
Merge pull request #144 from microsoftgraph/java-ClassCastException-fix
vikyding Aug 23, 2018
b55ab89
Fixing java template for import statement - these are new additions a…
deepak2016 Aug 28, 2018
c0fa08d
Update VIPR ref, add initial incomplete support of NavigationBindingP…
MIchaelMainer Aug 28, 2018
e2d65f7
Merge pull request #145 from microsoftgraph/java-template-fix
deepak2016 Aug 29, 2018
0ccadf8
Iterate on GetImplicitNavigationPropertyUrlSegment
MIchaelMainer Sep 7, 2018
2b3d8f6
Added notes on what I think needs to happen to support NavigationProp…
MIchaelMainer Sep 13, 2018
953deb2
Cleaned up code and notes and stated assumptions for how we process N…
MIchaelMainer Sep 14, 2018
2112d82
Fix generation for non-containment navigation with NavigationProperty…
MIchaelMainer Sep 14, 2018
d4a95ca
Removed whitespace
MIchaelMainer Sep 14, 2018
6e4e5f6
Merge pull request #147 from microsoftgraph/supportNavPathBindings
MIchaelMainer Sep 14, 2018
6ba3d49
target metadata for client code file generation - still need to process
MIchaelMainer Sep 14, 2018
1394527
Add metadata for generating client.
MIchaelMainer Sep 14, 2018
599a004
Changes in base java template file to remove duplicate import stateme…
deepak2016 Sep 17, 2018
d332b7c
Merge pull request #149 from microsoftgraph/java-template-fix
deepak2016 Sep 17, 2018
76265f8
Merge pull request #148 from microsoftgraph/metadataForIgnite
MIchaelMainer Sep 17, 2018
95e3c15
Revert strict model generation for typescipt
muthurathinam-m Sep 18, 2018
a559947
Added beta metadata with long descriptions for model generation
MIchaelMainer Sep 18, 2018
af43fbd
Merge pull request #150 from microsoftgraph/Typescript
muthurathinam Sep 18, 2018
36b6e6f
Merge pull request #151 from microsoftgraph/betaMetadata
MIchaelMainer Sep 18, 2018
1e751b4
Updated copyright, bumped version.
MIchaelMainer Sep 18, 2018
017cd03
Change default target
MIchaelMainer Sep 18, 2018
0490142
removed capability attribution with bool attribute that causes an iss…
MIchaelMainer Sep 19, 2018
0b0430a
added long descriptions
MIchaelMainer Sep 20, 2018
2e24a59
Merge pull request #152 from microsoftgraph/PHP_updateVersion
MIchaelMainer Sep 21, 2018
2212e86
Fix: removed capability annotations with bool value
muthurathinam-m Sep 22, 2018
67e3c55
Merge pull request #153 from microsoftgraph/fixBetaMetadata
MIchaelMainer Sep 24, 2018
66dd5c4
Add odata type to complex types for .Net and PHP (#154)
MIchaelMainer Sep 27, 2018
3f6566b
Typewriter.exe is born - added new command line exe for SDK generatio…
darrelmiller Sep 29, 2018
2b76540
Add release path hint for template test (#155)
MIchaelMainer Oct 9, 2018
a680c33
Update readme with containsTarget info for nav props (#156)
MIchaelMainer Oct 9, 2018
29d15ca
Fixed copyright, made assembly semver (#158)
MIchaelMainer Oct 12, 2018
c9597cc
Add metadata preprocessor to typewriter (#159)
MIchaelMainer Oct 17, 2018
a591288
Script to fix packaging + version
MIchaelMainer Oct 18, 2018
db03fc2
FIx typos
MIchaelMainer Oct 18, 2018
3482609
Temp commit
MIchaelMainer Oct 19, 2018
54c7b1c
Hook up to Program.cs - runs through, no annotations applied. Somethi…
MIchaelMainer Oct 22, 2018
4046a83
Format metadata to help with diff
MIchaelMainer Oct 24, 2018
d71772e
update metadata for October client library update
MIchaelMainer Oct 24, 2018
ed0d610
Clean up metadata directory.
MIchaelMainer Oct 24, 2018
1022d8e
Fixed typo
MIchaelMainer Oct 24, 2018
b44c158
Adding metadata from 10/23/2018 for generating the Oct 29 release
MIchaelMainer Oct 26, 2018
06c1a6f
Choco pack and versioning script made more robust
MIchaelMainer Oct 26, 2018
62387ae
Merge branch 'dev' into incorpApiDoctor
MIchaelMainer Oct 29, 2018
802bdaa
Added missing generation options.
MIchaelMainer Oct 29, 2018
e7a15ce
Capture more descriptions.
MIchaelMainer Oct 30, 2018
2979678
Updated metadata with changes from ApiDoctor update
MIchaelMainer Oct 30, 2018
9782d8d
Merge pull request #163 from microsoftgraph/addMoreDescriptions
MIchaelMainer Oct 30, 2018
e3a1d22
Updated metadata with changes from ApiDoctor update
MIchaelMainer Oct 30, 2018
71e19db
Merge branch 'dev' into incorpApiDoctor
MIchaelMainer Oct 30, 2018
d73e0a2
Update ApiDoctor packageRef, set Source for CsdlWriterOption.
MIchaelMainer Oct 30, 2018
6cd252d
Clean up
MIchaelMainer Oct 30, 2018
2d8e2fa
Sort remove usings
MIchaelMainer Oct 30, 2018
0232965
Removing merge functionality since we don't use it.
MIchaelMainer Oct 30, 2018
3dfdc88
Swallowed InvalidOperation in case we don't target Graph metadata.
MIchaelMainer Oct 31, 2018
ae329e2
Merge pull request #165 from microsoftgraph/incorpApiDoctor
MIchaelMainer Nov 2, 2018
a67af1e
Added generation options
MIchaelMainer Nov 5, 2018
baf4c1b
Enable metadata generation options.
MIchaelMainer Nov 8, 2018
ed8932e
Refactored generation.
MIchaelMainer Nov 8, 2018
a245c99
Added documentation for using typewriter
MIchaelMainer Nov 8, 2018
3b34d38
Typos
MIchaelMainer Nov 8, 2018
54a24e0
Added documentation for using typewriter
MIchaelMainer Nov 8, 2018
324f250
Merge pull request #166 from microsoftgraph/generatorOptions
MIchaelMainer Nov 14, 2018
c1b02af
Update apidoctor reference
MIchaelMainer Nov 15, 2018
c6badfd
Merge pull request #167 from microsoftgraph/task/updateApiDoctor
MIchaelMainer Nov 15, 2018
f81eb90
Added support for both description and long description as well sanit…
MIchaelMainer Dec 4, 2018
14fd26b
Use description and long description annotations for Java
MIchaelMainer Dec 4, 2018
8062185
Use description and long description annotations for TS
MIchaelMainer Dec 5, 2018
c232874
Removed character replacement.
MIchaelMainer Dec 5, 2018
718653c
Merge pull request #168 from microsoftgraph/bug/descriptions
MIchaelMainer Dec 5, 2018
f3252dc
Merge pull request #169 from microsoftgraph/bug/java/descriptions
MIchaelMainer Dec 5, 2018
932a921
Added escaped character replacement.
MIchaelMainer Dec 6, 2018
cd49401
Merge pull request #170 from microsoftgraph/bug/ts/descriptions
MIchaelMainer Dec 6, 2018
c5bf2a4
Java extension templates removal, generated template edits and restru…
Dec 7, 2018
2bd6ba0
Merge branch 'dev' of https://github.com/microsoftgraph/MSGraph-SDK-C…
Dec 7, 2018
b63d4ba
Extensibility message removal and rename of response classes.
Dec 11, 2018
c4686a7
Removal of extensions import in BaseMethodBody and edits in function …
Dec 13, 2018
92b25ac
Fixing import statement for request builder classes when an enumset p…
deepak2016 Dec 14, 2018
f9c8854
Merge pull request #172 from microsoftgraph/java-import-fix
MIchaelMainer Dec 14, 2018
a96b324
Change for ObjC Model generation.
Dec 17, 2018
e47685d
Added function for extension in java models.
Dec 27, 2018
ce240b4
Merge branch 'dev' of https://github.com/microsoftgraph/MSGraph-SDK-C…
Dec 27, 2018
15e44e7
Restructed files to be generated in java extension.
Jan 9, 2019
4a0e364
Extension code removal
Jan 10, 2019
a953005
Merge branch 'dev' into vidadhee/ObjcModelGen
Jan 14, 2019
a6caca6
Change lang in TemplateWriterSetting to CSharp
Jan 14, 2019
1d89a4a
Change CGFloat to double for mac portability
Jan 21, 2019
8c212b5
Reset target language and namespace from template writer to default ones
Jan 21, 2019
2a392f0
Merge pull request #174 from microsoftgraph/extensions-generated-java…
deepak2016 Jan 24, 2019
527eed3
Change
Jan 24, 2019
16cd8d0
Sanitize Paramater variable to fix error
JaapSingh Jan 29, 2019
81d6ee2
Sanitize parameters to prevent errors
JaapSingh Jan 29, 2019
bca4cc4
Merge pull request #176 from JaapSingh/dev
MIchaelMainer Jan 29, 2019
62156a2
Update GetSanitizedPropertyName method
JaapSingh Jan 30, 2019
02288c4
Updates IEntityRequestBuilder.Base.template.tt
JaapSingh Jan 30, 2019
455f177
Updates EntityRequestBuilder.Base.template.tt
JaapSingh Jan 30, 2019
86a5f1a
Merge pull request #175 from microsoftgraph/vidadhee/ObjcModelGen
dadheech115 Feb 1, 2019
85b03e0
Update Tests to have relevant references
JaapSingh Feb 1, 2019
ef05d6b
Merge pull request #177 from JaapSingh/dev
MIchaelMainer Feb 1, 2019
ac00794
Change Models template to ClientModels to facilitate generation of MS…
Feb 7, 2019
d8ffb4c
Add support for specifying properties from the typewriter cli (#178)
MIchaelMainer Feb 8, 2019
c76172e
add vipr as a project reference for tests (#180)
MIchaelMainer Feb 8, 2019
c8a2465
Merge pull request #179 from microsoftgraph/vidadhee/ObjcModelGen
dadheech115 Feb 8, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Generate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
param([String]$metadata='https://graph.microsoft.com/v1.0/$metadata')

$ErrorActionPreference = "Stop"

# pull docs
git clone --depth 1 https://github.com/microsoftgraph/microsoft-graph-docs.git docs

# Get metadata
Invoke-WebRequest $metadata -outfile metadata.xml

# apidoctor the $metadata
apidoc publish-edmx --path 'docs\api-reference\v1.0' --source metadata.xml --output finalmetadata --skip-generation

# Generate new Types from metadata
typewriter -v Info -l CSharp -m 'finalmetadata/metadata.xml' -o generated

# Based on Language pull repo
git clone --depth 1 https://github.com/microsoftgraph/msgraph-sdk-dotnet.git source

# Create branch
set-location source
git checkout -b metadata-2018-09-14

# delete generated files
remove-item -Recurse .\source\src\Microsoft.Graph\Models\Generated\
remove-item -Recurse .\source\src\Microsoft.Graph\Requests\Generated\

# copy generated files
move-item .\generated\com\microsoft\graph\model .\source\src\Microsoft.Graph\Models\Generated\
move-item .\generated\com\microsoft\graph\requests .\source\src\Microsoft.Graph\Requests\Generated\

# commit and push branch
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Vipr.Core">
<HintPath>..\submodules\vipr\src\Core\Vipr.Core\bin\Debug\Vipr.Core.dll</HintPath>
</Reference>
<Reference Include="Vipr.Reader.OData.v4">
<HintPath>..\submodules\vipr\src\Readers\Vipr.Reader.OData.v4\bin\Debug\Vipr.Reader.OData.v4.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="*.cs" />
Expand All @@ -57,6 +51,14 @@
<Project>{e6b5202f-4f66-428a-ab92-0aaa11ba81de}</Project>
<Name>GraphODataTemplateWriter</Name>
</ProjectReference>
<ProjectReference Include="..\submodules\vipr\src\Core\Vipr.Core\Vipr.Core.csproj">
<Project>{04c24936-006a-4fd8-a872-ee55588c1cbe}</Project>
<Name>Vipr.Core</Name>
</ProjectReference>
<ProjectReference Include="..\submodules\vipr\src\Readers\Vipr.Reader.OData.v4\Vipr.Reader.OData.v4.csproj">
<Project>{6d8d8008-0a34-490f-8b38-21d9c8bf25c0}</Project>
<Name>Vipr.Reader.OData.v4</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Edmx\Containment.xml" />
Expand Down
4 changes: 2 additions & 2 deletions GraphODataTemplateWriter.sln
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Global
{5F526973-F69E-4C26-B8AD-612590A17A9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2256EC8D-FD7E-4A49-B616-70755AFC9F6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2256EC8D-FD7E-4A49-B616-70755AFC9F6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2256EC8D-FD7E-4A49-B616-70755AFC9F6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2256EC8D-FD7E-4A49-B616-70755AFC9F6C}.Release|Any CPU.Build.0 = Release|Any CPU
{2256EC8D-FD7E-4A49-B616-70755AFC9F6C}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{2256EC8D-FD7E-4A49-B616-70755AFC9F6C}.Release|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 3 additions & 0 deletions Package.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
msbuild Typewriter.sln /p:Configuration=Release /m
choco pack Typewriter.nuspec -version %1
choco upgrade Typewriter -s .
47 changes: 43 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[vipr-source-repo]: https://github.com/microsoft/vipr

[![Build status](https://o365exchange.visualstudio.com/O365%20Sandbox/_apis/build/status/Microsoft%20Graph/msgraph-package-typewriter)](https://o365exchange.visualstudio.com/O365%20Sandbox/_build/latest?definitionId=1728)

# Microsoft Graph SDK Code Generator

Source code writers for [VIPR][vipr-source-repo] utilizing T4 templates. The GraphODataTemplateWriter receives an OdcmModel from VIPR and uses it to fill in a T4 template located within this repository.

Currently the following target languages are supported by this writer:
- Android
- CSharp
- Java
- Objective-C
- Python
- TypeScript
Expand All @@ -33,6 +36,42 @@ Once setup is complete, you can work with the GraphODataTemplateWriter solution

For more information on submodules read [this chapter](http://git-scm.com/book/en/v2/Git-Tools-Submodules) from the Git book and search the Web.

## Using Typewriter

Typewriter is a new solution for generating code files using the GraphODataTemplateWriter and VIPR. It is an executable that is intended to simplify the generation of code files. Build the solution to find the typewriter executable in `\MSGraph-SDK-Code-Generator\src\Typewriter\bin\Release`. The typewriter run options are:

* **-l**, **-language**: The target language for the generated code files. The values can be: `Android`, `Java`, `ObjC`, `CSharp`, `PHP`, `Python`, `TypeScript`, or `GraphEndpointList`. The default value is `CSharp`. This is not applicable when only generating clean and annotated metadata as specified by the `-generationmode Metadata` option.
* **-m**, **-metadata**: The local file path or URL to the target input metadata. The default value is `https://graph.microsoft.com/v1.0/$metadata`. This value is required.
* **-v**, **-verbosity**: The log verbosity level. The values can be: `Minimal`, `Info`, `Debug`, or `Trace`. The default value is `Minimal`.
* **-o**, **-output**: Specifies the path to the output folder. The default value is the directory that contains typewriter.exe. The structure and contents of the output directory will be different based on the `-generationmode` and `-language` options.
* **-d**, **-docs**: Specifies the path to the local root of the [microsoft-graph-docs](https://github.com/microsoftgraph/microsoft-graph-docs) repo. The default value is the directory that contains typewriter.exe. The documentation is parsed to provide documentation annotations to the metadata which is then used to add doc comments in the generated code files. This option is required when using `-generationmode` values of `Metadata` or `Full`.
* **-g**, **-generationmode**: Specifies the generation mode. The values can be: `Full`, `Metadata`, or `Files`. `Full` (default) generation mode produces the output code files by cleaning the input metadata, parsing the documentation, and adding annotations before generating the output files. `Metadata` generation mode produces an output metadata file by cleaning metadata, documentation parsing, and adding documentation annotations. `Files` generation mode produces code files from an input metadata and bypasses the cleaning, documentation parsing, and adding documentation annotations.
* **-f**, **-outputMetadataFileName**: The base output metadata filename. Only applicable for `-generationmode Metadata`. The default value is `cleanMetadataWithDescriptions` which is used with the value of the `-endpointVersion` to generate a metadata file named `cleanMetadataWithDescriptionsv1.0.xml`.
* **-e**, **-endpointVersion**: The endpoint version used when naming a metadata file. Expected values are `v1.0` and `beta`. Only applicable for `-generationmode Metadata`.
* **-p**, **-properties**: Specify properties to support generation logic in the T4 templates. Properties must take the form of *key-string:value-string*. Multiple properties can be specified by setting a space in between property. The only property currently supported is the *php.namespace* property to specify the generated model file namespace. This property is optional.

### Example typewriter usage

#### Generate TypeScript typings from a CSDL (metadata) file without cleaning or annotating the CSDL.

The output will go in to the `outputTypeScript` directory.

`.\typewriter.exe -v Info -m D:\cleanMetadataWithDescriptions_v10.xml -o outputTypeScript -l TypeScript -g Files`

#### Clean and annotate a metadata file with documentation annotations sourced from the documentation repo

The output metadata file will go in to the `output2` directory. The output metadata file will be named `cleanMetadataWithDescriptionsv1.0.xml` based on the default values.

`.\typewriter.exe -v Info -m D:\v1.0_2018_10_23_source.xml -o output2 -d D:\repos\microsoft-graph-docs -g Metadata`

#### Generate C# code files from the metadata that will be cleaned and annotated with documentation annotations sourced from the documentation repo

The output C# code files will go in to the `output` directory.

`.\typewriter.exe -v Info -m D:\v1.0_2018_10_23_source.xml -o output -l CSharp -d D:\repos\microsoft-graph-docs -g Full`



## Using Vipr with this Writer

1. Build the solution in Visual Studio.
Expand Down Expand Up @@ -106,7 +145,7 @@ The type of template.

#### Template Name

To set the name of the template using the `Name` format string. You can insert `<Class>`, `<Property>`, `<Method>`, and `<Container>` the values will be replaced by the names of the corresponding object. If you insert an item that doesn't exist it will be replaced with an empty string.
To set the name of the template using the `Name` format string. You can insert `<Class>`, `<Property>`, `<Method>`, and `<Container>` the values will be replaced by the names of the corresponding object. If you insert an item that doesn't exist it will be replaced with an empty string.
Note: You can also set the template name from inside the template by : `host.SetTemplateName("foo");`

#### Template Editing
Expand Down Expand Up @@ -134,11 +173,11 @@ There are currently several steps we take to form the metadata into one that wil
<Annotation String="navigable" Term="Org.OData.Core.V1.LongDescription"/>
```
- Remove HasStream properties from ```onenotePage``` and ```onenoteEntityBaseModel```
- Add ```ContainsTarget="true"``` to navigation properties that do not have a corresponding EntitySet
- Add ```ContainsTarget="true"``` to navigation properties that do not have a corresponding EntitySet. This currently applies to navigation properties that contain plannerBucket, plannerTask, plannerPlan, and plannerDelta.
- Add long descriptions to types and properties from [docs](https://developer.microsoft.com/en-us/graph/docs/concepts/overview)

In order to build against metadata other than that stored in the [metadata](https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/tree/master/metadata) directory, you will need to perform the first four on this list.

## Contributing

Before we can accept your pull request, you'll need to electronically complete Microsoft's [Contributor License Agreement](https://cla.microsoft.com/). If you've done this for other Microsoft projects, then you're already covered.
Expand Down
16 changes: 16 additions & 0 deletions Templates/Android/generated/BaseEntityWithReferenceRequest.java.tt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@
return send(HttpMethod.GET, null);
}

public void delete(final ICallback<<#=TypeName(c)#>> callback) {
send(HttpMethod.DELETE, callback, null);
}

public void delete() throws ClientException {
send(HttpMethod.DELETE, null);
}

public void patch(final <#=TypeName(c)#> source<#=TypeName(c)#>, final ICallback<<#=TypeName(c)#>> callback) {
send(HttpMethod.PATCH, callback, source<#=TypeName(c)#>);
}

public <#=TypeName(c)#> patch(final <#=TypeName(c)#> source<#=TypeName(c)#>) throws ClientException {
return send(HttpMethod.PATCH, source<#=TypeName(c)#>);
}

<# if (c.GetFeatures().CanSelect) { #>
/**
* Sets the select clause for the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@

<#=TypeName(c)#> get() throws ClientException;

void delete(final ICallback<<#=TypeName(c)#>> callback);

void delete() throws ClientException;

void patch(final <#=TypeName(c)#> source<#=TypeName(c)#>, final ICallback<<#=TypeName(c)#>> callback);

<#=TypeName(c)#> patch(final <#=TypeName(c)#> source<#=TypeName(c)#>) throws ClientException;

<# if (c.GetFeatures().CanSelect) { #>
<#=IBaseTypeWithReferencesRequest(c)#> select(final String value);

Expand Down
7 changes: 5 additions & 2 deletions Templates/CSharp/Base/CollectionRequest.Base.template.tt
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ public string GetPostAsyncMethodForReferencesRequest(OdcmProperty odcmProperty)
if (serviceNavigationProperty == null)
return string.Empty;

//Append the singleton's navigation type to the @odata.id if relevant
var implicitNavigationProperty = string.Empty;

// If the odcmProperty is a part of Singleton, then we need to determine whether there is a
// NavigationPropertyBinding generation hint. If there is, then we need to use it for
// creating the URL of a reference entity in a POST body.
if (serviceNavigationProperty.GetType() == typeof(OdcmSingleton))
implicitNavigationProperty = "/" + odcmProperty.Name;
implicitNavigationProperty = "/" + odcmProperty.GetImplicitPropertyName((OdcmSingleton)serviceNavigationProperty);

var stringBuilder = new StringBuilder();

Expand Down
23 changes: 15 additions & 8 deletions Templates/CSharp/Base/EntityRequest.Base.template.tt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public void AppendCreateAsyncHeader(string entityName, string lowerCaseEntityNam
stringBuilder.AppendFormat(" /// <returns>The created {0}.</returns>", entityName);
}

public string GetEntityCreateAsyncMethod(OdcmClass odcmClass)
public string GetEntityCreateAsyncMethod(OdcmClass odcmClass, bool initializeCollectionProperties = true)
{
var stringBuilder = new StringBuilder();

Expand Down Expand Up @@ -238,10 +238,14 @@ public string GetEntityCreateAsyncMethod(OdcmClass odcmClass)
stringBuilder.Append(Environment.NewLine);
stringBuilder.AppendFormat(" var newEntity = await this.SendAsync<{0}>({1}ToCreate, cancellationToken).ConfigureAwait(false);", entityName, lowerCaseEntityName);
stringBuilder.Append(Environment.NewLine);
stringBuilder.Append(
@" this.InitializeCollectionProperties(newEntity);
return newEntity;
if (initializeCollectionProperties) {
stringBuilder.Append(
@" this.InitializeCollectionProperties(newEntity);");
stringBuilder.Append(Environment.NewLine);
}
stringBuilder.Append(@" return newEntity;
}");


return stringBuilder.ToString();
}
Expand Down Expand Up @@ -352,7 +356,7 @@ public void AppendUpdateAsyncHeader(string entityName, string lowerCaseEntityNam
stringBuilder.AppendFormat(" /// <returns>The updated {0}.</returns>", entityName);
}

public string GetEntityUpdateAsyncMethod(OdcmClass odcmClass)
public string GetEntityUpdateAsyncMethod(OdcmClass odcmClass, bool initializeCollectionProperties = true)
{
var stringBuilder = new StringBuilder();

Expand Down Expand Up @@ -393,9 +397,12 @@ public string GetEntityUpdateAsyncMethod(OdcmClass odcmClass)
stringBuilder.Append(Environment.NewLine);
stringBuilder.AppendFormat(" var updatedEntity = await this.SendAsync<{0}>({1}ToUpdate, cancellationToken).ConfigureAwait(false);", entityName, lowerCaseEntityName);
stringBuilder.Append(Environment.NewLine);
stringBuilder.Append(
@" this.InitializeCollectionProperties(updatedEntity);
return updatedEntity;
if (initializeCollectionProperties) {
stringBuilder.Append(
@" this.InitializeCollectionProperties(updatedEntity);");
stringBuilder.Append(Environment.NewLine);
}
stringBuilder.Append(@" return updatedEntity;
}");

return stringBuilder.ToString();
Expand Down
6 changes: 4 additions & 2 deletions Templates/CSharp/Base/EntityRequestBuilder.Base.template.tt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ public string GetRequestBuilderProperty(string propertyName, string urlValue, st

public string GetCollectionPropertyRequestBuilderProperty(string entityName, OdcmProperty odcmProperty)
{
var propertyName = this.GetPropertyName(odcmProperty).GetSanitizedPropertyName();
var propertyName = this.GetPropertyName(odcmProperty);
propertyName = propertyName.GetSanitizedPropertyName(suffix: propertyName == "Request" ? "_" : null);
var propertyPrefix = string.Concat(entityName, this.GetPropertyName(odcmProperty));
var collectionRequestBuilder = odcmProperty.IsReference()
? this.GetCollectionWithReferencesRequestBuilderString(propertyPrefix)
Expand All @@ -153,7 +154,8 @@ public string GetCollectionPropertyRequestBuilderProperty(string entityName, Odc

public string GetNonCollectionRequestBuilderProperty(OdcmProperty odcmProperty)
{
var propertyName = this.GetPropertyName(odcmProperty).GetSanitizedPropertyName();
var propertyName = this.GetPropertyName(odcmProperty);
propertyName = propertyName.GetSanitizedPropertyName(suffix: propertyName == "Request" ? "_" : null);
var propertyPrefix = this.GetPropertyTypeName(odcmProperty);
var propertyRequestBuilder = odcmProperty.IsReference()
? this.GetWithReferenceRequestBuilderString(propertyPrefix)
Expand Down
8 changes: 5 additions & 3 deletions Templates/CSharp/Base/IEntityRequestBuilder.Base.template.tt
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ public string GetRequestBuilderProperty(string propertyName, string requestBuild
}

public string GetCollectionPropertyRequestBuilderProperty(string entityName, OdcmProperty odcmProperty)
{
var propertyName = this.GetPropertyName(odcmProperty).GetSanitizedPropertyName();
{
var propertyName = this.GetPropertyName(odcmProperty);
propertyName = propertyName.GetSanitizedPropertyName(suffix: propertyName == "Request" ? "_" : null);
var propertyPrefix = string.Concat(entityName, this.GetPropertyName(odcmProperty));
var collectionRequestBuilder = odcmProperty.IsReference()
? this.GetCollectionWithReferencesRequestBuilderString(propertyPrefix)
Expand All @@ -110,7 +111,8 @@ public string GetCollectionPropertyRequestBuilderProperty(string entityName, Odc

public string GetNonCollectionRequestBuilderProperty(OdcmProperty odcmProperty)
{
var propertyName = this.GetPropertyName(odcmProperty).GetSanitizedPropertyName();
var propertyName = this.GetPropertyName(odcmProperty);
propertyName = propertyName.GetSanitizedPropertyName(suffix: propertyName == "Request" ? "_" : null);
var propertyPrefix = this.GetPropertyTypeName(odcmProperty);
var propertyRequestBuilder = odcmProperty.IsReference()
? this.GetWithReferenceRequestBuilderString(propertyPrefix)
Expand Down
23 changes: 20 additions & 3 deletions Templates/CSharp/Model/ComplexType.cs.tt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,17 @@ namespace <#=complex.Namespace.GetNamespaceName()#>
<#=attributeStringBuilder.ToString()#>
public <#=classType#> <#=typeDeclaration#>
{
<#
<#
// Generate a constructor to initialize the @odata.type property when this type is not abstract and if this
// type's base is abstract and the base is referenced as the type of a structural property. We need this
// to disambiguate the type of the descendant class being sent.
if (complex.IsBaseAbstractAndReferencedAsPropertyType() && !complex.IsAbstract)
{
#> public <#=complexTypeName#>()
{
this.ODataType = "<#=complex.FullName#>";
}<#
}
foreach(var property in complex.Properties)
{

Expand All @@ -59,7 +69,7 @@ namespace <#=complex.Namespace.GetNamespaceName()#>

/// <summary>
/// Gets or sets <#=property.Name#>.
<# if (property.LongDescription != null) {
<# if (property.LongDescription != null || property.Description != null) {
#>
/// <#=property.GetSanitizedLongDescription()#>
<# } #>
Expand All @@ -74,7 +84,7 @@ namespace <#=complex.Namespace.GetNamespaceName()#>

/// <summary>
/// Gets or sets <#=property.Name#>.
<# if (property.LongDescription != null) {
<# if (property.LongDescription != null || property.Description != null) {
#>
/// <#=property.GetSanitizedLongDescription()#>
<# } #>
Expand All @@ -86,6 +96,7 @@ namespace <#=complex.Namespace.GetNamespaceName()#>
}

// Only include AdditionalData in the base classes.
// Adding odata.type to all complex types with no base class.
if (complex.Base == null)
{
#>
Expand All @@ -95,6 +106,12 @@ namespace <#=complex.Namespace.GetNamespaceName()#>
/// </summary>
[JsonExtensionData(ReadData = true)]
public IDictionary<string, object> AdditionalData { get; set; }

/// <summary>
/// Gets or sets @odata.type.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "@odata.type", Required = Newtonsoft.Json.Required.Default)]
public string ODataType { get; set; }
<#
}
#>
Expand Down
Loading