3636
3737### Predefined lambdas
3838
39- Lambdas are special tags which invoke a predefined function named after tag.
40- The function would receive the template fragement between the tag . More info
41- about lambdas could be found [ here] ( https://github.com/OpenAPITools/openapi-generator/blob/master/docs/templating.md#mustache-lambdas )
39+ Lambdas are special tags which invoke a predefined function named after the tag.
40+ The function receives the template fragment between the tags . More info
41+ about lambdas can be found [ here] ( https://github.com/OpenAPITools/openapi-generator/blob/master/docs/templating.md#mustache-lambdas )
4242
43- We support following lambdas at the moment
43+ We support the following pre-defined lambdas at the moment:
4444
4545| lambda | example | description |
4646| ------------| ----------------------------------------| -----------------------|
4747| lowercase | {{#lowercase}}{{name}}{{/lowercase}} | Convert to lowercase |
4848| uppercase | {{#uppercase}}{{name}}{{/uppercase}} | Convert to UPPERCASE |
49- | snakecase | {{#snakecase}}{{name}}{{/snacecase }} | Convert to snake_case |
49+ | snakecase | {{#snakecase}}{{name}}{{/snakecase }} | Convert to snake_case |
5050| pascalcase | {{#pascalcase}}{{name}}{{/pascalcase}} | Convert to PascalCase |
5151| camelcase | {{#camelcase}}{{name}}{{/camelcase}} | Convert to camelCase |
5252| kebabcase | {{#kebabcase}}{{name}}{{/kebabcase}} | Convert to kebab-case |
5353
5454### Custom generators
5555
56- Some languages have various reserved words or weird way of arguments formating .
56+ Some languages have various reserved words or unusual way of formatting arguments .
5757Sometimes custom lambdas are needed to solve the issues.
58- This means there should be a way to customize the codegeration. Custom generator
59- is a javascript module defined as:
58+ A custom generator is simply a javascript module, for example:
6059
61- ```
60+ ``` js
6261const Hogan = require (' hogan.js' );
6362
6463const RESERVED_WORDS = new Set ([
@@ -77,7 +76,7 @@ function hello_lambda() {
7776 return function (text ) {
7877 return ' Hello ' + Hogan .compile (text).render (this );
7978 }
80- };
79+ }
8180
8281function complex_lambda () {
8382 return function (template ) {
@@ -102,11 +101,11 @@ module.exports = {
102101 hello: hello_lambda,
103102 path_template: complex_lambda
104103 }
105- }
104+ };
106105```
107106
108- The module has to be configured in config under ` generator ` property. Here is an example:
109- ```
107+ The module has to be configured in your config under the ` generator ` property. Here is an example:
108+ ``` json
110109{
111110 "defaults" : {
112111 "modelNaming" : " snake_case" ,
@@ -122,5 +121,5 @@ The module has to be configured in config under `generator` property. Here is an
122121 "perModel" : [
123122 ]
124123}
124+ ```
125125
126- ```
0 commit comments