You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for specifying properties from the typewriter cli (#178)
* Added a test for validating custom PHP namespace property from the TypeWriter CLI. Fixed test metadata.
* Add support for specifying key-value properties from the Typewriter CLI.
* Fix broken tests.
* Updated test metadata to match preprocessing
* Changes support E2E testing when different target platforms are used in a test run for Typewriter. The TemplateProcessor host needs to be reset for the case when we target a new language. Otherwise the wrong *CodeWriter will be used and an unsupported cast will occur in the templates when trying to cast host.CodeWriter to the platform specific CodeWriter. The change to ConfigurationService.Settings is also required to reset the settings for configuring the TemplateWriter.
* Updated typewriter tests to be more descriptive
Copy file name to clipboardExpand all lines: README.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,16 +48,17 @@ Typewriter is a new solution for generating code files using the GraphODataTempl
48
48
***-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.
49
49
***-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`.
50
50
***-e**, **-endpointVersion**: The endpoint version used when naming a metadata file. Expected values are `v1.0` and `beta`. Only applicable for `-generationmode Metadata`.
51
+
***-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.
51
52
52
53
### Example typewriter usage
53
54
54
-
#### Generate TypeScript typings from a CSDL (metadata) file without cleaning or annotating the CSDL.
55
+
#### Generate TypeScript typings from a CSDL (metadata) file without cleaning or annotating the CSDL.
55
56
56
57
The output will go in to the `outputTypeScript` directory.
#### Clean and annotate a metadata file with documentation annotations sourced from the documentation repo
61
+
#### Clean and annotate a metadata file with documentation annotations sourced from the documentation repo
61
62
62
63
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.
63
64
@@ -144,7 +145,7 @@ The type of template.
144
145
145
146
#### Template Name
146
147
147
-
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.
148
+
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.
148
149
Note: You can also set the template name from inside the template by : `host.SetTemplateName("foo");`
149
150
150
151
#### Template Editing
@@ -174,9 +175,9 @@ There are currently several steps we take to form the metadata into one that wil
174
175
- Remove HasStream properties from ```onenotePage``` and ```onenoteEntityBaseModel```
175
176
- 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.
176
177
- Add long descriptions to types and properties from [docs](https://developer.microsoft.com/en-us/graph/docs/concepts/overview)
177
-
178
+
178
179
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.
179
-
180
+
180
181
## Contributing
181
182
182
183
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.
[Option('e',"endpointVersion",Default="v1.0",HelpText="The endpoint version. Expected values are 'v1.0' and 'beta'. Only applicable for GenerationMode.Metadata.")]
62
63
publicstringEndpointVersion{get;set;}
64
+
65
+
[Option('p',"properties",HelpText="A space separated list of properties in the form of 'key:value'. These properties can be accessed in the "+
66
+
"templates from the TemplateWriterSettings object returned by ConfigurationService.Settings. The suggested convention for specifying a key should be "+
67
+
"the targeted template language name and the property name. For example, php.namespace:Microsoft\\Graph\\Beta\\Model would be a property to be consumed in the PHP templates.")]
0 commit comments