Skip to content

Commit a834700

Browse files
authored
Support language N4JS (#15089)
* n4js initial commit * incorporate feedback from user * add tests * fix media type in case of DELETE method * fix media type * some minor fixes * options fix for booleans * small fixes * generated files by ./bin/utils/ensure-up-to-date * remove String::toLowerCase due to de.thetaphi:forbiddenapis * adjust test expectation * fix test expectations * fix test expectation * add note to section 'Languages/Generators' * remove file according to review
1 parent 0cbf118 commit a834700

28 files changed

Lines changed: 4086 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ If you're a nix user, you can enter OpenAPI Generator shell, by typing:
269269
```sh
270270
nix develop
271271
```
272-
It will enter a shell with Java 8 and Maven installed.
272+
It will enter a shell with Java 8 and Maven installed.
273273

274274
Direnv supports automatically loading of the nix developer shell, so if you're using direnv too, type:
275275
```sh
@@ -1154,6 +1154,7 @@ If you want to join the committee, please kindly apply by sending an email to te
11541154
| Julia | @tanmaykm (2023/01) |
11551155
| Kotlin | @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) |
11561156
| Lua | @daurnimator (2017/08) |
1157+
| N4JS | @mmews-n4 (2023/03) |
11571158
| Nim | |
11581159
| NodeJS/Javascript | @CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07) |
11591160
| ObjC | |

bin/configs/n4js-petstore.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
generatorName: n4js
2+
outputDir: samples/client/petstore/n4js
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/n4js
5+
additionalProperties:
6+
apiPackage: "api"
7+
modelPackage: "model"
8+
fetchExecuterConstName: "FETCH_EXEC"
9+
fetchExecuterConstImplPath: "FetchExecuterMock"

docs/generators.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ The following generators are available:
4444
* [k6 (beta)](generators/k6.md)
4545
* [kotlin](generators/kotlin.md)
4646
* [lua (beta)](generators/lua.md)
47+
* [n4js](generators/n4js.md)
4748
* [nim (beta)](generators/nim.md)
4849
* [objc](generators/objc.md)
4950
* [ocaml](generators/ocaml.md)

docs/generators/n4js.md

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
---
2+
title: Documentation for the n4js Generator
3+
---
4+
5+
## METADATA
6+
7+
| Property | Value | Notes |
8+
| -------- | ----- | ----- |
9+
| generator name | n4js | pass this to the generate command after -g |
10+
| generator stability | STABLE | |
11+
| generator type | CLIENT | |
12+
| generator language | Java | |
13+
| generator default templating engine | mustache | |
14+
| helpTxt | Generates a n4js client. | |
15+
16+
## CONFIG OPTIONS
17+
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
18+
19+
| Option | Description | Values | Default |
20+
| ------ | ----------- | ------ | ------- |
21+
|apiNamePrefix|Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet => Pet.| |null|
22+
|apiPackage|package for generated api classes| |null|
23+
|checkRequiredParamsNotNull|Iff true null-checks are performed for required parameters.| |null|
24+
|checkSuperfluousBodyProps|Iff true a new copy of the given body object is transmitted. This copy only contains those properties defined in its model specification.| |null|
25+
|generateDefaultApiExecuter|Iff true a default implementation of the api executer interface is generated.| |null|
26+
|modelPackage|package for generated models| |null|
27+
28+
## IMPORT MAPPING
29+
30+
| Type/Alias | Imports |
31+
| ---------- | ------- |
32+
33+
34+
## INSTANTIATION TYPES
35+
36+
| Type/Alias | Instantiated By |
37+
| ---------- | --------------- |
38+
39+
40+
## LANGUAGE PRIMITIVES
41+
42+
<ul class="column-ul">
43+
<li>Array</li>
44+
<li>Error</li>
45+
<li>Object</li>
46+
<li>String</li>
47+
<li>any</li>
48+
<li>any+</li>
49+
<li>boolean</li>
50+
<li>int</li>
51+
<li>number</li>
52+
<li>object</li>
53+
<li>string</li>
54+
</ul>
55+
56+
## RESERVED WORDS
57+
58+
<ul class="column-ul">
59+
<li>abstract</li>
60+
<li>await</li>
61+
<li>boolean</li>
62+
<li>break</li>
63+
<li>byte</li>
64+
<li>case</li>
65+
<li>catch</li>
66+
<li>char</li>
67+
<li>class</li>
68+
<li>const</li>
69+
<li>continue</li>
70+
<li>debugger</li>
71+
<li>default</li>
72+
<li>delete</li>
73+
<li>do</li>
74+
<li>double</li>
75+
<li>else</li>
76+
<li>enum</li>
77+
<li>export</li>
78+
<li>extends</li>
79+
<li>false</li>
80+
<li>final</li>
81+
<li>finally</li>
82+
<li>float</li>
83+
<li>for</li>
84+
<li>formParams</li>
85+
<li>function</li>
86+
<li>goto</li>
87+
<li>headerParams</li>
88+
<li>if</li>
89+
<li>implements</li>
90+
<li>import</li>
91+
<li>in</li>
92+
<li>instanceof</li>
93+
<li>int</li>
94+
<li>interface</li>
95+
<li>let</li>
96+
<li>long</li>
97+
<li>native</li>
98+
<li>new</li>
99+
<li>null</li>
100+
<li>package</li>
101+
<li>private</li>
102+
<li>protected</li>
103+
<li>public</li>
104+
<li>queryParameters</li>
105+
<li>requestOptions</li>
106+
<li>return</li>
107+
<li>short</li>
108+
<li>static</li>
109+
<li>super</li>
110+
<li>switch</li>
111+
<li>synchronized</li>
112+
<li>this</li>
113+
<li>throw</li>
114+
<li>transient</li>
115+
<li>true</li>
116+
<li>try</li>
117+
<li>typeof</li>
118+
<li>useFormData</li>
119+
<li>var</li>
120+
<li>varLocalDeferred</li>
121+
<li>varLocalPath</li>
122+
<li>void</li>
123+
<li>volatile</li>
124+
<li>while</li>
125+
<li>with</li>
126+
<li>yield</li>
127+
</ul>
128+
129+
## FEATURE SET
130+
131+
132+
### Client Modification Feature
133+
| Name | Supported | Defined By |
134+
| ---- | --------- | ---------- |
135+
|BasePath|✗|ToolingExtension
136+
|Authorizations|✗|ToolingExtension
137+
|UserAgent|✗|ToolingExtension
138+
|MockServer|✗|ToolingExtension
139+
140+
### Data Type Feature
141+
| Name | Supported | Defined By |
142+
| ---- | --------- | ---------- |
143+
|Custom|✗|OAS2,OAS3
144+
|Int32|✓|OAS2,OAS3
145+
|Int64|✓|OAS2,OAS3
146+
|Float|✓|OAS2,OAS3
147+
|Double|✓|OAS2,OAS3
148+
|Decimal|✓|ToolingExtension
149+
|String|✓|OAS2,OAS3
150+
|Byte|✓|OAS2,OAS3
151+
|Binary|✓|OAS2,OAS3
152+
|Boolean|✓|OAS2,OAS3
153+
|Date|✓|OAS2,OAS3
154+
|DateTime|✓|OAS2,OAS3
155+
|Password|✓|OAS2,OAS3
156+
|File|✓|OAS2
157+
|Uuid||
158+
|Array|✓|OAS2,OAS3
159+
|Null|✗|OAS3
160+
|AnyType|✗|OAS2,OAS3
161+
|Object|✓|OAS2,OAS3
162+
|Maps|✓|ToolingExtension
163+
|CollectionFormat|✓|OAS2
164+
|CollectionFormatMulti|✓|OAS2
165+
|Enum|✓|OAS2,OAS3
166+
|ArrayOfEnum|✓|ToolingExtension
167+
|ArrayOfModel|✓|ToolingExtension
168+
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
169+
|ArrayOfCollectionOfModel|✓|ToolingExtension
170+
|ArrayOfCollectionOfEnum|✓|ToolingExtension
171+
|MapOfEnum|✓|ToolingExtension
172+
|MapOfModel|✓|ToolingExtension
173+
|MapOfCollectionOfPrimitives|✓|ToolingExtension
174+
|MapOfCollectionOfModel|✓|ToolingExtension
175+
|MapOfCollectionOfEnum|✓|ToolingExtension
176+
177+
### Documentation Feature
178+
| Name | Supported | Defined By |
179+
| ---- | --------- | ---------- |
180+
|Readme|✗|ToolingExtension
181+
|Model|✓|ToolingExtension
182+
|Api|✓|ToolingExtension
183+
184+
### Global Feature
185+
| Name | Supported | Defined By |
186+
| ---- | --------- | ---------- |
187+
|Host|✓|OAS2,OAS3
188+
|BasePath|✓|OAS2,OAS3
189+
|Info|✓|OAS2,OAS3
190+
|Schemes|✗|OAS2,OAS3
191+
|PartialSchemes|✓|OAS2,OAS3
192+
|Consumes|✓|OAS2
193+
|Produces|✓|OAS2
194+
|ExternalDocumentation|✓|OAS2,OAS3
195+
|Examples|✓|OAS2,OAS3
196+
|XMLStructureDefinitions|✗|OAS2,OAS3
197+
|MultiServer|✗|OAS3
198+
|ParameterizedServer|✗|OAS3
199+
|ParameterStyling|✗|OAS3
200+
|Callbacks|✓|OAS3
201+
|LinkObjects|✗|OAS3
202+
203+
### Parameter Feature
204+
| Name | Supported | Defined By |
205+
| ---- | --------- | ---------- |
206+
|Path|✓|OAS2,OAS3
207+
|Query|✓|OAS2,OAS3
208+
|Header|✓|OAS2,OAS3
209+
|Body|✓|OAS2
210+
|FormUnencoded|✓|OAS2
211+
|FormMultipart|✓|OAS2
212+
|Cookie|✓|OAS3
213+
214+
### Schema Support Feature
215+
| Name | Supported | Defined By |
216+
| ---- | --------- | ---------- |
217+
|Simple|✓|OAS2,OAS3
218+
|Composite|✓|OAS2,OAS3
219+
|Polymorphism|✓|OAS2,OAS3
220+
|Union|✗|OAS3
221+
|allOf|✗|OAS2,OAS3
222+
|anyOf|✗|OAS3
223+
|oneOf|✗|OAS3
224+
|not|✗|OAS3
225+
226+
### Security Feature
227+
| Name | Supported | Defined By |
228+
| ---- | --------- | ---------- |
229+
|BasicAuth|✓|OAS2,OAS3
230+
|ApiKey|✓|OAS2,OAS3
231+
|OpenIDConnect|✗|OAS3
232+
|BearerToken|✓|OAS3
233+
|OAuth2_Implicit|✓|OAS2,OAS3
234+
|OAuth2_Password|✓|OAS2,OAS3
235+
|OAuth2_ClientCredentials|✓|OAS2,OAS3
236+
|OAuth2_AuthorizationCode|✓|OAS2,OAS3
237+
238+
### Wire Format Feature
239+
| Name | Supported | Defined By |
240+
| ---- | --------- | ---------- |
241+
|JSON|✓|OAS2,OAS3
242+
|XML|✓|OAS2,OAS3
243+
|PROTOBUF|✗|ToolingExtension
244+
|Custom|✗|OAS2,OAS3

0 commit comments

Comments
 (0)