Skip to content

Commit 385c2d9

Browse files
committed
Merge branch 'master' into feature/jspecify
2 parents 25cfde3 + 0659b25 commit 385c2d9

182 files changed

Lines changed: 1343 additions & 327 deletions

File tree

Some content is hidden

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

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,6 @@ private ModelsMap postProcessModelsMap(ModelsMap objs) {
167167

168168
prop.vendorExtensions.putIfAbsent("x-php-prop-type", propType);
169169
}
170-
171-
if (model.isEnum) {
172-
for (Map<String, Object> enumVars : (List<Map<String, Object>>) model.getAllowableValues().get("enumVars")) {
173-
if ((Boolean) enumVars.get("isString")) {
174-
model.vendorExtensions.putIfAbsent("x-php-enum-type", "string");
175-
} else {
176-
model.vendorExtensions.putIfAbsent("x-php-enum-type", "int");
177-
}
178-
}
179-
}
180170
}
181171
return objs;
182172
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ public void processOpts() {
179179
supportingFiles.add(new SupportingFile("apiSettings.mustache", invokerFolder, "ApiSettings.scala"));
180180
final String apiFolder = (sourceFolder + File.separator + apiPackage).replace(".", File.separator);
181181
supportingFiles.add(new SupportingFile("project/build.properties.mustache", "project", "build.properties"));
182+
supportingFiles.add(new SupportingFile("project/plugins.mustache", "project", "plugins.sbt"));
183+
supportingFiles.add(new SupportingFile("scalafmt.mustache", "", ".scalafmt.conf"));
182184
supportingFiles.add(new SupportingFile("enumsSerializers.mustache", apiFolder, "EnumsSerializers.scala"));
183185
supportingFiles.add(new SupportingFile("serializers.mustache", invokerFolder, "Serializers.scala"));
184186
}

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/DependencyInjectionTests.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ namespace {{packageName}}.Test.{{apiPackage}}
7676

7777
{{/httpSignatureMethods}}
7878
{{#oauthMethods}}
79-
OAuthToken oauthToken = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}("token", timeout: TimeSpan.FromSeconds(1));
80-
options.AddTokens(oauthToken);
79+
OAuthToken oauthToken{{-index}} = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}("token", timeout: TimeSpan.FromSeconds(1));
80+
options.AddTokens(oauthToken{{-index}});
8181

8282
{{/oauthMethods}}
8383
{{/lambda.trimTrailingWithNewLine}}

modules/openapi-generator/src/main/resources/csharp/libraries/generichost/TokenBase.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace {{packageName}}.{{clientPackage}}
1515
{{>visibility}} abstract class TokenBase
1616
{
1717
private DateTime _nextAvailable = DateTime.UtcNow;
18-
private object _nextAvailableLock = new object();
18+
private readonly object _nextAvailableLock = new object();
1919
private readonly System.Timers.Timer _timer = new System.Timers.Timer();
2020
2121
internal TimeSpan? Timeout { get; set; }
@@ -59,7 +59,7 @@ namespace {{packageName}}.{{clientPackage}}
5959
/// <summary>
6060
/// Returns true while the token is rate limited.
6161
/// </summary>
62-
public bool IsRateLimited => _nextAvailable > DateTime.UtcNow;
62+
public bool IsRateLimited { get { lock (_nextAvailableLock) return _nextAvailable > DateTime.UtcNow; } }
6363

6464
/// <summary>
6565
/// Triggered when the server returns status code TooManyRequests
@@ -73,8 +73,8 @@ namespace {{packageName}}.{{clientPackage}}
7373

7474
private void OnTimer(object{{nrt?}} sender, System.Timers.ElapsedEventArgs e)
7575
{
76-
if (TokenBecameAvailable != null && !IsRateLimited)
77-
TokenBecameAvailable.Invoke(this);
76+
if (!IsRateLimited)
77+
TokenBecameAvailable?.Invoke(this);
7878
}
7979
}
8080
}

modules/openapi-generator/src/main/resources/php-nextgen/model_enum.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
enum {{classname}}: {{exts.x-php-enum-type}}
1+
enum {{classname}}: {{dataType}}
22
{
33
{{#allowableValues}}
44
{{#enumVars}}

modules/openapi-generator/src/main/resources/scala-cask/example.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* ======================
1717
* == Building Locally ==
1818
* ======================
19-
* This project can be built using [[scala-clit][https://scala-cli.virtuslab.org]]
19+
* This project can be built using [[scala-cli][https://scala-cli.virtuslab.org]]
2020
*
2121
* To simply run the project
2222
* ```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.6")
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version=3.10.6
2+
runner.dialect = scala213
3+
project {
4+
git = false
5+
excludeFilters = [
6+
scalafmt-benchmarks/src/resources,
7+
sbt-test
8+
bin/issue
9+
]
10+
layout = StandardConvention
11+
}
12+
align {
13+
preset = none
14+
stripMargin = true
15+
}
16+
binPack {
17+
importSelectors = fold
18+
}
19+
newlines {
20+
avoidForSimpleOverflow = all
21+
ignoreInSyntax = false
22+
source = fold
23+
}
24+
rewrite {
25+
rules = [
26+
AvoidInfix,
27+
Imports,
28+
RedundantBraces,
29+
RedundantParens,
30+
SortModifiers,
31+
]
32+
imports {
33+
selectors = fold
34+
removeRedundantSelectors = true
35+
sort = ascii
36+
groups = [
37+
["org\\.scalafmt\\..*"],
38+
["scala\\.meta\\..*", "org\\.scalameta\\..*"],
39+
["sbt\\..*"],
40+
["java.?\\..*"],
41+
["scala\\..*"],
42+
["org\\..*"],
43+
["com\\..*"],
44+
]
45+
}
46+
redundantBraces {
47+
preset = all
48+
oneStatApply {
49+
parensMaxSpan = 300
50+
bracesMinSpan = 300
51+
}
52+
}
53+
redundantParens {
54+
preset = all
55+
}
56+
sortModifiers.preset = styleGuide
57+
trailingCommas.style = "always"
58+
}

modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ paths:
7373
- petstore_auth:
7474
- 'write:pets'
7575
- 'read:pets'
76+
- petstore_auth2:
77+
- 'write:pets'
78+
- 'read:pets'
7679
requestBody:
7780
$ref: '#/components/requestBodies/Pet'
7881
put:
@@ -1430,6 +1433,14 @@ components:
14301433
scopes:
14311434
'write:pets': modify pets in your account
14321435
'read:pets': read your pets
1436+
petstore_auth2:
1437+
type: oauth2
1438+
flows:
1439+
implicit:
1440+
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
1441+
scopes:
1442+
'write:pets': modify pets in your account
1443+
'read:pets': read your pets
14331444
api_key:
14341445
type: apiKey
14351446
name: api-key

samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/TokenBase.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Org.OpenAPITools.Client
2020
public abstract class TokenBase
2121
{
2222
private DateTime _nextAvailable = DateTime.UtcNow;
23-
private object _nextAvailableLock = new object();
23+
private readonly object _nextAvailableLock = new object();
2424
private readonly System.Timers.Timer _timer = new System.Timers.Timer();
2525

2626
internal TimeSpan? Timeout { get; set; }
@@ -64,7 +64,7 @@ internal void StartTimer(TimeSpan timeout)
6464
/// <summary>
6565
/// Returns true while the token is rate limited.
6666
/// </summary>
67-
public bool IsRateLimited => _nextAvailable > DateTime.UtcNow;
67+
public bool IsRateLimited { get { lock (_nextAvailableLock) return _nextAvailable > DateTime.UtcNow; } }
6868

6969
/// <summary>
7070
/// Triggered when the server returns status code TooManyRequests
@@ -78,8 +78,8 @@ public void BeginRateLimit()
7878

7979
private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e)
8080
{
81-
if (TokenBecameAvailable != null && !IsRateLimited)
82-
TokenBecameAvailable.Invoke(this);
81+
if (!IsRateLimited)
82+
TokenBecameAvailable?.Invoke(this);
8383
}
8484
}
8585
}

0 commit comments

Comments
 (0)