Skip to content

Commit

Permalink
fix xml format
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Jan 18, 2025
2 parents b10d84e + 9e66c4f commit 9856b03
Show file tree
Hide file tree
Showing 2,735 changed files with 170,598 additions and 8,376 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ assignees: ''
#### Bug Report Checklist

- [ ] Have you provided a full/minimal spec to reproduce the issue?
- [ ] Have you validated the input using an OpenAPI validator ([example](https://apidevtools.org/swagger-parser/online/))?
- [ ] Have you validated the input using an OpenAPI validator ([example](https://apitools.dev/swagger-parser/online/))?
- [ ] Have you [tested with the latest master](https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-to-test-with-the-latest-master-of-openapi-generator) to confirm the issue still exists?
- [ ] Have you searched for related issues/PRs?
- [ ] What's the actual output vs expected output?
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samples-dotnet-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
build:
name: Build .Net projects
runs-on: ubuntu-latest
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/samples-dotnet9.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ jobs:
- samples/client/petstore/csharp/generichost/net9/Petstore
- samples/client/petstore/csharp/generichost/net9/SourceGeneration
- samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate
# restsharp
- samples/client/petstore/csharp/restsharp/net9/EnumMappings
# httpclient
- samples/client/petstore/csharp/httpclient/net9/Petstore
# unity
#- samples/client/petstore/csharp/unityWebRequest/net9/Petstore
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
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 @@ -34,6 +34,7 @@ jobs:
- samples/server/petstore/kotlin-springboot-delegate
- samples/server/petstore/kotlin-springboot-modelMutable
- samples/server/petstore/kotlin-springboot-reactive
- samples/server/petstore/kotlin-springboot-reactive-without-flow
- samples/server/petstore/kotlin-springboot-source-swagger1
- samples/server/petstore/kotlin-springboot-source-swagger2
- samples/server/petstore/kotlin-springboot-springfox
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/samples-scala.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
with:
distribution: 'temurin'
java-version: 8
- name: Setup sbt launcher
uses: sbt/setup-sbt@v1
- name: Cache maven dependencies
uses: actions/cache@v4
env:
Expand Down
10 changes: 10 additions & 0 deletions CI/circle_parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@ if [ "$NODE_INDEX" = "1" ]; then

sudo apt-get -y install cpanminus

# install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"

echo "Testing perl"
(cd samples/client/petstore/perl && /bin/bash ./test.bash)

echo "Testing ruby"
(cd samples/client/petstore/ruby && mvn integration-test)
(cd samples/client/petstore/ruby-faraday && mvn integration-test)
(cd samples/client/petstore/ruby-httpx && mvn integration-test)
(cd samples/client/petstore/ruby-autoload && mvn integration-test)

echo "Testing rust"
(cd samples/server/petstore/rust-axum && mvn integration-test)

elif [ "$NODE_INDEX" = "2" ]; then
echo "Running node $NODE_INDEX to test Go"
# install haskell
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ If you want to join the committee, please kindly apply by sending an email to te
| Android | @jaz-ah (2017/09) |
| Apex | |
| Bash | @frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09) |
| C | @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) |
| C | @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) @eafer (2024/12) |
| C++ | @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @martindelille (2018/03) @muttleyxd (2019/08) |
| C# | @mandrean (2017/08) @shibayan (2020/02) @Blackclaws (2021/03) @lucamazzanti (2021/05) @iBicha (2023/07) |
| Clojure | |
Expand Down
13 changes: 13 additions & 0 deletions bin/configs/csharp-httpclient-net9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# for .net standard httpclient
generatorName: csharp
outputDir: samples/client/petstore/csharp/httpclient/net9/Petstore
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
library: httpclient
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false
useOneOfDiscriminatorLookup: true
targetFramework: net9.0
equatable: true
14 changes: 14 additions & 0 deletions bin/configs/csharp-restsharp-net9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# for .net standard
generatorName: csharp
outputDir: samples/client/petstore/csharp/restsharp/net9/EnumMappings
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
useCompareNetObjects: true
disallowAdditionalPropertiesIfNotPresent: false
useOneOfDiscriminatorLookup: true
targetFramework: net9.0
equatable: true
enumNameMappings:
delivered: Shipped
9 changes: 9 additions & 0 deletions bin/configs/csharp-unityWebRequest-net9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# for .net Unity
generatorName: csharp
outputDir: samples/client/petstore/csharp/unityWebRequest/net9/Petstore
inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp
library: unityWebRequest
additionalProperties:
targetFramework: net9.0
equatable: true
1 change: 1 addition & 0 deletions bin/configs/java-okhttp-gson.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ additionalProperties:
useOneOfDiscriminatorLookup: true
disallowAdditionalPropertiesIfNotPresent: false
useReflectionEqualsHashCode:: true
removeEnumValuePrefix: true
enumNameMappings:
s: LOWER_CASE_S
S: UPPER_CASE_S
Expand Down
13 changes: 13 additions & 0 deletions bin/configs/kotlin-spring-boot-reactive-without-flow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
generatorName: kotlin-spring
outputDir: samples/server/petstore/kotlin-springboot-reactive-without-flow
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: springdoc
annotationLibrary: swagger2
useSwaggerUI: "true"
serviceImplementation: "true"
reactive: "true"
beanValidations: "true"
useFlowForArrayReturnType: "false"
4 changes: 3 additions & 1 deletion bin/configs/kotlin-spring-boot-reactive.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
generatorName: kotlin-spring
outputDir: samples/server/petstore/kotlin-springboot-reactive
library: spring-boot
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
additionalProperties:
documentationProvider: springdoc
Expand All @@ -10,3 +10,5 @@ additionalProperties:
serviceImplementation: "true"
reactive: "true"
beanValidations: "true"
# the following option is set to true by default
#useFlowForArrayReturnType: "true"
11 changes: 11 additions & 0 deletions bin/configs/manual/rust-axum-oneof-v3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
generatorName: rust-axum
outputDir: samples/server/petstore/rust-axum/output/rust-axum-oneof
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust-axum/rust-axum-oneof.yaml
templateDir: modules/openapi-generator/src/main/resources/rust-axum
generateAliasAsModel: true
additionalProperties:
hideGenerationTimestamp: "true"
packageName: rust-axum-oneof
globalProperties:
skipFormModel: "false"
enablePostProcessFile: true
5 changes: 5 additions & 0 deletions bin/utils/test_file_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@
sha256: 67a9e63e13ebddac21cb236aa015edce30f5d3bd8d6adcf50044cad00d48c45e
- filename: "samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ZebraTest.java"
sha256: 15eeb6d8a9a79d0f1930b861540d9c5780d6c49ea4fdb68269ac3e7ec481e142
# rust axum test files
- filename: "samples/server/petstore/rust-axum/output/rust-axum-oneof/tests/oneof_with_discriminator.rs"
sha256: 2d4f5a069fdcb3057bb078d5e75b3de63cd477b97725e457079df24bd2c30600
- filename: "samples/server/petstore/rust-axum/output/openapi-v3/tests/oneof_untagged.rs"
sha256: e72fbf81a9849dc7abb7e2169f2fc355c8b1cf991c0e2ffc083126abd9e966e7
2 changes: 2 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ title: "FAQ: General"

## Do you have a chat room?

Yes, we use Slack.

[![Join the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/zt-2wmkn4s8g-n19PJ99Y6Vei74WMUIehQA)

## What is the governance structure of the OpenAPI Generator project?
Expand Down
3 changes: 2 additions & 1 deletion docs/generators/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The following generators are available:
* [php-dt](php-dt.md)
* [powershell](powershell.md)
* [python](python.md)
* [python-legacy](python-legacy.md)
* [python-pydantic-v1](python-pydantic-v1.md)
* [r](r.md)
* [ruby](ruby.md)
* [rust](rust.md)
Expand Down Expand Up @@ -100,6 +100,7 @@ The following generators are available:
* [php-symfony](php-symfony.md)
* [python-aiohttp](python-aiohttp.md)
* [python-blueplanet](python-blueplanet.md)
* [python-fastapi](python-fastapi.md)
* [python-flask](python-flask.md)
* [ruby-on-rails](ruby-on-rails.md)
* [ruby-sinatra](ruby-sinatra.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/generators/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|releaseNote|Release note, default to 'Minor update'.| |Minor update|
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|sourceFolder|source folder for generated code| |src|
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.1`|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1</dd><dt>**net47**</dt><dd>.NET Framework 4.7</dd><dt>**net48**</dt><dd>.NET Framework 4.8</dd><dt>**net6.0**</dt><dd>.NET 6.0 (End of Support 12 November 2024)</dd><dt>**net7.0**</dt><dd>.NET 7.0</dd><dt>**net8.0**</dt><dd>.NET 8.0</dd><dt>**net9.0**</dt><dd>.NET 9.0</dd></dl>|net9.0|
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.1`|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1</dd><dt>**net47**</dt><dd>.NET Framework 4.7</dd><dt>**net48**</dt><dd>.NET Framework 4.8</dd><dt>**net8.0**</dt><dd>.NET 8.0 (End of Support 10 November 2026)</dd><dt>**net9.0**</dt><dd>.NET 9.0 (End of Support 12 May 2026)</dd></dl>|net9.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
1 change: 1 addition & 0 deletions docs/generators/kotlin-spring.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|title|server title name or client service name| |OpenAPI Kotlin Spring|
|useBeanValidation|Use BeanValidation API annotations to validate data types| |true|
|useFeignClientUrl|Whether to generate Feign client with url parameter.| |true|
|useFlowForArrayReturnType|Whether to use Flow for array/collection return types when reactive is enabled. If false, will use List instead.| |true|
|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false|
|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|
Expand Down
2 changes: 1 addition & 1 deletion docs/generators/postgresql-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|defaultDatabaseName|Database name that will be used for all generated PostgreSQL DDL and DML statements.| ||
|idAutoIncEnabled|If `true`, generates autoincrement PostgreSQL types `SERIAL` and `BIGSERIAL` for `int32` and `int64` respectively for integer fields with name 'id'.| |false|
|identifierNamingConvention|Naming convention of PostgreSQL idebntifiers (table names and column names).|<dl><dt>**snake_case**</dt><dd>Transform named to 'snake_case'.</dd><dt>**original**</dt><dd>Leave original names as in `YAML` file.</dd></dl>|snake_case|
|jsonDataType|Use of PostgreSQL data types for complex model properties.|<dl><dt>**json**</dt><dd>Generate `JSON` fields. Value is stored in `JSON` data type field as human-readable text. Value compliance with JSON standard is checked.</dd><dt>**jsonb**</dt><dd>Generate `JSONB` fields. Value is stored in `JSONB` data type field in binary format. `JSONB` data type is generally nore efficient than `JSON` but it is not human-readable. Value compliance with JSON standard is checked.</dd><dt>**off**</dt><dd>Generate `TEXT` fields. Just store the value as plain text. Value compliance with JSON standard is not checked.</dd></dl>|json|
|jsonDataType|Use of PostgreSQL data types for complex model properties.|<dl><dt>**json**</dt><dd>Generate `JSON` fields. Value is stored in `JSON` data type field as human-readable text. Value compliance with JSON standard is checked.</dd><dt>**jsonb**</dt><dd>Generate `JSONB` fields. Value is stored in `JSONB` data type field in binary format. `JSONB` data type is generally more efficient than `JSON` but it is not human-readable. Value compliance with JSON standard is checked.</dd><dt>**off**</dt><dd>Generate `TEXT` fields. Just store the value as plain text. Value compliance with JSON standard is not checked.</dd></dl>|json|
|namedParametersEnabled|Generates query examples with named variables in value placeholders (eg.`:name`,`:quantity`) if `true`. Otherwise, generates question marks `?` in value placeholders.| |false|

## IMPORT MAPPING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,7 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case,
"If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.";

public static final String UNSUPPORTED_V310_SPEC_MSG =
"Generation using 3.1.0 specs is in development and is not officially supported yet. " +
"If you would like to expedite development, please consider working on the open issues in the 3.1.0 project: https://github.com/orgs/OpenAPITools/projects/4/views/1 " +
"and reach out to our team on Slack at https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g";
"OpenAPI 3.1 support is still in beta. To report an issue related to 3.1 spec, please kindly open an issue in the Github repo: https://github.com/openAPITools/openapi-generator.";

public static final String ENUM_UNKNOWN_DEFAULT_CASE = "enumUnknownDefaultCase";
public static final String ENUM_UNKNOWN_DEFAULT_CASE_DESC =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1083,8 +1083,8 @@ public String toString() {
sb.append(", items='").append(items).append('\'');
sb.append(", additionalProperties='").append(additionalProperties).append('\'');
sb.append(", isModel='").append(isModel).append('\'');
sb.append(", isNull='").append(isNull);
sb.append(", hasValidation='").append(hasValidation);
sb.append(", isNull='").append(isNull).append('\'');
sb.append(", hasValidation='").append(hasValidation).append('\'');
sb.append(", getAdditionalPropertiesIsAnyType=").append(getAdditionalPropertiesIsAnyType());
sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping);
sb.append(", getIsAnyType=").append(getIsAnyType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ apiTemplateFiles are for API outputs only (controllers/handlers).
// acts strictly upon a spec, potentially modifying it to have consistent behavior across generators.
protected boolean strictSpecBehavior = true;
// flag to indicate whether enum value prefixes are removed
protected boolean removeEnumValuePrefix = true;
protected boolean removeEnumValuePrefix = false;

// Support legacy logic for evaluating discriminators
@Setter protected boolean legacyDiscriminatorBehavior = true;
Expand Down Expand Up @@ -3875,29 +3875,8 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required, boo
}

Schema original = null;
// process the dereference schema if it's a ref to allOf with a single item
// and certain field(s) (e.g. description, readyOnly, etc) is set
if (p.get$ref() != null) {
Schema derefSchema = ModelUtils.getReferencedSchema(openAPI, p);
if (ModelUtils.isAllOfWithSingleItem(derefSchema) && (
derefSchema.getReadOnly() != null ||
derefSchema.getWriteOnly() != null ||
derefSchema.getDeprecated() != null ||
derefSchema.getDescription() != null ||
derefSchema.getMaxLength() != null ||
derefSchema.getMinLength() != null ||
derefSchema.getMinimum() != null ||
derefSchema.getMaximum() != null ||
derefSchema.getMaximum() != null ||
derefSchema.getMinItems() != null ||
derefSchema.getTitle() != null
)) {
p = ModelUtils.getReferencedSchema(openAPI, p);
}
}

// check if it's allOf (only 1 sub schema) with or without default/nullable/etc set in the top level
if (ModelUtils.isAllOfWithSingleItem(p)) {
if (ModelUtils.isAllOf(p) && p.getAllOf().size() == 1) {
if (p.getAllOf().get(0) instanceof Schema) {
original = p;
p = (Schema) p.getAllOf().get(0);
Expand Down Expand Up @@ -6524,6 +6503,9 @@ public String sanitizeName(final String name, String removeCharRegEx, ArrayList<
// input.name => input_name
modifiable = this.sanitizeValue(modifiable, "\\.", "_", exceptions);

// input:name => input_name
modifiable = this.sanitizeValue(modifiable, ":", "_", exceptions);

// input-name => input_name
modifiable = this.sanitizeValue(modifiable, "-", "_", exceptions);

Expand Down
Loading

0 comments on commit 9856b03

Please sign in to comment.