Skip to content

Commit 410ec31

Browse files
committed
Merge branch 'master' into jersey-inheritance
* master: [core] Add type and format properties to model of inline response (#6153) [PowerShell] better publishing workflow (#7114) [aspnetcore] Typo issues in docs and generated code (#7094) fix http signaure auth in build.sbt (#7110) fix for the issue facing spec invlolving arrayschema structure with ref (#6310) [csharp-netcore] added cancellation tokens to async calls (#7077) [PS] Allow CI to publish the module (#7091) [Dart] Treat float as double (#6924) [Java][jersey2]Fix gradle HttpSignatureAuth dependencies (#7096) move maven,gradle tests to shipppable ci (#7108)
2 parents 3770a2b + 6a08ec5 commit 410ec31

File tree

49 files changed

+1903
-1172
lines changed

Some content is hidden

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

49 files changed

+1903
-1172
lines changed

.travis.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,6 @@ script:
150150
# WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet.
151151
- mvn --no-snapshot-updates --quiet --batch-mode --show-version clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
152152
- mvn --no-snapshot-updates --quiet --batch-mode --show-version verify -Psamples -Dorg.slf4j.simpleLogger.defaultLogLevel=error
153-
# test maven plugin
154-
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
155-
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
156-
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/kotlin.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
157-
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
158-
# test gradle plugin
159-
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk)
160-
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate)
161153
after_success:
162154
# push to maven repo
163155
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then

docs/generators/aspnetcore.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ sidebar_label: aspnetcore
1818
|modelClassModifier|Model Class Modifier can be nothing or partial| |partial|
1919
|newtonsoftVersion|Version for Microsoft.AspNetCore.Mvc.NewtonsoftJson for ASP.NET Core 3.0+| |3.0.0|
2020
|operationIsAsync|Set methods to async or sync (default).| |false|
21-
|operationModifier|Operation Modifier can be virtual, abstract or partial| |virtual|
21+
|operationModifier|Operation Modifier can be virtual or abstract| |virtual|
2222
|operationResultTask|Set methods result to Task<>.| |false|
2323
|packageAuthors|Specifies Authors property in the .NET Core project file.| |OpenAPI|
2424
|packageCopyright|Specifies an AssemblyCopyright for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |No Copyright|

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,15 @@ private Schema modelFromProperty(OpenAPI openAPI, Schema object, String path) {
647647
XML xml = object.getXml();
648648
Map<String, Schema> properties = object.getProperties();
649649
Schema model = new Schema();
650+
if (object.getType() != null) {
651+
model.setType(object.getType());
652+
}
653+
if (object.getFormat() != null) {
654+
// Even though the `format` keyword typically applies to primitive types only,
655+
// the JSON schema specification states `format` can be used for any model type instance
656+
// including object types.
657+
model.setFormat(object.getFormat());
658+
}
650659
model.setDescription(description);
651660
model.setExample(example);
652661
model.setName(object.getName());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ public String toDefaultValue(Schema schema) {
798798

799799
Schema<?> items = getSchemaItems((ArraySchema) schema);
800800

801-
String typeDeclaration = getTypeDeclaration(items);
801+
String typeDeclaration = getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, items));
802802
Object java8obj = additionalProperties.get("java8");
803803
if (java8obj != null) {
804804
Boolean java8 = Boolean.valueOf(java8obj.toString());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
7070
protected CliOption swashbuckleVersion = new CliOption(SWASHBUCKLE_VERSION, "Swashbuckle version: 3.0.0, 4.0.0, 5.0.0");
7171
protected CliOption aspnetCoreVersion = new CliOption(ASPNET_CORE_VERSION, "ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)");
7272
private CliOption classModifier = new CliOption(CLASS_MODIFIER, "Class Modifier can be empty, abstract");
73-
private CliOption operationModifier = new CliOption(OPERATION_MODIFIER, "Operation Modifier can be virtual, abstract or partial");
73+
private CliOption operationModifier = new CliOption(OPERATION_MODIFIER, "Operation Modifier can be virtual or abstract");
7474
private CliOption modelClassModifier = new CliOption(MODEL_CLASS_MODIFIER, "Model Class Modifier can be nothing or partial");
7575
private boolean generateBody = true;
7676
private CliOption buildTarget = new CliOption("buildTarget", "Target to build an application or library");

modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ ext {
137137
{{#hasOAuthMethods}}
138138
scribejava_apis_version = "6.9.0"
139139
{{/hasOAuthMethods}}
140-
{{#hasHttpBasicMethods}}
141-
tomitribe_http_signatures_version = "1.3"
142-
{{/hasHttpBasicMethods}}
140+
{{#hasHttpSignatureMethods}}
141+
tomitribe_http_signatures_version = "1.5"
142+
{{/hasHttpSignatureMethods}}
143143
}
144144

145145
dependencies {
@@ -161,9 +161,9 @@ dependencies {
161161
{{#hasOAuthMethods}}
162162
compile "com.github.scribejava:scribejava-apis:$scribejava_apis_version"
163163
{{/hasOAuthMethods}}
164-
{{#hasHttpBasicMethods}}
164+
{{#hasHttpSignatureMethods}}
165165
compile "org.tomitribe:tomitribe-http-signatures:$tomitribe_http_signatures_version"
166-
{{/hasHttpBasicMethods}}
166+
{{/hasHttpSignatureMethods}}
167167
{{#supportJava6}}
168168
compile "commons-io:commons-io:$commons_io_version"
169169
compile "org.apache.commons:commons-lang3:$commons_lang3_version"

modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ lazy val root = (project in file(".")).
2828
{{#hasOAuthMethods}}
2929
"com.github.scribejava" % "scribejava-apis" % "6.9.0" % "compile",
3030
{{/hasOAuthMethods}}
31-
{{#hasHttpBasicMethods}}
32-
"org.tomitribe" % "tomitribe-http-signatures" % "1.3" % "compile",
33-
{{/hasHttpBasicMethods}}
31+
{{#hasHttpSignatureMethods}}
32+
"org.tomitribe" % "tomitribe-http-signatures" % "1.5" % "compile",
33+
{{/hasHttpSignatureMethods}}
3434
{{^java8}}
3535
"com.brsanthu" % "migbase64" % "2.2",
3636
{{/java8}}

modules/openapi-generator/src/main/resources/aspnetcore/3.0/Program.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ namespace {{packageName}}
1414
/// <param name="args"></param>
1515
public static void Main(string[] args)
1616
{
17-
CreateWebHostBuilder(args).Build().Run();
17+
CreateHostBuilder(args).Build().Run();
1818
}
1919

2020
/// <summary>
2121
/// Create the host builder.
2222
/// </summary>
2323
/// <param name="args"></param>
2424
/// <returns>IHostBuilder</returns>
25-
public static IHostBuilder CreateWebHostBuilder(string[] args) =>
25+
public static IHostBuilder CreateHostBuilder(string[] args) =>
2626
Host.CreateDefaultBuilder(args)
2727
.ConfigureWebHostDefaults(webBuilder =>
2828
{
2929
webBuilder.UseStartup<Startup>()
3030
.UseUrls("http://0.0.0.0:{{#serverPort}}{{serverPort}}{{/serverPort}}{{^serverPort}}8080{{/serverPort}}/");
3131
});
3232
}
33-
}
33+
}

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

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ namespace {{packageName}}.Client
448448
}
449449
450450
{{#supportsAsync}}
451-
private async Task<ApiResponse<T>> ExecAsync<T>(RestRequest req, IReadableConfiguration configuration)
451+
private async Task<ApiResponse<T>> ExecAsync<T>(RestRequest req, IReadableConfiguration configuration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
452452
{
453453
RestClient client = new RestClient(_baseUrl);
454454
@@ -479,7 +479,7 @@ namespace {{packageName}}.Client
479479
480480
InterceptRequest(req);
481481
482-
var response = await client.ExecuteAsync<T>(req);
482+
var response = await client.ExecuteAsync<T>(req, cancellationToken);
483483
484484
InterceptResponse(req, response);
485485
@@ -526,11 +526,12 @@ namespace {{packageName}}.Client
526526
/// <param name="options">The additional request options.</param>
527527
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
528528
/// GlobalConfiguration has been done before calling this method.</param>
529+
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
529530
/// <returns>A Task containing ApiResponse</returns>
530-
public Task<ApiResponse<T>> GetAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
531+
public Task<ApiResponse<T>> GetAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
531532
{
532533
var config = configuration ?? GlobalConfiguration.Instance;
533-
return ExecAsync<T>(NewRequest(HttpMethod.Get, path, options, config), config);
534+
return ExecAsync<T>(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken);
534535
}
535536
536537
/// <summary>
@@ -540,11 +541,12 @@ namespace {{packageName}}.Client
540541
/// <param name="options">The additional request options.</param>
541542
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
542543
/// GlobalConfiguration has been done before calling this method.</param>
544+
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
543545
/// <returns>A Task containing ApiResponse</returns>
544-
public Task<ApiResponse<T>> PostAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
546+
public Task<ApiResponse<T>> PostAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
545547
{
546548
var config = configuration ?? GlobalConfiguration.Instance;
547-
return ExecAsync<T>(NewRequest(HttpMethod.Post, path, options, config), config);
549+
return ExecAsync<T>(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken);
548550
}
549551
550552
/// <summary>
@@ -554,11 +556,12 @@ namespace {{packageName}}.Client
554556
/// <param name="options">The additional request options.</param>
555557
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
556558
/// GlobalConfiguration has been done before calling this method.</param>
559+
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
557560
/// <returns>A Task containing ApiResponse</returns>
558-
public Task<ApiResponse<T>> PutAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
561+
public Task<ApiResponse<T>> PutAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
559562
{
560563
var config = configuration ?? GlobalConfiguration.Instance;
561-
return ExecAsync<T>(NewRequest(HttpMethod.Put, path, options, config), config);
564+
return ExecAsync<T>(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken);
562565
}
563566
564567
/// <summary>
@@ -568,11 +571,12 @@ namespace {{packageName}}.Client
568571
/// <param name="options">The additional request options.</param>
569572
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
570573
/// GlobalConfiguration has been done before calling this method.</param>
574+
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
571575
/// <returns>A Task containing ApiResponse</returns>
572-
public Task<ApiResponse<T>> DeleteAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
576+
public Task<ApiResponse<T>> DeleteAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
573577
{
574578
var config = configuration ?? GlobalConfiguration.Instance;
575-
return ExecAsync<T>(NewRequest(HttpMethod.Delete, path, options, config), config);
579+
return ExecAsync<T>(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken);
576580
}
577581
578582
/// <summary>
@@ -582,11 +586,12 @@ namespace {{packageName}}.Client
582586
/// <param name="options">The additional request options.</param>
583587
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
584588
/// GlobalConfiguration has been done before calling this method.</param>
589+
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
585590
/// <returns>A Task containing ApiResponse</returns>
586-
public Task<ApiResponse<T>> HeadAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
591+
public Task<ApiResponse<T>> HeadAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
587592
{
588593
var config = configuration ?? GlobalConfiguration.Instance;
589-
return ExecAsync<T>(NewRequest(HttpMethod.Head, path, options, config), config);
594+
return ExecAsync<T>(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken);
590595
}
591596
592597
/// <summary>
@@ -596,11 +601,12 @@ namespace {{packageName}}.Client
596601
/// <param name="options">The additional request options.</param>
597602
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
598603
/// GlobalConfiguration has been done before calling this method.</param>
604+
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
599605
/// <returns>A Task containing ApiResponse</returns>
600-
public Task<ApiResponse<T>> OptionsAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
606+
public Task<ApiResponse<T>> OptionsAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
601607
{
602608
var config = configuration ?? GlobalConfiguration.Instance;
603-
return ExecAsync<T>(NewRequest(HttpMethod.Options, path, options, config), config);
609+
return ExecAsync<T>(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken);
604610
}
605611
606612
/// <summary>
@@ -610,11 +616,12 @@ namespace {{packageName}}.Client
610616
/// <param name="options">The additional request options.</param>
611617
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
612618
/// GlobalConfiguration has been done before calling this method.</param>
619+
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
613620
/// <returns>A Task containing ApiResponse</returns>
614-
public Task<ApiResponse<T>> PatchAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
621+
public Task<ApiResponse<T>> PatchAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
615622
{
616623
var config = configuration ?? GlobalConfiguration.Instance;
617-
return ExecAsync<T>(NewRequest(HttpMethod.Patch, path, options, config), config);
624+
return ExecAsync<T>(NewRequest(HttpMethod.Patch, path, options, config), config, cancellationToken);
618625
}
619626
#endregion IAsynchronousClient
620627
{{/supportsAsync}}

0 commit comments

Comments
 (0)