Skip to content

Commit

Permalink
- merges changes from namespace support
Browse files Browse the repository at this point in the history
  • Loading branch information
baywet committed Aug 26, 2020
2 parents f6c493f + ec7009c commit ec1d627
Show file tree
Hide file tree
Showing 1,048 changed files with 61,042 additions and 9,004 deletions.
6 changes: 3 additions & 3 deletions GraphODataTemplateWriter.Test/ContainmentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void TestImplicitEntitySet()
var type = model.GetEntityTypes().Where(t => t.Name == "testEntity").First();
var prop = type.Properties.Where(p => p.Name == "testNav").First();

OdcmProperty result = OdcmModelExtensions.GetServiceCollectionNavigationPropertyForPropertyType(prop);
OdcmProperty result = OdcmModelExtensions.GetServiceCollectionNavigationPropertyForPropertyType(prop, model);
var singleton = model.GetEntityTypes().Where(t => t.Name == "testSingleton").First();
Assert.AreEqual(singleton.Name, result.Name);
}
Expand All @@ -72,7 +72,7 @@ public void TestNoValidEntitySet()
var type = model.GetEntityTypes().Where(t => t.Name == "testEntity").First();
var prop = type.Properties.Where(p => p.Name == "testInvalidNav").First(); ;

OdcmProperty result = OdcmModelExtensions.GetServiceCollectionNavigationPropertyForPropertyType(prop);
OdcmProperty result = OdcmModelExtensions.GetServiceCollectionNavigationPropertyForPropertyType(prop, model);
Assert.IsNull(result);
}

Expand All @@ -86,7 +86,7 @@ public void TestExplicitEntitySet()
var type = model.GetEntityTypes().Where(t => t.Name == "testEntity").First();
var prop = type.Properties.Where(p => p.Name == "testExplicitNav").First();

OdcmProperty result = OdcmModelExtensions.GetServiceCollectionNavigationPropertyForPropertyType(prop);
OdcmProperty result = OdcmModelExtensions.GetServiceCollectionNavigationPropertyForPropertyType(prop, model);

var entitySet = model.EntityContainer.Properties.Where(t => t.Name == "testTypes").First();
Assert.AreEqual(entitySet.Name, result.Name);
Expand Down
42 changes: 41 additions & 1 deletion GraphODataTemplateWriter.Test/TypeHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,45 @@ public void Namespace_Should_PascalCase_For_CSharp()

Assert.AreEqual(namespaceName, "Microsoft.Graph");
}
}

[TestMethod]
public void PHPMainNamespace_Generated_For_V1()
{
var testNamespace = "microsoft.graph";
const string expectedPHPNamespace = "Microsoft\\Graph";

var actualPHPNamespace = TypeHelperPHP.GetPHPNamespace(testNamespace);
Assert.AreEqual(expectedPHPNamespace, actualPHPNamespace);
}

[TestMethod]
public void PHPMainNamespace_Generated_For_Beta()
{
var testNamespace = "microsoft.graph";
const string expectedPHPNamespace = "Beta\\Microsoft\\Graph";

var actualPHPNamespace = TypeHelperPHP.GetPHPNamespace(testNamespace, "Beta");
Assert.AreEqual(expectedPHPNamespace, actualPHPNamespace);
}

[TestMethod]
public void PHPSubNamespace_Generated_For_V1()
{
var testNamespace = "microsoft.graph.callRecords";
const string expectedPHPNamespace = "Microsoft\\Graph\\CallRecords";

var actualPHPNamespace = TypeHelperPHP.GetPHPNamespace(testNamespace);
Assert.AreEqual(expectedPHPNamespace, actualPHPNamespace);
}

[TestMethod]
public void PHPSubNamespace_Generated_For_Beta()
{
var testNamespace = "microsoft.graph.callRecords";
const string expectedPHPNamespace = "Beta\\Microsoft\\Graph\\CallRecords";

var actualPHPNamespace = TypeHelperPHP.GetPHPNamespace(testNamespace, "Beta");
Assert.AreEqual(expectedPHPNamespace, actualPHPNamespace);
}
}
}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
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
Expand Down Expand Up @@ -40,7 +39,7 @@ For more information on submodules read [this chapter](http://git-scm.com/book/e

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.
* **-l**, **-language**: The target language for the generated code files. The values can be: `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.
Expand Down
Loading

0 comments on commit ec1d627

Please sign in to comment.