Skip to content

Commit ec7009c

Browse files
authored
Merge pull request #276 from microsoftgraph/zengin/feature-namespaces-rebased
Multiple namespaces support for C#, Java, TypeScript, Objective-C and PHP
2 parents d85b845 + 9763b23 commit ec7009c

File tree

1,048 files changed

+60830
-8504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,048 files changed

+60830
-8504
lines changed

GraphODataTemplateWriter.Test/ContainmentTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void TestImplicitEntitySet()
5757
var type = model.GetEntityTypes().Where(t => t.Name == "testEntity").First();
5858
var prop = type.Properties.Where(p => p.Name == "testNav").First();
5959

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

75-
OdcmProperty result = OdcmModelExtensions.GetServiceCollectionNavigationPropertyForPropertyType(prop);
75+
OdcmProperty result = OdcmModelExtensions.GetServiceCollectionNavigationPropertyForPropertyType(prop, model);
7676
Assert.IsNull(result);
7777
}
7878

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

89-
OdcmProperty result = OdcmModelExtensions.GetServiceCollectionNavigationPropertyForPropertyType(prop);
89+
OdcmProperty result = OdcmModelExtensions.GetServiceCollectionNavigationPropertyForPropertyType(prop, model);
9090

9191
var entitySet = model.EntityContainer.Properties.Where(t => t.Name == "testTypes").First();
9292
Assert.AreEqual(entitySet.Name, result.Name);

GraphODataTemplateWriter.Test/TypeHelperTests.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,45 @@ public void Namespace_Should_PascalCase_For_CSharp()
111111

112112
Assert.AreEqual(namespaceName, "Microsoft.Graph");
113113
}
114-
}
114+
115+
[TestMethod]
116+
public void PHPMainNamespace_Generated_For_V1()
117+
{
118+
var testNamespace = "microsoft.graph";
119+
const string expectedPHPNamespace = "Microsoft\\Graph";
120+
121+
var actualPHPNamespace = TypeHelperPHP.GetPHPNamespace(testNamespace);
122+
Assert.AreEqual(expectedPHPNamespace, actualPHPNamespace);
123+
}
124+
125+
[TestMethod]
126+
public void PHPMainNamespace_Generated_For_Beta()
127+
{
128+
var testNamespace = "microsoft.graph";
129+
const string expectedPHPNamespace = "Beta\\Microsoft\\Graph";
130+
131+
var actualPHPNamespace = TypeHelperPHP.GetPHPNamespace(testNamespace, "Beta");
132+
Assert.AreEqual(expectedPHPNamespace, actualPHPNamespace);
133+
}
134+
135+
[TestMethod]
136+
public void PHPSubNamespace_Generated_For_V1()
137+
{
138+
var testNamespace = "microsoft.graph.callRecords";
139+
const string expectedPHPNamespace = "Microsoft\\Graph\\CallRecords";
140+
141+
var actualPHPNamespace = TypeHelperPHP.GetPHPNamespace(testNamespace);
142+
Assert.AreEqual(expectedPHPNamespace, actualPHPNamespace);
143+
}
144+
145+
[TestMethod]
146+
public void PHPSubNamespace_Generated_For_Beta()
147+
{
148+
var testNamespace = "microsoft.graph.callRecords";
149+
const string expectedPHPNamespace = "Beta\\Microsoft\\Graph\\CallRecords";
150+
151+
var actualPHPNamespace = TypeHelperPHP.GetPHPNamespace(testNamespace, "Beta");
152+
Assert.AreEqual(expectedPHPNamespace, actualPHPNamespace);
153+
}
154+
}
115155
}

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
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.
88

99
Currently the following target languages are supported by this writer:
10-
- Android
1110
- CSharp
1211
- Java
1312
- Objective-C
@@ -40,7 +39,7 @@ For more information on submodules read [this chapter](http://git-scm.com/book/e
4039

4140
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:
4241

43-
* **-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.
42+
* **-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.
4443
* **-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.
4544
* **-v**, **-verbosity**: The log verbosity level. The values can be: `Minimal`, `Info`, `Debug`, or `Trace`. The default value is `Minimal`.
4645
* **-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.

0 commit comments

Comments
 (0)