Skip to content

Commit

Permalink
Merge branch 'OpenAPITools:master' into feat/php-nextgen-client-strea…
Browse files Browse the repository at this point in the history
…ming
  • Loading branch information
neilime authored Jul 24, 2024
2 parents a4a53bb + 1c62c03 commit 2b73da0
Show file tree
Hide file tree
Showing 1,030 changed files with 36,747 additions and 5,926 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/samples-dotnet8-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Samples C# .Net 8 Server

on:
push:
paths:
- samples/server/petstore/aspnetcore-8.0/**
- samples/server/petstore/aspnetcore-8.0-*/**
pull_request:
paths:
- samples/server/petstore/aspnetcore-8.0/**
- samples/server/petstore/aspnetcore-8.0-*/**
jobs:
build:
name: Build .Net 8 servers
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
- samples/server/petstore/aspnetcore-8.0
- samples/server/petstore/aspnetcore-8.0-NewtonsoftFalse
- samples/server/petstore/aspnetcore-8.0-nullableReferenceTypes
- samples/server/petstore/aspnetcore-8.0-pocoModels
- samples/server/petstore/aspnetcore-8.0-project4Models
- samples/server/petstore/aspnetcore-8.0-useSwashBuckle
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
dotnet-version: '8.0.x'
- name: Build
working-directory: ${{ matrix.sample }}
run: dotnet build Org.OpenAPITools.sln
- name: Test
working-directory: ${{ matrix.sample }}
run: dotnet test Org.OpenAPITools.sln
9 changes: 7 additions & 2 deletions .github/workflows/samples-java-client-echo-api-jdk17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Java Client (Echo API) JDK17
on:
push:
paths:
- samples/client/echo_api/java/restclient
- samples/client/echo_api/java/**
pull_request:
paths:
- samples/client/echo_api/java/restclient
- samples/client/echo_api/java/**
jobs:
build:
name: Build Java Client JDK17
Expand All @@ -16,6 +16,11 @@ jobs:
matrix:
sample:
# clients
- samples/client/echo_api/java/apache-httpclient
- samples/client/echo_api/java/native
- samples/client/echo_api/java/feign-gson
- samples/client/echo_api/java/resttemplate
- samples/client/echo_api/java/resteasy
- samples/client/echo_api/java/restclient
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/samples-kotlin-server-jdk17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
sample:
# server
- samples/server/petstore/kotlin-springboot-3
- samples/server/petstore/kotlin-springboot-delegate-nodefaults
- samples/server/petstore/kotlin-springboot-request
- samples/server/petstore/kotlin-springboot-request-cookie
- samples/server/petstore/kotlin-server/javalin
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/samples-kotlin-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
sample:
# server
- samples/server/petstore/kotlin-springboot
- samples/server/petstore/kotlin-springboot-multipart-request-model
- samples/server/petstore/kotlin-springboot-bigdecimal-default
- samples/server/petstore/kotlin-springboot-delegate
- samples/server/petstore/kotlin-springboot-modelMutable
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/samples-python-client-echo-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
- samples/client/echo_api/python
- samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Test
working-directory: ${{ matrix.sample }}
run: python -m pytest
run: python -m unittest discover

- name: mypy
working-directory: ${{ matrix.sample }}
Expand Down
15 changes: 8 additions & 7 deletions README.md

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions bin/configs/aspnetcore-8.0-NewtonsoftFalse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
generatorName: aspnetcore
outputDir: samples/server/petstore/aspnetcore-8.0-NewtonsoftFalse
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
additionalProperties:
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
aspnetCoreVersion: "8.0"
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
useNewtonsoft: false
9 changes: 9 additions & 0 deletions bin/configs/aspnetcore-8.0-nullableReferenceTypes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
generatorName: aspnetcore
outputDir: samples/server/petstore/aspnetcore-8.0-nullableReferenceTypes
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
additionalProperties:
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
aspnetCoreVersion: "8.0"
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
nullableReferenceTypes: true
9 changes: 9 additions & 0 deletions bin/configs/aspnetcore-8.0-pocoModels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
generatorName: aspnetcore
outputDir: samples/server/petstore/aspnetcore-8.0-pocoModels
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
additionalProperties:
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
aspnetCoreVersion: "8.0"
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
pocoModels: true
9 changes: 9 additions & 0 deletions bin/configs/aspnetcore-8.0-project4Models.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
generatorName: aspnetcore
outputDir: samples/server/petstore/aspnetcore-8.0-project4Models
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
additionalProperties:
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
aspnetCoreVersion: "8.0"
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
useSeparateModelProject: true
11 changes: 11 additions & 0 deletions bin/configs/aspnetcore-8.0-useSwashBuckle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
generatorName: aspnetcore
outputDir: samples/server/petstore/aspnetcore-8.0-useSwashBuckle
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
additionalProperties:
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
aspnetCoreVersion: "8.0"
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
useSwashBuckle: false
buildTarget: library
isLibrary: true
8 changes: 8 additions & 0 deletions bin/configs/aspnetcore-8.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
generatorName: aspnetcore
outputDir: samples/server/petstore/aspnetcore-8.0
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0
additionalProperties:
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}'
aspnetCoreVersion: "8.0"
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37'
14 changes: 14 additions & 0 deletions bin/configs/kotlin-spring-boot-delegate-nodefaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
generatorName: kotlin-spring
outputDir: samples/server/petstore/kotlin-springboot-delegate-nodefaults
library: spring-boot
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
additionalProperties:
documentationProvider: none
annotationLibrary: swagger2
useSwaggerUI: "true"
delegatePattern: "true"
skipDefaultInterface: "true"
beanValidations: "true"
requestMappingMode: "api_interface"
useSpringBoot3: "true"
1 change: 1 addition & 0 deletions bin/configs/kotlin-spring-boot-delegate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ additionalProperties:
annotationLibrary: swagger2
useSwaggerUI: "true"
delegatePattern: "true"
appendRequestToHandler: "true"
beanValidations: "true"
requestMappingMode: none
5 changes: 5 additions & 0 deletions bin/configs/kotlin-spring-boot-multipart-request-model.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
generatorName: kotlin-spring
outputDir: samples/server/petstore/kotlin-springboot-multipart-request-model
library: spring-boot
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_15251_multipart_request_model.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
4 changes: 4 additions & 0 deletions bin/configs/typescript-fetch-oneOf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
generatorName: typescript-fetch
outputDir: samples/client/petstore/typescript-fetch/builds/oneOf
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript-fetch/oneOf.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch
7 changes: 7 additions & 0 deletions bin/configs/typescript-fetch-self-import-issue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
generatorName: typescript-fetch
outputDir: samples/client/others/typescript-fetch/self-import-issue
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript-fetch/self-import-issue.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch
additionalProperties:
typescriptThreePlus: "true"
legacyDiscriminatorBehavior: "false"
4 changes: 2 additions & 2 deletions docs/generators/aspnetcore.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl

| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|aspnetCoreVersion|ASP.NET Core version: 6.0, 5.0, 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)|<dl><dt>**2.0**</dt><dd>ASP.NET Core 2.0</dd><dt>**2.1**</dt><dd>ASP.NET Core 2.1</dd><dt>**2.2**</dt><dd>ASP.NET Core 2.2</dd><dt>**3.0**</dt><dd>ASP.NET Core 3.0</dd><dt>**3.1**</dt><dd>ASP.NET Core 3.1</dd><dt>**5.0**</dt><dd>ASP.NET Core 5.0</dd><dt>**6.0**</dt><dd>ASP.NET Core 6.0</dd></dl>|3.1|
|aspnetCoreVersion|ASP.NET Core version: 6.0, 5.0, 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)|<dl><dt>**2.0**</dt><dd>ASP.NET Core 2.0</dd><dt>**2.1**</dt><dd>ASP.NET Core 2.1</dd><dt>**2.2**</dt><dd>ASP.NET Core 2.2</dd><dt>**3.0**</dt><dd>ASP.NET Core 3.0</dd><dt>**3.1**</dt><dd>ASP.NET Core 3.1</dd><dt>**5.0**</dt><dd>ASP.NET Core 5.0</dd><dt>**6.0**</dt><dd>ASP.NET Core 6.0</dd><dt>**7.0**</dt><dd>ASP.NET Core 7.0</dd><dt>**8.0**</dt><dd>ASP.NET Core 8.0</dd></dl>|8.0|
|buildTarget|Target to build an application or library|<dl><dt>**program**</dt><dd>Generate code for a standalone server</dd><dt>**library**</dt><dd>Generate code for a server abstract class library</dd></dl>|program|
|classModifier|Class Modifier for controller classes: Empty string or abstract.| ||
|compatibilityVersion|ASP.Net Core CompatibilityVersion| |Version_2_2|
Expand All @@ -45,7 +45,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|returnICollection|Return ICollection&lt;T&gt; instead of the concrete type.| |false|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src|
|swashbuckleVersion|Swashbuckle version: 3.0.0 (deprecated), 4.0.0 (deprecated), 5.0.0 (deprecated), 6.4.0|<dl><dt>**3.0.0**</dt><dd>Swashbuckle 3.0.0</dd><dt>**4.0.0**</dt><dd>Swashbuckle 4.0.0</dd><dt>**5.0.0**</dt><dd>Swashbuckle 5.0.0</dd><dt>**6.4.0**</dt><dd>Swashbuckle 6.4.0</dd></dl>|3.0.0|
|swashbuckleVersion|Swashbuckle version: 3.0.0 (deprecated), 4.0.0 (deprecated), 5.0.0 (deprecated), 6.4.0|<dl><dt>**3.0.0**</dt><dd>Swashbuckle 3.0.0</dd><dt>**4.0.0**</dt><dd>Swashbuckle 4.0.0</dd><dt>**5.0.0**</dt><dd>Swashbuckle 5.0.0</dd><dt>**6.4.0**</dt><dd>Swashbuckle 6.4.0</dd></dl>|6.4.0|
|useCollection|Deserialize array types to Collection&lt;T&gt; instead of List&lt;T&gt;.| |false|
|useDateTimeForDate|Use DateTime to model date properties even if DateOnly supported. (.net 6.0+ only)| |false|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
Expand Down
14 changes: 13 additions & 1 deletion docs/generators/kotlin-spring.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|serverPort|configuration the port in which the sever is to run on| |8080|
|serviceImplementation|generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated| |false|
|serviceInterface|generate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap pattern| |false|
|skipDefaultInterface|Whether to skip generation of default implementations for interfaces| |false|
|skipDefaultInterface|Whether to skip generation of default implementations for interfaces (Api interfaces or Delegate interfaces depending on the delegatePattern option)| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|sourceFolder|source folder for generated code| |src/main/kotlin|
Expand All @@ -57,6 +57,18 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true|
|useTags|Whether to use tags for creating interface and controller class names| |false|

## SUPPORTED VENDOR EXTENSIONS

| Extension name | Description | Applicable for | Default value |
| -------------- | ----------- | -------------- | ------------- |
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL|
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null


## IMPORT MAPPING

| Type/Alias | Imports |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,17 @@ public AspNetServerCodegen() {
aspnetCoreVersion.addEnum("3.1", "ASP.NET Core 3.1");
aspnetCoreVersion.addEnum("5.0", "ASP.NET Core 5.0");
aspnetCoreVersion.addEnum("6.0", "ASP.NET Core 6.0");
aspnetCoreVersion.setDefault("3.1");
aspnetCoreVersion.addEnum("7.0", "ASP.NET Core 7.0");
aspnetCoreVersion.addEnum("8.0", "ASP.NET Core 8.0");
aspnetCoreVersion.setDefault("8.0");
aspnetCoreVersion.setOptValue(aspnetCoreVersion.getDefault());
cliOptions.add(aspnetCoreVersion);

swashbuckleVersion.addEnum("3.0.0", "Swashbuckle 3.0.0");
swashbuckleVersion.addEnum("4.0.0", "Swashbuckle 4.0.0");
swashbuckleVersion.addEnum("5.0.0", "Swashbuckle 5.0.0");
swashbuckleVersion.addEnum("6.4.0", "Swashbuckle 6.4.0");
swashbuckleVersion.setDefault("3.0.0");
swashbuckleVersion.setDefault("6.4.0");
swashbuckleVersion.setOptValue(swashbuckleVersion.getDefault());
cliOptions.add(swashbuckleVersion);

Expand Down Expand Up @@ -427,7 +429,7 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("typeConverter.mustache", packageFolder + File.separator + "Converters", "CustomEnumConverter.cs"));
}

if (aspnetCoreVersion.getOptValue().startsWith("3.") || aspnetCoreVersion.getOptValue().startsWith("5.0") || aspnetCoreVersion.getOptValue().startsWith("6.")) {
if (!aspnetCoreVersion.getOptValue().startsWith("2.")) {
supportingFiles.add(new SupportingFile("OpenApi" + File.separator + "TypeExtensions.mustache", packageFolder + File.separator + "OpenApi", "TypeExtensions.cs"));
}

Expand Down Expand Up @@ -681,7 +683,7 @@ private void setBuildTarget() {
private void setAspnetCoreVersion(String packageFolder) {
setCliOption(aspnetCoreVersion);

if (aspnetCoreVersion.getOptValue().startsWith("3.") || aspnetCoreVersion.getOptValue().startsWith("5.0") || aspnetCoreVersion.getOptValue().startsWith("6.")) {
if (!aspnetCoreVersion.getOptValue().startsWith("2.")) {
compatibilityVersion = null;
} else if ("2.0".equals(aspnetCoreVersion.getOptValue())) {
compatibilityVersion = null;
Expand All @@ -698,6 +700,8 @@ private void setAspnetCoreVersion(String packageFolder) {

private String determineTemplateVersion(String frameworkVersion) {
switch (frameworkVersion) {
case "8.0":
case "7.0":
case "6.0":
case "5.0":
case "3.1":
Expand Down
Loading

0 comments on commit 2b73da0

Please sign in to comment.