Skip to content

Commit beb4118

Browse files
committed
Merge https://github.com/openapitools/openapi-generator into fix-cpp-qt-enum-asjsonobject
2 parents 74daaa1 + d6c4634 commit beb4118

File tree

203 files changed

+1647
-231
lines changed

Some content is hidden

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

203 files changed

+1647
-231
lines changed

CI/circle_parallel.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ elif [ "$NODE_INDEX" = "3" ]; then
7474
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
7575
#nvm install stable
7676
# install v16 instead of the latest stable version
77-
nvm install 16
78-
nvm alias default 16
77+
nvm install 18
78+
nvm alias default 18
7979
node --version
8080

8181
# Each step uses the same `$BASH_ENV`, so need to modify it
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
generatorName: typescript-angular
2+
outputDir: samples/client/petstore/typescript-angular-v19/builds/deep-object
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/deep-object-query.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
5+
additionalProperties:
6+
ngVersion: 19.0.0
7+
npmName: sample-angular-19-0-0-deep-object
8+
supportsES6: true

docs/templating.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,15 +820,21 @@ Many generators (*those extending DefaultCodegen*) come with a small set of lamb
820820
821821
- `lowercase` - Converts all of the characters in this fragment to lower case using the rules of the `ROOT` locale.
822822
- `uppercase` - Converts all of the characters in this fragment to upper case using the rules of the `ROOT` locale.
823+
- `snakecase` - Converts text in a fragment to snake case. For example `once upon a time` to `once_upon_a_time`.
823824
- `titlecase` - Converts text in a fragment to title case. For example `once upon a time` to `Once Upon A Time`.
825+
- `kebabcase` - Converts text in a fragment to snake case. For example `Once Upon A Time` to `once-upon-a-time`.
826+
- `pascalcase` - Converts text in a fragment to snake case. For example `once upon a time` to `OnceUponATime`.
824827
- `camelcase` - Converts text in a fragment to camelCase. For example `Input-text` to `inputText`.
825828
- `uncamelize` - Converts text in a fragment from camelCase or PascalCase to a string of words separated by whitespaces. For example `inputText` to `Input Text`.
829+
- `forwardslash` - Replaces all occurrences of `\/`, `\` and `//` in a fragment by `/`.
830+
- `backslash` - Replaces all occurrences `/` in a fragment by `\`.
831+
- `doublequote` - Prepends `"` to the beginning and appends `"` to the end of a fragment.
826832
- `indented` - Prepends 4 spaces indention from second line of a fragment on. First line will be indented by Mustache.
827833
- `indented_8` - Prepends 8 spaces indention from second line of a fragment on. First line will be indented by Mustache.
828834
- `indented_12` - Prepends 12 spaces indention from second line of a fragment on. First line will be indented by Mustache.
829835
- `indented_16` -Prepends 16 spaces indention from second line of a fragment on. First line will be indented by Mustache.
830836
831-
Lambda is invoked by `lambda.[lambda name]` expression. For example: `{{#lambda.lowercase}}FRAGMENT TO LOWERCASE{{/lambda.lowercase}}` to lower case text between `lambda.lowercase`.
837+
Some generators provide additional lambdas. Lambda is invoked by `lambda.[lambda name]` expression. For example: `{{#lambda.lowercase}}FRAGMENT TO LOWERCASE{{/lambda.lowercase}}` to lower case text between `lambda.lowercase`.
832838
833839
## Extensions
834840

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,8 @@ public void processOpts() {
404404
* If common lambdas are not desired, override addMustacheLambdas() method
405405
* and return empty builder.
406406
*
407+
* Corresponding user documentation: docs/templating.md, section "Mustache Lambdas"
408+
*
407409
* @return preinitialized map with common lambdas
408410
*/
409411
protected ImmutableMap.Builder<String, Lambda> addMustacheLambdas() {

modules/openapi-generator/src/main/resources/Java/RFC3339InstantDeserializer.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer;
1919

2020
{{>generatedAnnotation}}
2121
public class RFC3339InstantDeserializer<T extends Temporal> extends InstantDeserializer<T> {
22-
22+
private static final long serialVersionUID = 1L;
2323
private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault();
2424
private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS
2525
= JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault();

modules/openapi-generator/src/main/resources/Java/RFC3339JavaTimeModule.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule;
99

1010
{{>generatedAnnotation}}
1111
public class RFC3339JavaTimeModule extends SimpleModule {
12+
private static final long serialVersionUID = 1L;
1213
1314
public RFC3339JavaTimeModule() {
1415
super("RFC3339JavaTimeModule");

modules/openapi-generator/src/main/resources/JavaJaxRS/enumClass.mustache

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@
3636
this.value = value;
3737
}
3838

39-
@Override
4039
@JsonValue
40+
public {{{dataType}}} getValue() {
41+
return value;
42+
}
43+
44+
@Override
4145
public String toString() {
4246
return String.valueOf(value);
4347
}

modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ namespace {{packageName}}.Client
493493
{
494494
InterceptRequest(request);
495495
496-
RestResponse<T> response = await getResponse(client);
496+
RestResponse<T> response = await getResponse(client).ConfigureAwait(false);
497497
498498
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
499499
if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
@@ -562,7 +562,7 @@ namespace {{packageName}}.Client
562562
{
563563
if (policyResult.Outcome == OutcomeType.Successful)
564564
{
565-
return await client.Deserialize<T>(policyResult.Result, cancellationToken);
565+
return await client.Deserialize<T>(policyResult.Result, cancellationToken).ConfigureAwait(false);
566566
}
567567
else
568568
{
@@ -621,7 +621,7 @@ namespace {{packageName}}.Client
621621
{
622622
var policy = RetryConfiguration.AsyncRetryPolicy;
623623
var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false);
624-
return await DeserializeRestResponseFromPolicyAsync<T>(client, request, policyResult, cancellationToken);
624+
return await DeserializeRestResponseFromPolicyAsync<T>(client, request, policyResult, cancellationToken).ConfigureAwait(false);
625625
}
626626
else
627627
{

modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,27 @@ export class BaseService {
2929
return consumes.indexOf('multipart/form-data') !== -1;
3030
}
3131

32-
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
32+
protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep: boolean = false): HttpParams {
3333
// If the value is an object (but not a Date), recursively add its keys.
3434
if (typeof value === 'object' && !(value instanceof Date)) {
35-
return this.addToHttpParamsRecursive(httpParams, value);
35+
return this.addToHttpParamsRecursive(httpParams, value, isDeep ? key : undefined, isDeep);
3636
}
3737
return this.addToHttpParamsRecursive(httpParams, value, key);
3838
}
3939

40-
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
40+
protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep: boolean = false): HttpParams {
4141
if (value === null || value === undefined) {
4242
return httpParams;
4343
}
4444
if (typeof value === 'object') {
4545
// If JSON format is preferred, key must be provided.
4646
if (key != null) {
47-
return httpParams.append(key, JSON.stringify(value));
47+
return isDeep
48+
? Object.keys(value as Record<string, any>).reduce(
49+
(hp, k) => hp.append(`${key}[${k}]`, value[k]),
50+
httpParams,
51+
)
52+
: httpParams.append(key, JSON.stringify(value));
4853
}
4954
// Otherwise, if it's an array, add each element.
5055
if (Array.isArray(value)) {

modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export class {{classname}} extends BaseService {
130130
{{/isArray}}
131131
{{^isArray}}
132132
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
133-
<any>{{paramName}}, '{{baseName}}');
133+
<any>{{paramName}}, '{{baseName}}'{{#isDeepObject}}, true{{/isDeepObject}});
134134
{{/isArray}}
135135
{{/queryParams}}
136136

0 commit comments

Comments
 (0)