Compare commits

...

113 Commits

Author SHA1 Message Date
William Cheng
1b352c2d00 update samples 2025-07-09 10:45:51 +08:00
Daniel García
991883636f Fix typo in cli title (#21534) 2025-07-09 10:37:07 +08:00
Leon Linhart
3ef45f1b4d Discard mapped dmodels with matching explicit discriminator mappings (#20939) 2025-07-08 11:18:13 +08:00
William Cheng
7e439fd0bd update chi to newer version (#21528) 2025-07-08 11:00:10 +08:00
Mattias Sehlstedt
63df7ca574 Add samples for when using the useSealed setting for Spring (#21515)
* Add samples for when using the useSealed setting for Spring

* Add the new sample generation to the workflow
2025-07-08 10:27:53 +08:00
Daniel García
98b315c137 Qualify rust trait template comments (#21527) 2025-07-08 10:26:22 +08:00
William Cheng
a809c187b4 [JavaSpring] Fix when openapi spec file has array of files (#21524)
* [JavaSpring] Fix when openapi spec file has array of files

The isArray is not checked for non-reactive isFile condition. This is remediated.

* update samples

---------

Co-authored-by: Siddharth Wagle <SidWagz@users.noreply.github.com>
2025-07-07 17:45:22 +08:00
Pascal Bachor
d966f1234d Bump jmustache 1.15 -> 1.16 (#21352)
* Bump jmustache

* adjust templates to updated jmustache semantics

---------

Co-authored-by: Pascal Bachor <bachorp@users.noreply.github.com>
2025-07-07 16:59:08 +08:00
William Dutton
6fdb632fb9 fix: #21345 Java Native Client, handle Byte[] and File response types correctly (#21346) 2025-07-04 00:34:08 +08:00
William Cheng
c7542dea3e Add SerpApi to bronze sponsor list (#21517)
* add serapi to bronze sponsor list

* update

* update
2025-07-04 00:29:13 +08:00
William Cheng
66dfad2b09 use dart petstore test spec (#21516) 2025-07-04 00:05:15 +08:00
staticdev
9e5e4b1fd4 fix(python): Change template default license to Unlicense (#21514) 2025-07-03 21:01:29 +08:00
dsteeley
2af194b014 [rust-server] Update to hyper1 in rust-server generator (#21422)
* Add rust-server-deprecated generator in preparation for hyper1 upgrade to rust-server generator

* [Rust Server] Fix spacing in `Cargo.mustache` (#17876)

* [Rust Server] Update dependency versions in `Cargo.mustache` (#17876)

* [Rust Server] Update templates so generated client and server compile (#17876)

* [Rust Server] Get `server` example to compile (#17876)

* [Rust Server] Update `client` example to compile (#17876)

* [Rust Server] Update `bin/cli.rs` to compile (#17876)

* Revert changes to use typed auth in rust-server. Run sample generation.

* Hyper1 fixup compilation errors in all examples

* Add tests to all examples, clippy, tests, cli-bin, run examples
* Use headers Auth structs
* Fixup various clippy lints
* Move more Service impl to use BoxBody
* Reduce generic restriction on some Service impl where possible

* Appease clippy lints in rust 1.88

---------

Co-authored-by: Azriel Hoh <azriel@healthpoint.co.nz>
2025-07-03 01:55:33 +08:00
Samuel Gulliksson
65773a9024 [JavaSpring] Allow configuring generic ResponseEntity for Spring generator. (#21387)
* Allow configuring generic ResponseEntity for Spring generator.

* Re-run documentation update script.
2025-07-02 18:16:57 +08:00
Jochen Schalanda
311233d804 [Java][MicroProfile] Support additionalProperties with Jackson (#21451)
Refs #20853
Refs #20947
2025-07-02 15:52:58 +08:00
Lukáš Černý
b444de2b5c php-nextgen - Fix flatten() to support arrays of files (#21458)
* php-nextgen - Fix flatten() to support arrays of files in multipart/form-data

Previously, FormDataProcessor::flatten() unconditionally passed all values through ObjectSerializer::toString(),
which caused an error when flattening arrays containing file resources (e.g. for OpenAPI
multipart/form-data definitions with `type: array`, `items: type: string, format: binary`).

This change adds a check for is_resource() to preserve stream handles without serialization,
ensuring correct behavior when uploading multiple files in a single request.

* php-nextgen - Fix flatten() to support arrays of files in multipart/form-data - samples
2025-07-02 15:46:42 +08:00
William Cheng
d0327b2683 add tests for scala http4s server: (#21507) 2025-07-02 15:45:58 +08:00
donilg
af6ab0ed0e [scala][http4s] fix codegen for using reserved words in openapi (#21490) 2025-07-02 15:29:33 +08:00
Mattias Sehlstedt
050dcae3ab Move the singleRequestParameter template into a separate file (#21489)
* Move the singleRequestParameter template into a separate file

* Update formatting of non-singleRequestParameter webclient and restclient samples
2025-07-02 15:18:52 +08:00
William Cheng
e948355127 update Dart samples 2025-07-01 20:52:55 +08:00
Matthew Nitschke
7c57c55194 [dart-dio] Fix json_serializable response for type:string format:binary (#21379)
* fixed inconsistencies with the dart-dio json_serializable string binary response types

* update deserialize template to handle responseFile

* regenerate samples

* only convert return_type to Uint8List

* remove unused imports from previous changes

* fixed issues where import wouldn't get included

* specific unit test for binary response

* reverted changes to nested generators

* removed 2 additional php modifications

* regen samples
2025-07-01 20:39:26 +08:00
Bruno Coelho
a5f638fefd Revert "[kotlin-client] Add support for integer enums in serialization for kotlin-client (#21248)" (#21491)
This reverts commit 0aaeb45dbe.
2025-06-29 18:40:08 +01:00
DavidGrath
0e67c3a5ad [typescript] Utility types now considered when generating schemas (Issue #21317) (#21414)
* Added failing test to fix Record renaming issue

* Typescript utility types now taken into account when generating. Addresses #21317

* Ran generation script

* Remove print statements

* Removed TS ANTLR. Added Utility Types Sample. Pending Regeneration

* Generated samples for utility types

* Samples fix

* Removed TypeScript utility type samples. Other reviews applied

* Updated samples

* meta-codegen
2025-06-29 13:04:22 +02:00
Daniel Jibouleau
43fa1b736a Markdown docs : No lowercase on anchors in README file (#21442)
Co-authored-by: Daniel Jibouleau <daniel.jibouleau@aina.ai>
2025-06-29 17:48:46 +08:00
Jorren Hendriks
304b3cbcaa [Java][Native] Fix POJOs with additionalProperties incorrectly extending HashMap (#21367)
* [Java][Native] Fix POJO with additionalProperties to not extend HashMap

* [Java][Native] Update samples to remove HashMap extension
2025-06-29 17:46:37 +08:00
CG
d7a74849f2 fix: fix Boolean type mismatch for kotlin-spring generator (#21481) 2025-06-29 16:52:32 +08:00
William Cheng
c0dc9c63d0 update swagger parser to newer version (#21484) 2025-06-29 16:11:00 +08:00
Steven Crake
03effd7d05 Replace periods with underscores in Rust model names (#21480)
Fix issue where period-delimited model names (e.g. microsoft.graph.fido2AuthenticationMethod)
were being converted to unwieldy names with "Period" substitutions. Now periods are replaced
with underscores like hyphens, resulting in cleaner and more idiomatic Rust identifiers.

Fixes #15254
2025-06-29 15:52:55 +08:00
Gregory Merlet
d11d008e71 Fix typescript-fetch missing imports for oneof field with discriminator (#21477)
* fix: add support for discriminator in oneOf schemas and update model imports

* chore: generate samples

* fix: enhance model imports for oneOf arrays in mustache templates

* fix: correct import formatting in mustache templates and TypeScript files
2025-06-27 15:26:30 +02:00
Beppe Catanese
b6b71cd4da [Typescript]: add deprecated tags (#21436)
* Add deprecation markers

* Move inputSpec (avoid sharing with other generators)

* Generate samples

* Refactor unit tests

* Add test helper method

* Revert "Add test helper method"

This reverts commit d3935e87d9.

* Assert number of expected @deprecated
2025-06-27 14:45:47 +02:00
Rory Schadler
6b5fd6e622 fix(python): skip license if not provided (#21471)
* fix: skip license if not provided

* chore: formatting diff for JavaTimeFormatter.java, Pair.java
2025-06-27 00:47:50 +08:00
William Cheng
c010c89915 update samples 2025-06-27 00:39:13 +08:00
DavidGrath
b05604dab7 Restricted Java oneOf imports to Jackson only when needed (#21404) (#21405)
* Fixed issue #21404 - Restricted Java oneOf imports to Jackson when needed

* Fix TODOs
2025-06-26 17:12:37 +08:00
Ron Reynolds
cfe476f32d immutable Pair, better performant HttpBearerAuth, consistent code-style (#20743)
* make Pair immutable and in google-code-style

* apply google-code-style to JavaTimeFormatter (to make it consistent with most other auto-generated java)

* move upperCaseBearer to ctor (scheme is final and private; only needs to be fixed once); also replaced Optional with ternary (perf and cleaner code)

* apply google-code-style to Authentication to make it consistent with rest of auth code

* fresh samples
2025-06-26 17:10:36 +08:00
Miguel Teixeira
d911a71be9 [BUG][Kotlin] fix: kotlin code generator should sanitize enum values according to convention (#21459)
* fix kotlin code generator should sanitize enum values according to convention

* update samples

* Revert "update samples"

This reverts commit 51a55bcdfe.
2025-06-25 16:43:31 +01:00
William Cheng
046be5dba1 Prepare 7.15.0 (#21445)
* Revert "v7.14.0 release (#21443)"

This reverts commit 5eb083e5ce.

* prepare v7.15.0 snapshot

* update samples

* update readme

* update doc
2025-06-25 21:34:58 +08:00
William Cheng
5eb083e5ce v7.14.0 release (#21443) 2025-06-20 16:21:21 +08:00
William Cheng
0903ecf85e update urllib3 to newer versions in python-fastpi (#21439) 2025-06-19 21:47:05 +08:00
Al Scott
88bc79e906 [Typescript Fetch] Handle date parameters in the URL path (#19313)
* Handle date parameters in the URL path

* Reformat template and add cast for date fields

* Change code structure by moving path tranformations to assignment

Couldn't get handlebars to format the inline replaces in a sane way
without collapsing everything onto one very ugly line. This way keeps
some sane template formatting while still outputting workable code.

* Regenerate samples after merge

* Updated param checking

* Try a new commit after manually re-logging into CircleCI
2025-06-19 11:47:16 +02:00
Steven Blakowski
cef971cf9a [Java][RestTemplate] Gradle Build include non-compatible Spring Dependency with jakarta disabled (#21426)
* [Java][resttemplate] fix spring-web dependency for gradle without jakarta enabled

* fix samples
2025-06-19 16:11:37 +08:00
Stefan Paul Noack
8d8e3ddf16 fix(typescript-fetch): use type modifier on imports for discriminator.mappedModels (#21397)
* typescript-fetch: use `type` modifier on imports for `discriminator.mappedModels`

This ensures that the generated code works when `--verbatimModuleSyntax` is enabled for the TypeScript compiler.
Regular imports already use the `type` modifier, so this should not be a breaking change.

* update samples
2025-06-18 16:50:20 +02:00
William Cheng
623463a6ed [Java] Fix content for enum in MultiPart (#21428)
* [Java] Fix content for enum in addPartToMultiPartBuilder ([#19973](https://github.com/OpenAPITools/openapi-generator/issues/19973))

* [Java] Fix content for enum with restclient (#19973)

* [Java] Fix content for enum with restclient (#19973)

* [Java] Fix content for enum with restclient (#19973)

* update samples

---------

Co-authored-by: Michael Bornholdt Nielsen <michaelbornholdtnielsen@gmail.com>
Co-authored-by: Michael Bornholdt Nielsen <jarryDk@users.noreply.github.com>
2025-06-18 16:52:54 +08:00
Youri Westerman
43e878b421 [python] Validate pyproject.toml and fix the pyproject.toml version constraint format (#21402)
* Validate pyproject.toml of echo client python sample

* Use PEP-508 compatible version constraint for `requires-python` key

* Update samples

* Move job to petstore workflow

* Update generated sample

* Use equals or greater than operator instead of greater than

* Update samples
2025-06-18 16:39:37 +08:00
Youri Westerman
50c6754fcc Fix broken mypy checks (#21423) 2025-06-18 15:51:04 +08:00
David Gamero
d2b8a1eeac [typescript] add abort signal to requestcontext (#21323)
* add abort signal to requestcontext

* regenerate

* rebuild and regenerate

* abort signal import

* refresh samples

* clean csharp samples

* csharp sample cleanup

* add missing cs samples from master

* abort testing
2025-06-17 10:45:43 +02:00
William Cheng
dbc5d09da6 update python-fastapi requests to newer version (#21421) 2025-06-16 20:42:16 +08:00
Amin Ya
6e9dedba75 [cpp-rest-sdk] fix enum values being used instead of names (#21223)
* [cpp-rest-sdk] fix enum values being used instead of names

* [cpp-rest-sdk] remove unnecessary prefix for enum classes

* [cpprest-sdk]: use _XPLATSTR for string_t on Windows
2025-06-16 17:50:36 +08:00
KatyaValik
fc29daa6c0 Add enums to scala-http4s-server (#21320) 2025-06-16 11:42:02 +08:00
Rens Groothuijsen
db38f0f556 [rust-axum] Prevent multiple declarations of the same operation (#21396)
* [rust-axum] Prevent multiple declarations of the same operation

* [rust-axum] Add missing "delete on exit" to duplicate declaration test
2025-06-16 10:35:03 +08:00
dependabot[bot]
d5ab8f225e Bump brace-expansion from 1.1.11 to 1.1.12 in /website (#21418)
Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 1.1.11 to 1.1.12.
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/1.1.11...v1.1.12)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 1.1.12
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-16 10:26:44 +08:00
William Cheng
055687935b update spring web version in resttemplate (#21417) 2025-06-16 10:20:01 +08:00
William Cheng
6bfd39f5de fix sponsor link in readme 2025-06-16 09:55:56 +08:00
Ilia
7f578d7444 [kotlin] Fix compile error in enum properties with "" values(#18660) (#21416) 2025-06-15 09:04:15 +01:00
oscarobr
8087f2b365 [Java][vertx] fix path param encoding (#21403)
* Issue:21401 Fix Java vertx path param encoding

* Generate samples
2025-06-12 19:29:18 +08:00
Andrei
937d314e19 [jaxrs-spec][quarkus] fix cookie in param (#21400) 2025-06-12 18:29:20 +08:00
Amin Ya
12fa2c0032 [cpp-restsdk] store Object as a shared pointer (#21349)
* [cpp-restsdk] store Object as a shared pointer

* [cpp-restsdk] add test for object property
2025-06-10 14:53:55 +08:00
Mostafa Aghajani
fa64c8e012 Issue: #21334 Abstract PHP support of "original" for variableNamingConvention (#21336)
* feat(php): add support for 'off' variable naming convention in AbstractPhpCodegen

* feat(php-laravel): add tests for issue 21334 with API and model definitions

* feat(php-laravel): update variableNamingConvention option in php-laravel help file to include 'off' as a valid value

* feat: enhance variableNamingConvention options to include 'off' and detailed descriptions in documentation

* feat(php): update variableNamingConvention from 'off' to 'original' in AbstractPhpCodegen

* feat: include php-laravel-issue-21334 in workflow triggers for push and pull_request events
2025-06-09 19:26:53 +08:00
devhl-labs
fbd94d5fbb removed duplicate service registration (#21395) 2025-06-08 23:09:26 +08:00
Andrew Wilson
4402d836bb Fix MiskKotlin OpenApiGenerator types (#21390)
* first pass

* fixup up Array -> List

* fixup up Array -> List

* File response type

* don't mess returnTypes.mustache
2025-06-06 20:47:39 +08:00
Nicklas Utgaard
89eea742fe avoid intersection type (#21378)
avoid intersection type by splitting the statements into separate code-branches. for each branch the type of `value` is therefor no longer an intersection

Fixes https://github.com/OpenAPITools/openapi-generator/issues/20636
2025-06-04 20:48:11 +01:00
William Cheng
eb8ce7331a update common custom user data maven extensions to 2.x (#21377) 2025-06-04 21:00:33 +08:00
William Cheng
4cfc8eff00 Add tests for enum names with dots in python cilents (#21374)
* add tests for enum names with dot

* remove file

* apply same fix to python pydantic v1

* update test
2025-06-04 16:18:10 +08:00
Ondřej Šimon
9d70de44d6 [JavaSpring][21200] improve Kotlin interopability with optional values (#21202)
nullable annotations are now added to getters, setters, parameters, for optional attributes without default value
2025-06-04 15:47:43 +08:00
Peter Caisse
d88d588665 Replace periods with '_DOT_' in Python enum member names (#21372)
This is relevant for enums whose values are floats since without this
step the enum is syntactically invalid.

See: https://github.com/OpenAPITools/openapi-generator/issues/21322
2025-06-04 15:18:58 +08:00
William Cheng
b57c23b121 update java restemplate dependencies to newer versions (#21368) 2025-06-04 02:28:52 +08:00
William Cheng
b20c569187 update devlocity to newer versions (#21369) 2025-06-03 23:41:45 +08:00
Thomas Sickinger
49cadfec3a fix(python-fastapi): remove 200 fallback code and use default (#12481) (#21333)
Co-authored-by: Thomas Sickinger <thomas.sickinger@teamviewer.com>
2025-06-03 21:02:24 +08:00
LuukvH
81cdc82af7 fix(ruby-client): fix incorrect Date parsing in OneOf (#21364)
Changes Date.parse to Date.iso8601 to fix incorrect type coercion in OneOf contexts. Previously, arbitrary strings matching Date.parse's lenient pattern (e.g., "ABC1") were incorrectly coerced to dates (2025-06-01), when they should have remained as strings.

For example:
- "ABC1" was parsed as Date(2025-06-01) instead of remaining "ABC1"
- This occurred because Date.parse treats the first char as month ('A'=1)
  and remaining digits as day

The fix ensures only ISO8601 formatted strings (e.g. "2025-06-02") are parsed as dates, improving type safety and preventing unexpected coercion of string values.
2025-06-03 16:57:21 +08:00
martin-mfg
9ebc6308b9 update slack invitation links (#21361) 2025-06-03 15:26:46 +08:00
Mikhail Obidin
fbca2b28d0 [gradle-plugin] Pass openapiGeneratorIgnoreList option from the openApiGenerate extension to the corresponding task (#21363) 2025-06-03 15:26:32 +08:00
William Dutton
b929970db2 fix: #21329 Java Native, Provide Null Check before toString on param variables (#21330)
* fix: #21329 Java Native, Provide Null Check before toString on param variables

* #21329 - Samples Generated
2025-06-02 16:56:22 +08:00
Amin Ya
18ccf86a6a [cpp-restsdk] link cpprest without crypto libraries (#21348)
These libraries aren't needed in the generated code. Cpprest doesn't need the crypto libraries directly. It uses OpenSSL
2025-06-02 16:55:41 +08:00
Nicklas Wiegandt
5997acb592 feat (JAVA NATIVE): add support for useSingleRequestParameter to java native client (#21331) 2025-06-02 15:36:59 +08:00
William Cheng
bce88c93ba update swagger pareer to 2.1.28 (#21325) 2025-06-02 15:33:27 +08:00
devhl-labs
a428cff3f4 [csharp][generichost] Updated docs (#21357)
* updated docs

* updated docs

* updated docs
2025-06-01 18:10:08 +08:00
Csaba Kozák
959326048f [kotlin-client][multiplatform] update Kotlin and libraries versions (#21353) 2025-06-01 18:03:37 +08:00
Alexandre Cassagne
1f8787e53a fix: update axum generated multipart requests to own the body (#21301)
* fix: update axum generated multipart requests to own the Multipart or Body

Notes: &Multipart cannot access fields, as we need mutable access.

* chore: run the updated rust-axum sample

* chore: run the updated rust-axum sample (2)
Notes: Ran
   ./mvnw clean package || exit
   ./bin/generate-samples.sh
   ./bin/configs/*.yaml || exit
   ./bin/utils/export_docs_generators.sh || exit

* chore: fix inconsistent lifetimes

Notes: Multipart should be owned; normal request remains borrowed

* chore: rerun axum samples
2025-05-31 23:32:03 +08:00
William Cheng
1b57d4b1e6 Better handling of metadata in allOf (#21342)
* better handling of metadata in allof

* update samples
2025-05-30 20:37:53 +08:00
Florian Brombauer
5677f5b09b Introduce option 'importFileExtension' to typescript-axios (#21343) (#21344) 2025-05-29 13:13:04 +02:00
andreas-umbricht
05e672d856 [Kotlin] Primitive array items validity check (#21315)
* Primitive array items validity check

* Update samples
2025-05-27 23:34:41 +08:00
William Cheng
2c67841e5c Add option to set container's default to empty container (#21269)
* add default to empty container option

* test map default to empty container

* update java generators to respect default value

* various fixes

* fix tests

* update doc
2025-05-27 16:59:35 +08:00
jase
dcd89bf3c5 feat(typescript-angular): add util "provideApi" and update docs to standalone applications (#21173)
* feat(angular): add util "provideApi" for standalone applications (Angular 17 and above)

* feat(angular): update README with new provideApi usage examples for Angular applications

* feat(angular): update README to reflect new provideApi import path and usage examples

* feat(angular): add support for README_beforeV17 and update provideApi return type

* feat(angular): add support for README_beforeV17 and update provideApi return type

* feat(angular): add support for README_beforeV17 and update provideApi return type

* fix: correct casing in DuplicateTest and FooDuplicateTest headers

* feat(angular): add provideApi function and update README with usage examples
2025-05-26 13:02:34 +02:00
William Cheng
d2196dd727 use poetry 1.x in python aiohttp client (#21328) 2025-05-25 22:43:22 +08:00
Youri Westerman
041d36c954 [python] Fix poetry deprecation warnings (#21268)
* Convert pyproject.toml template to the format expected by Poetry >=2.0
(https://python-poetry.org/blog/announcing-poetry-2.0.0)

* Update samples

* Add option to fallback to Poetry 1.x style pyproject.toml

* Generate new docs and samples

* Place project.urls section a bit further down, so that it doesn't clash with other sections

* Update samples
2025-05-25 21:16:31 +08:00
DavidGrath
c6a88eaf8e [JAVA] Correct generation of schema default values of type object (issue #21051) (#21278)
* Fix Issue #21051

* Renamed Test to avoid being overriden by JUnit import

* Test fix
2025-05-25 18:34:42 +08:00
Spencer Cornish
c4dad53455 [GO] Go Server: Adds ordered routes to go-server router (#21280)
* Adds ordered routes to go-server router

* Generate and fix test

* Newline

* Readd escaping

* Fixes go router unit test

* Updates tests, one more time
2025-05-25 13:49:15 +08:00
devhl-labs
a891876ea9 fixed token availablity (#21326) 2025-05-25 13:48:49 +08:00
devhl-labs
66ff91a687 bumped dependency versions (#21327) 2025-05-25 13:48:17 +08:00
Youri Westerman
4379a23608 [python] Explicitly define github workflow permissions (#21311)
* Explicitly define github workflow permissions (python)

* Update samples
2025-05-22 10:21:19 +08:00
William Cheng
f735c6e091 add savetwt to sponsor list (#21310) 2025-05-21 11:37:42 +08:00
William Cheng
5ec4e4c8f1 add tests for cpp-restsdk client (#21305) 2025-05-20 16:45:49 +08:00
Michael Vistein (DLR)
cdef985ca7 Fix referenced primitive types (#19456) 2025-05-20 16:41:21 +08:00
martin-mfg
dac1e6b7d3 optimize regex (#21188) 2025-05-20 16:27:19 +08:00
Tassilo Karge
894008f325 [Python] Correct sanitize_for_serialization in python generator for list in oneOf schema elements, fixes #18106 (#19405)
* correct sanitize_for_serialization in python generator, fixes #18106

The method did not consider the objects created for oneOf schemata. If one of the cases was a list, to_dict would return it instead of something that has an items() method.

* generate new samples
2025-05-20 16:26:38 +08:00
William Cheng
5f63385a31 Provide " as member" where needed (#21304)
* fix: #20878 Provide " as member" where needed

- Generate new samples
- Add tests for all effected python versions
- Ran tests with success

Commands used to verify:
./bin/generate-samples.sh ./bin/configs/python*
mvn verify -Psamples
mvn integration-test -f modules/openapi-generator/pom.xml -Dtest=org.openapitools.codegen.python.PythonPydanticV1ClientCodegenTest -e
mvn integration-test -f modules/openapi-generator/pom.xml -Dtest=org.openapitools.codegen.python.PythonClientCodegenTest -e

* remove 3.8 tests

* use localhost

* update tests

* update test

---------

Co-authored-by: Robert Plummer <rplummer@sequel.ae>
2025-05-20 16:25:11 +08:00
sandwoodK
13c95f1dd2 Fix nim compilation in case a edge case of a schema with enum (#20780)
If enum constraint contains one value which is not a valid nim
identifier, we must surround this identifier with backtick.
2025-05-20 15:38:58 +08:00
Andreas Kuhtz
78b54b9283 Fix broken build on Windows OS if the schema contains references to other schema files. (#21300) 2025-05-20 10:06:01 +08:00
CHervaudBetclic
0aaeb45dbe [kotlin-client] Add support for integer enums in serialization for kotlin-client (#21248) 2025-05-19 08:43:24 +01:00
Guillaume Turri
6e2b4f99ba [PHP-Symfony] revamp the computation of the contentType (#21292)
recent commit 40894382fc already improved
that method: before that other commit it was juste impossible to query
a endpoint with a response type that was something else than
application/json or application/xml. With that commit it became possible
to query such endpoint provided that the client declare in its Accept
header that it can cope with */* (or provided that the client omitted
that header altogether).

But there were still cases badly handled. For instance if an endpoint
returns a response of type image/png and that it receives a query with
header "Accept: image/png", then it would reply with 406.

To avoid any other issue with type resolution, this commit revamps the
getOutputFormat function more thoroughly and does it by implementing
the specification available at
https://httpwg.org/specs/rfc9110.html#field.accept ), which means that
the format accepted by the client are ordered by the relative weights
specified it specified.
2025-05-19 10:09:16 +08:00
Rens Groothuijsen
45047b77f1 [python-fastapi] Upgrade dependencies to support Python 3.13 (#21291) 2025-05-18 09:56:24 +08:00
William Cheng
b3935922cd update snakeyaml version to 2.4 (#21293) 2025-05-17 13:49:09 +08:00
Andrew Wilson
9b39c05563 Kotlin Misk Add Extra Parameters (#21271)
* first pass

* squash

* fixing FILES
2025-05-16 14:37:49 +08:00
Jens Balvig
cfe0b6fae3 Fix spelling mistake in validations (#21287) 2025-05-16 13:55:18 +08:00
Guillaume Turri
6c0e7274ea [Php-Symfony] showcase recent features in petstore.yaml (#21286)
PR #21261 added support for endpoint with response of type text/plain
or even image/png.

This commit adds such endpoint so that:
- the way those are supported is clearer (as it is now directly visible
  in the generated sample files)
- if a future commit impacts this part of the generation it will be easier
  to assess that impact
2025-05-16 10:32:52 +08:00
Peter Storch
5b885cd3db [kotlin-spring] fix validation regression in kotlin-spring generator (#21255)
* fix #21238 regression in kotlin-spring generator

* add tests for issue #21238
2025-05-16 00:08:51 +08:00
Ondřej Šimon
68c1d8970e [20808] add Autowired annotations guard to skip generation (#21198)
annotation import and usage is not generated when API is not a Spring Bean
2025-05-15 18:51:25 +08:00
Sohaib Athar
bd8a206ebd fix(cpp-qt-client): add asJsonObject method to OAIEnum class (#19307) (#21211)
* add asJsonObject method to OAIEnum class to fix enum handling in query parameters

* update samples

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2025-05-15 14:00:55 +08:00
William Cheng
0bfce24071 Add model name mapping option to rust generators (#21282)
* add model name mapping option to rust generators

* update package name

* update samples
2025-05-15 13:29:37 +08:00
Guillaume Turri
40894382fc [php-symfony] fix handling of endpoints with "text/plain" or "image/png" response type (#21261)
* [php-symfony] Never return 406 when user accepts */*

When a query has header "Accept" set to "*/*" it means it accepts
everything. It is hence weird to return a 406.
This patch ensures it does not occur: when the query accepts everything
then we take any produced type.

This fixes #13334. This also partly makes the open PR #15560 obsolete
(or at least, it provides a workaround)

* [php-symfony] Don't crash at runtime on null convertFormat

$this->convertFormat may return "null". When it's the case we end up
calling

    ...->serialize($data, null);

but this crashes at runtime because that serialize method declares that
the 2nd parameter is of type "string" (so null is not accepted).

With this patch we avoid having an error 500. Instead we return something
that makes perfect sense when the OpenApi specification declares a content
of type "text/plain" and that the returned value is for instance a string,
an int, or a boolean.

* [php Symfony] fix return type for non json/xml api

This fixes the generated returned type of controller methods for
endpoint with a response declared like

    content:
      text/plain:
        schema:
          type: <boolean|string|integer|number>

or for

    content:
      image/png:
        schema:
          type: string
          format: binary

Without this commit the generated method *had to* return a value that
matched "array|object|null", which does not work in this case.
This commit makes it possible to return the proper type.
2025-05-14 21:11:39 +08:00
Amin Ya
429da9860b [rust] support model/maps as deep/explode params (#21262)
* [rust] support model/maps as deep/explode params

* [rust] add tests for rust deep objects

* [rust] detect normal non deep objects

* [rust] distinguish model and object

* [rust] fix objects as params for hyper
2025-05-14 14:44:05 +08:00
jglagrimas
a0b9ecd773 [php-laravel generator] update $request->bool to $request->boolean (#21273)
* Chores : update $request->bool to $request->boolean

$request->bool is not a laravel function should be $request->boolean()

* Chores : update FakeController.php $request->boolean()
2025-05-14 14:37:16 +08:00
William Cheng
2fb26c362e update kotlin samples 2025-05-11 23:43:24 +08:00
Ross Sullivan
9981a408d1 [kotlin] Added path sanitization in javadoc comments (#20767)
* [kotlin] Added path sanitization in javadoc comments

* added sample as regression test

* Added samples/client/others/kotlin-jvm-okhttp-path-comments to github workflow
2025-05-11 23:23:50 +08:00
10325 changed files with 146254 additions and 83988 deletions

View File

@@ -71,6 +71,7 @@ jobs:
- samples/client/petstore/java/microprofile-rest-client-mutiny
- samples/client/petstore/java/microprofile-rest-client-3.0
- samples/client/petstore/java/microprofile-rest-client-3.0-jackson
- samples/client/petstore/java/microprofile-rest-client-3.0-jackson-mutiny
- samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml
- samples/client/petstore/java/microprofile-rest-client-3.0-mutiny
- samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter
@@ -110,6 +111,27 @@ jobs:
path: |
~/.m2
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
- name: Build
- name: Build with Maven
working-directory: ${{ matrix.sample }}
run: mvn clean package --no-transfer-progress
- name: Cache gradle dependencies
uses: actions/cache@v4
env:
cache-name: gradle-caches
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}
- name: Cache gradle wrapper
uses: actions/cache@v4
env:
cache-name: gradle-wrapper
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: Build with Gradle
working-directory: ${{ matrix.sample }}
if: ${{ hashFiles('./gradlew') != '' }}
run: ./gradlew build -x test

View File

@@ -7,12 +7,14 @@ on:
- samples/client/petstore/java/webclient-jakarta/**
- samples/client/petstore/java/restclient-*/**
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
- samples/client/others/java/restclient-enum-in-multipart/**
pull_request:
paths:
- samples/client/petstore/java/resttemplate-jakarta/**
- samples/client/petstore/java/webclient-jakarta/**
- samples/client/petstore/java/restclient-*/**
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
- samples/client/others/java/restclient-enum-in-multipart/**
jobs:
build:
name: Build Java Client JDK17
@@ -30,6 +32,7 @@ jobs:
- samples/client/petstore/java/restclient-useSingleRequestParameter
- samples/client/petstore/java/restclient-useSingleRequestParameter-static
- samples/client/petstore/java/webclient-useSingleRequestParameter
- samples/client/others/java/restclient-enum-in-multipart
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4

View File

@@ -65,6 +65,7 @@ jobs:
- samples/client/echo_api/kotlin-jvm-spring-3-restclient
- samples/client/petstore/kotlin-name-parameter-mappings
- samples/client/others/kotlin-jvm-okhttp-parameter-tests
- samples/client/others/kotlin-jvm-okhttp-path-comments
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4

View File

@@ -6,11 +6,13 @@ on:
- samples/server/petstore/php-symfony/SymfonyBundle-php/**
- samples/server/petstore/php-flight/**
- samples/server/petstore/php-laravel/**
- samples/server/petstore/php-laravel-issue-21334/**
pull_request:
paths:
- samples/server/petstore/php-symfony/SymfonyBundle-php/**
- samples/server/petstore/php-flight/**
- samples/server/petstore/php-laravel/**
- samples/server/petstore/php-laravel-issue-21334/**
jobs:
build:
name: Build PHP projects
@@ -28,6 +30,7 @@ jobs:
- samples/server/petstore/php-symfony/SymfonyBundle-php/
- samples/server/petstore/php-flight/
- samples/server/petstore/php-laravel/
- samples/server/petstore/php-laravel-issue-21334/
steps:
- uses: actions/checkout@v4
- name: Setup PHP with tools

View File

@@ -8,6 +8,18 @@ on:
- .github/workflows/samples-python-petstore.yaml
jobs:
validate-pyproject-toml:
name: Validate pyproject.toml
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install validator
run: pip install 'validate-pyproject[all]'
- name: Validate
run: validate-pyproject samples/openapi3/client/petstore/python/pyproject.toml
build:
name: Test Python client
runs-on: ubuntu-latest

View File

@@ -15,7 +15,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"

View File

@@ -26,12 +26,54 @@ jobs:
- samples/client/others/rust/
- samples/client/petstore/rust/
- samples/server/petstore/rust-server/
- samples/server/petstore/rust-server-deprecated/
- samples/server/petstore/rust-axum/
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-targets: false # Don't cache workspace target directories as they don't exist
cache-directories:
${{ matrix.sample }}/target
workspaces: |
${{ matrix.sample }}/output/*
- name: Build
working-directory: ${{ matrix.sample }}
run: cargo build --all-targets --all-features
- name: Tests
working-directory: ${{ matrix.sample }}
run: |
set -e
# Skip samples/client/petstore/rust/ as it's tests are failing.
if [[ "${{ matrix.sample }}" == "samples/client/petstore/rust/" ]]; then
echo "Skipping tests for samples/client/petstore/rust/"
exit 0
fi
# Iterate through each example and test various features
for package in $(find . -maxdepth 1 -mindepth 1 -type d)
do
# Not all versions have a client example
if test -f examples/client/main.rs; then
cargo build --example client --features="client"
fi
# Not all versions have a server example
if test -f examples/server/main.rs; then
cargo build --example server --features="server"
fi
# Test the CLI works if present
if test -f bin/cli.rs; then
cargo build --bin ${package##*/} --features cli
target/debug/${package##*/} --help
fi
cargo fmt
cargo test
cargo clippy
cargo doc
done

View File

@@ -10,6 +10,7 @@ on:
- samples/server/petstore/springboot-lombok-tostring
- samples/server/petstore/springboot-file-delegate-optional
- samples/server/petstore/springboot-petstore-with-api-response-examples
- samples/server/petstore/spring-boot-oneof-sealed
pull_request:
paths:
- samples/openapi3/client/petstore/spring-cloud-3-with-optional
@@ -19,6 +20,7 @@ on:
- samples/server/petstore/springboot-lombok-tostring
- samples/server/petstore/springboot-file-delegate-optional
- samples/server/petstore/springboot-petstore-with-api-response-examples
- samples/server/petstore/spring-boot-oneof-sealed
jobs:
build:
name: Build Java Spring (JDK17)
@@ -36,6 +38,7 @@ jobs:
- samples/server/petstore/springboot-lombok-tostring
- samples/server/petstore/springboot-file-delegate-optional
- samples/server/petstore/springboot-petstore-with-api-response-examples
- samples/server/petstore/spring-boot-oneof-sealed
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4

View File

@@ -3,11 +3,11 @@
<extension>
<groupId>com.gradle</groupId>
<artifactId>develocity-maven-extension</artifactId>
<version>1.21.6</version>
<version>1.23.2</version>
</extension>
<extension>
<groupId>com.gradle</groupId>
<artifactId>common-custom-user-data-maven-extension</artifactId>
<version>1.12.5</version>
<version>2.0.2</version>
</extension>
</extensions>

View File

@@ -6,7 +6,7 @@
[![Stable releases in Maven Central](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/org/openapitools/openapi-generator/maven-metadata.xml.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22)
[![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-orange)](./LICENSE)
[![Open Collective backers](https://img.shields.io/opencollective/backers/openapi_generator?color=orange&label=OpenCollective%20Backers)](https://opencollective.com/openapi_generator)
[![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)
[![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-36ucx4ybl-jYrN6euoYn6zxXNZdldoZA)
[![Follow OpenAPI Generator Twitter account to get the latest update](https://img.shields.io/twitter/follow/oas_generator.svg?style=social&label=Follow)](https://twitter.com/oas_generator)
[![Contribute with Gitpod](https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/OpenAPITools/openapi-generator)
[![Conan Center](https://shields.io/conan/v/openapi-generator)](https://conan.io/center/recipes/openapi-generator)
@@ -15,7 +15,7 @@
<div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.14.0`):
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`7.15.0`):
[![Build Status](https://api.travis-ci.com/OpenAPITools/openapi-generator.svg?branch=master&status=passed)](https://app.travis-ci.com/github/OpenAPITools/openapi-generator/builds)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
@@ -75,6 +75,8 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
[<img src="https://openapi-generator.tech/img/companies/dm.png" width="128" height="128">](https://www.dotcom-monitor.com/sponsoring-open-source-projects/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
[<img src="https://openapi-generator.tech/img/companies/clickit.jpg" width="128" height="128">](https://www.clickittech.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
[<img src="https://openapi-generator.tech/img/companies/unified_to.jpg" width="128" height="128">](https://unified.to/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
[<img src="https://openapi-generator.tech/img/companies/savetwt.jpg" width="128" height="128">](https://savetwt.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
[<img src="https://openapi-generator.tech/img/companies/serpapi.png" width="128" height="128">](https://serpapi.com/?utm_source=openapi-generator&utm_medium=sponsorship&utm_campaign=oss-sponsorship)
#### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS, Checkly for sponsoring the API monitoring and Gradle for sponsoring Develocity
@@ -148,8 +150,8 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
| OpenAPI Generator Version | Release Date | Notes |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
| 7.14.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.14.0-SNAPSHOT/) | 29.05.2025 | Minor release with breaking changes (with fallback) |
| [7.13.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.13.0) (latest stable release) | 27.04.2025 | Minor release with breaking changes (with fallback) |
| 7.15.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.15.0-SNAPSHOT/) | 29.07.2025 | Minor release with breaking changes (with fallback) |
| [7.14.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v7.14.0) (latest stable release) | 25.06.2025 | Minor release with breaking changes (with fallback) |
| [6.6.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.6.0) | 11.05.2023 | Minor release with breaking changes (with fallback) |
| [5.4.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.4.0) | 31.01.2022 | Minor release with breaking changes (with fallback) |
| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) |
@@ -212,16 +214,16 @@ See the different versions of the [openapi-generator-cli](https://search.maven.o
<!-- RELEASE_VERSION -->
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 11 runtime at a minimum):
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.13.0/openapi-generator-cli-7.13.0.jar`
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.14.0/openapi-generator-cli-7.14.0.jar`
For **Mac/Linux** users:
```sh
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.13.0/openapi-generator-cli-7.13.0.jar -O openapi-generator-cli.jar
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.14.0/openapi-generator-cli-7.14.0.jar -O openapi-generator-cli.jar
```
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
```
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.13.0/openapi-generator-cli-7.13.0.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.14.0/openapi-generator-cli-7.14.0.jar
```
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
@@ -456,7 +458,7 @@ openapi-generator-cli version
To use a specific version of "openapi-generator-cli"
```sh
openapi-generator-cli version-manager set 7.13.0
openapi-generator-cli version-manager set 7.14.0
```
Or install it as dev-dependency:
@@ -480,7 +482,7 @@ pip install openapi-generator-cli
To install a specific version
```
pip install openapi-generator-cli==7.13.0
pip install openapi-generator-cli==7.14.0
```
You can also install with [jdk4py](https://github.com/activeviam/jdk4py) instead of java binary. (python>=3.10 is required)
@@ -506,7 +508,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g php -o c:\temp\php_api_client`)
<!-- RELEASE_VERSION -->
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.13.0/openapi-generator-cli-7.13.0.jar)
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.14.0/openapi-generator-cli-7.14.0.jar)
<!-- /RELEASE_VERSION -->
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`

View File

@@ -0,0 +1,8 @@
generatorName: dart-dio
outputDir: samples/openapi3/client/petstore/dart-dio/binary_response
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_20682.yaml
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
additionalProperties:
hideGenerationTimestamp: "true"
enumUnknownDefaultCase: "true"
serializationLibrary: "json_serializable"

View File

@@ -1,6 +1,6 @@
generatorName: dart-dio
outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
typeMappings:
Client: "ModelClient"

View File

@@ -1,6 +1,6 @@
generatorName: dart-dio
outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
typeMappings:
Client: "ModelClient"

View File

@@ -1,6 +1,6 @@
generatorName: dart
outputDir: samples/openapi3/client/petstore/dart2/petstore_client_lib_fake
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/dart2
typeMappings:
Client: "ModelClient"

View File

@@ -0,0 +1,12 @@
generatorName: java
outputDir: samples/client/petstore/java/microprofile-rest-client-3.0-jackson-mutiny
library: microprofile
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
serializationLibrary: jackson
artifactId: microprofile-rest-client-3-jackson-mutiny
configKey: petstore
microprofileRestClientVersion: "3.0"
microprofileMutiny: true
hideGenerationTimestamp: true

View File

@@ -10,6 +10,7 @@ parameterNameMappings:
_type: underscoreType
type_: typeWithUnderscore
additionalProperties:
defaultToEmptyContainer: "array?|array|map?"
artifactId: petstore-okhttp-gson
hideGenerationTimestamp: true
useOneOfDiscriminatorLookup: true

View File

@@ -0,0 +1,7 @@
generatorName: java
outputDir: samples/client/others/java/restclient-enum-in-multipart
library: restclient
inputSpec: modules/openapi-generator/src/test/resources/3_1/enum-in-multipart.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
hideGenerationTimestamp: "true"

View File

@@ -0,0 +1,8 @@
generatorName: kotlin
outputDir: samples/client/others/kotlin-jvm-okhttp-path-comments
library: jvm-okhttp4
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/issue20618-path-comments.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties:
artifactId: kotlin-petstore-okhttp4-path-comments

View File

@@ -3,9 +3,16 @@ outputDir: samples/server/petstore/kotlin-misk-config
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-misk
validateSpec: false
useBeanValidation: true
additionalProperties:
hideGenerationTimestamp: "true"
moduleClassName: "PetStoreModule"
generateStubImplClasses: true
addModelMoshiJsonAnnotation: true
actionPathPrefix : "samplePrefix"
actionPathPrefix: "samplePrefix"
actionAnnotations: "@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 2.0);@Suppress(\"unused\")"
actionImports: "misk.web.actions.WebAction;misk.web.interceptors.LogRequestResponse"
actionParentClass: "WebAction"
actionRequestContentType: "@RequestContentType"
actionRequestContentTypePrefix: "MediaTypes"
testingModule: "misk.web.MiskWebModule"

View File

@@ -0,0 +1,8 @@
generatorName: php-laravel
outputDir: samples/server/petstore/php-laravel-issue-21334
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue21334.yaml
templateDir: modules/openapi-generator/src/main/resources/php-laravel
gitUserId: openapitools
gitRepoId: petstore
additionalProperties:
variableNamingConvention: "original"

View File

@@ -6,6 +6,7 @@ library: asyncio
additionalProperties:
packageName: petstore_api
mapNumberTo: float
poetry1: true
nameMappings:
_type: underscore_type
type_: type_with_underscore

View File

@@ -0,0 +1,10 @@
generatorName: rust
outputDir: samples/client/petstore/rust/hyper/test-duplicates
library: hyper
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/test_duplicates.yaml
templateDir: modules/openapi-generator/src/main/resources/rust
additionalProperties:
supportAsync: "false"
packageName: test-duplicates-hyper
modelNameMappings:
Duplicatetest: another_test

View File

@@ -0,0 +1,12 @@
generatorName: rust
outputDir: samples/client/petstore/rust/reqwest/test-duplicates
library: reqwest
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/test_duplicates.yaml
templateDir: modules/openapi-generator/src/main/resources/rust
additionalProperties:
supportAsync: false
packageName: test-duplicates-reqwest
enumNameMappings:
delivered: shipped
modelNameMappings:
Duplicatetest: another_test

View File

@@ -0,0 +1,8 @@
generatorName: rust-server-deprecated
outputDir: samples/server/petstore/rust-server-deprecated/output/multipart-v3
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust-server/multipart-v3.yaml
templateDir: modules/openapi-generator/src/main/resources/rust-server-deprecated
generateAliasAsModel: true
additionalProperties:
hideGenerationTimestamp: "true"
packageName: multipart-v3

View File

@@ -0,0 +1,8 @@
generatorName: rust-server-deprecated
outputDir: samples/server/petstore/rust-server-deprecated/output/no-example-v3
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust-server/no-example-v3.yaml
templateDir: modules/openapi-generator/src/main/resources/rust-server-deprecated
generateAliasAsModel: true
additionalProperties:
hideGenerationTimestamp: "true"
packageName: no-example-v3

View File

@@ -0,0 +1,8 @@
generatorName: rust-server-deprecated
outputDir: samples/server/petstore/rust-server-deprecated/output/openapi-v3
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml
templateDir: modules/openapi-generator/src/main/resources/rust-server-deprecated
generateAliasAsModel: true
additionalProperties:
hideGenerationTimestamp: "true"
packageName: openapi-v3

View File

@@ -0,0 +1,8 @@
generatorName: rust-server-deprecated
outputDir: samples/server/petstore/rust-server-deprecated/output/ops-v3
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust-server/ops-v3.yaml
templateDir: modules/openapi-generator/src/main/resources/rust-server-deprecated
generateAliasAsModel: true
additionalProperties:
hideGenerationTimestamp: "true"
packageName: ops-v3

View File

@@ -0,0 +1,9 @@
generatorName: rust-server-deprecated
outputDir: samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing
inputSpec: modules/openapi-generator/src/test/resources/2_0/rust-server/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/rust-server-deprecated
generateAliasAsModel: true
additionalProperties:
hideGenerationTimestamp: "true"
packageName: petstore-with-fake-endpoints-models-for-testing
publishRustRegistry: crates-io

View File

@@ -0,0 +1,8 @@
generatorName: rust-server-deprecated
outputDir: samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust-server/ping-bearer-auth.yaml
templateDir: modules/openapi-generator/src/main/resources/rust-server-deprecated
generateAliasAsModel: true
additionalProperties:
hideGenerationTimestamp: "true"
packageName: ping-bearer-auth

View File

@@ -0,0 +1,8 @@
generatorName: rust-server-deprecated
outputDir: samples/server/petstore/rust-server-deprecated/output/rust-server-test
inputSpec: modules/openapi-generator/src/test/resources/2_0/rust-server/rust-server-test.yaml
templateDir: modules/openapi-generator/src/main/resources/rust-server-deprecated
generateAliasAsModel: true
additionalProperties:
hideGenerationTimestamp: "true"
packageName: rust-server-test

View File

@@ -1,6 +1,6 @@
generatorName: scala-http4s-server
outputDir: samples/server/petstore/scala-http4s-server
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/scala-http4s-server/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/scala-http4s-server
additionalProperties:
artifactId: openapi-scala-http4s-server
artifactId: openapi-scala-http4s-server

View File

@@ -0,0 +1,13 @@
generatorName: spring
outputDir: samples/openapi3/server/petstore/spring-boot-oneof-sealed
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
groupId: org.openapitools.openapi3
documentationProvider: springdoc
artifactId: springboot-oneof-sealed
snapshotVersion: "true"
hideGenerationTimestamp: "true"
generateBuilders: true
useOneOfInterfaces: true
useSealed: true

View File

@@ -1,6 +1,6 @@
generatorName: typescript
outputDir: samples/client/echo_api/typescript/build
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript
additionalProperties:
artifactId: echo-api-typescript

View File

@@ -401,6 +401,32 @@ or
--import-mappings Pet=my.models.MyPet --import-mappings Order=my.models.MyOrder
```
## Default Values
To customize the default values for containers, one can leverage the option `defaultToEmptyContainer` to customize what to initalize for array/set/map by respecting the default values in the spec
Set optional array and map default value to an empty container
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/output --additional-properties defaultToEmptyContainer="array?|map?"
```
Set nullable array (required) default value to an empty container
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/output --additional-properties defaultToEmptyContainer="?array"
```
Set nullable array (optional) default value to an empty container
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/output --additional-properties defaultToEmptyContainer="?array?"
```
To simply enable this option to respect default values in the specification (basically null if not specified):
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/output --additional-properties defaultToEmptyContainer=""
```
Note: not all generators support this generator's option (e.g. --additional-properties defaultToEmptyContainer="?array" in CLI) so please test to confirm. Java generators are the first to implement this feature. We welcome PRs to support this option in other generators. Related PR: https://github.com/OpenAPITools/openapi-generator/pull/21269
## Name Mapping
One can map the property name using `nameMappings` option and parameter name using `parameterNameMappings` option to something else. Consider the following schema:

View File

@@ -7,7 +7,7 @@ title: "FAQ: General"
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)
[![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-36ucx4ybl-jYrN6euoYn6zxXNZdldoZA)
## What is the governance structure of the OpenAPI Generator project?

View File

@@ -142,6 +142,7 @@ The following generators are available:
* [ruby-sinatra](generators/ruby-sinatra.md)
* [rust-axum (beta)](generators/rust-axum.md)
* [rust-server](generators/rust-server.md)
* [rust-server-deprecated](generators/rust-server-deprecated.md)
* [scala-akka-http-server (beta)](generators/scala-akka-http-server.md)
* [scala-cask](generators/scala-cask.md)
* [scala-finch](generators/scala-finch.md)

View File

@@ -44,7 +44,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|packageName|C# package name (convention: Title.Case).| |Org.OpenAPITools|
|packageTags|Tags to identify the package| |null|
|packageVersion|C# package version.| |1.0.0|
|releaseNote|Release note, default to 'Minor update'.| |Minor update|
|returnICollection|Return ICollection&lt;T&gt; 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>**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|

View File

@@ -58,6 +58,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|generateBuilders|Whether to generate builders for models| |false|
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
|generateGenericResponseEntity|Use a generic type for the `ResponseEntity` wrapping return values of generated API methods. If enabled, method are generated with return type ResponseEntity&lt;?&gt;| |false|
|generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hateoas|Use Spring HATEOAS library to allow adding HATEOAS links| |false|

View File

@@ -101,7 +101,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|useRuntimeException|Use RuntimeException instead of Exception. Only jersey2, jersey3, okhttp-gson, vertx, microprofile support this option.| |false|
|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
|useSingleRequestParameter|Setting this property to &quot;true&quot; will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to &quot;static&quot; does the same as &quot;true&quot;, but also makes the generated arguments class static with single parameter instantiation.| |false|
|useSingleRequestParameter|Setting this property to &quot;true&quot; will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to &quot;static&quot; does the same as &quot;true&quot;, but also makes the generated arguments class static with single parameter instantiation.| |false|
|webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false|
|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -101,7 +101,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|useRuntimeException|Use RuntimeException instead of Exception. Only jersey2, jersey3, okhttp-gson, vertx, microprofile support this option.| |false|
|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library. IMPORTANT: This option has been deprecated.| |false|
|useSingleRequestParameter|Setting this property to &quot;true&quot; will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to &quot;static&quot; does the same as &quot;true&quot;, but also makes the generated arguments class static with single parameter instantiation.| |false|
|useSingleRequestParameter|Setting this property to &quot;true&quot; will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter. ONLY native, jersey2, jersey3, okhttp-gson, microprofile, Spring RestClient, Spring WebClient support this option. Setting this property to &quot;static&quot; does the same as &quot;true&quot;, but also makes the generated arguments class static with single parameter instantiation.| |false|
|webclientBlockingOperations|Making all WebClient operations blocking(sync). Note that if on operation 'x-webclient-blocking: false' then such operation won't be sync| |false|
|withAWSV4Signature|whether to include AWS v4 signature support (only available for okhttp-gson library)| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -18,7 +18,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|actionAnnotations|String Annotations for Actions separated by a semicolon(;)| |@LogRequestResponse(bodySampling = 1.0, errorBodySampling = 1.0)|
|actionImports|String Imports for Actions separated by a semicolon(;)| |misk.web.actions.WebAction;misk.web.interceptors.LogRequestResponse|
|actionParentClass|Parent Class for Action| |WebAction|
|actionPathPrefix|Prefix for action path| ||
|actionRequestContentType|Request ContentType for Action| |@RequestContentType|
|actionRequestContentTypePrefix|Request ContentType Prefix for Action| |MediaTypes|
|addModelMoshiJsonAnnotation|Add a Moshi JSON adapter annotation to all model classes| |true|
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|apiSuffix|suffix for api classes| |Api|
@@ -35,6 +40,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|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|
|testingModule|Testing module class| |misk.testing.MiskTestModule|
|useBeanValidation|Use BeanValidation API annotations to validate data types| |true|
## IMPORT MAPPING

View File

@@ -38,7 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|srcBasePath|The directory to serve as source root.| |null|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |snake_case|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.|<dl><dt>**camelCase**</dt><dd>Use camelCase convention</dd><dt>**PascalCase**</dt><dd>Use PascalCase convention</dd><dt>**snake_case**</dt><dd>Use snake_case convention</dd><dt>**original**</dt><dd>Do not change the variable name</dd></dl>|snake_case|
## IMPORT MAPPING

View File

@@ -38,7 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|srcBasePath|The directory to serve as source root.| |null|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |camelCase|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.|<dl><dt>**camelCase**</dt><dd>Use camelCase convention</dd><dt>**PascalCase**</dt><dd>Use PascalCase convention</dd><dt>**snake_case**</dt><dd>Use snake_case convention</dd><dt>**original**</dt><dd>Do not change the variable name</dd></dl>|camelCase|
## IMPORT MAPPING

View File

@@ -38,7 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|srcBasePath|The directory to serve as source root.| |null|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |snake_case|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.|<dl><dt>**camelCase**</dt><dd>Use camelCase convention</dd><dt>**PascalCase**</dt><dd>Use PascalCase convention</dd><dt>**snake_case**</dt><dd>Use snake_case convention</dd><dt>**original**</dt><dd>Do not change the variable name</dd></dl>|snake_case|
## IMPORT MAPPING

View File

@@ -37,7 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|srcBasePath|The directory to serve as source root.| |null|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |snake_case|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.|<dl><dt>**camelCase**</dt><dd>Use camelCase convention</dd><dt>**PascalCase**</dt><dd>Use PascalCase convention</dd><dt>**snake_case**</dt><dd>Use snake_case convention</dd><dt>**original**</dt><dd>Do not change the variable name</dd></dl>|snake_case|
## IMPORT MAPPING

View File

@@ -38,7 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|srcBasePath|The directory to serve as source root.| |null|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |snake_case|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.|<dl><dt>**camelCase**</dt><dd>Use camelCase convention</dd><dt>**PascalCase**</dt><dd>Use PascalCase convention</dd><dt>**snake_case**</dt><dd>Use snake_case convention</dd><dt>**original**</dt><dd>Do not change the variable name</dd></dl>|snake_case|
## IMPORT MAPPING

View File

@@ -39,7 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|srcBasePath|The directory to serve as source root.| |null|
|supportStreaming|Support streaming endpoint| |false|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |snake_case|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.|<dl><dt>**camelCase**</dt><dd>Use camelCase convention</dd><dt>**PascalCase**</dt><dd>Use PascalCase convention</dd><dt>**snake_case**</dt><dd>Use snake_case convention</dd><dt>**original**</dt><dd>Do not change the variable name</dd></dl>|snake_case|
## IMPORT MAPPING

View File

@@ -38,7 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|srcBasePath|The directory to serve as source root.| |null|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |camelCase|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.|<dl><dt>**camelCase**</dt><dd>Use camelCase convention</dd><dt>**PascalCase**</dt><dd>Use PascalCase convention</dd><dt>**snake_case**</dt><dd>Use snake_case convention</dd><dt>**original**</dt><dd>Do not change the variable name</dd></dl>|camelCase|
## IMPORT MAPPING

View File

@@ -43,7 +43,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|srcBasePath|The directory to serve as source root.| |null|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |snake_case|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.|<dl><dt>**camelCase**</dt><dd>Use camelCase convention</dd><dt>**PascalCase**</dt><dd>Use PascalCase convention</dd><dt>**snake_case**</dt><dd>Use snake_case convention</dd><dt>**original**</dt><dd>Do not change the variable name</dd></dl>|snake_case|
## IMPORT MAPPING

View File

@@ -39,7 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|srcBasePath|The directory to serve as source root.| |null|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.| |snake_case|
|variableNamingConvention|naming convention of variable name, e.g. camelCase.|<dl><dt>**camelCase**</dt><dd>Use camelCase convention</dd><dt>**PascalCase**</dt><dd>Use PascalCase convention</dd><dt>**snake_case**</dt><dd>Use snake_case convention</dd><dt>**original**</dt><dd>Do not change the variable name</dd></dl>|snake_case|
## IMPORT MAPPING

View File

@@ -29,6 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|packageName|python package name (convention: snake_case).| |openapi_client|
|packageUrl|python package URL.| |null|
|packageVersion|python package version.| |1.0.0|
|poetry1|Fallback to formatting pyproject.toml to Poetry 1.x format.| |null|
|projectName|python project name in setup.py (e.g. petstore-api).| |null|
|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
|setEnsureAsciiToFalse|When set to true, add `ensure_ascii=False` in json.dumps when creating the HTTP request body.| |false|

View File

@@ -0,0 +1,232 @@
---
title: Documentation for the rust-server-deprecated Generator
---
## METADATA
| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | rust-server-deprecated | pass this to the generate command after -g |
| generator stability | STABLE | |
| generator type | SERVER | |
| generator language | Rust | |
| generator default templating engine | mustache | |
| helpTxt | Generates a Rust Hyper/Tower server library based on hyper 0.14. Also generates a matching Hyper client library within the same crate that implements the same trait. | |
## CONFIG OPTIONS
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|packageName|Rust crate name (convention: snake_case).| |openapi_client|
|packageVersion|Rust crate version.| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|Vec|
|map|std::collections::HashMap|
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>String</li>
<li>bool</li>
<li>char</li>
<li>f32</li>
<li>f64</li>
<li>i16</li>
<li>i32</li>
<li>i64</li>
<li>i8</li>
<li>isize</li>
<li>str</li>
<li>u16</li>
<li>u32</li>
<li>u64</li>
<li>u8</li>
<li>usize</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>Self</li>
<li>abstract</li>
<li>as</li>
<li>async</li>
<li>await</li>
<li>become</li>
<li>box</li>
<li>break</li>
<li>const</li>
<li>continue</li>
<li>crate</li>
<li>do</li>
<li>dyn</li>
<li>else</li>
<li>enum</li>
<li>extern</li>
<li>false</li>
<li>final</li>
<li>fn</li>
<li>for</li>
<li>if</li>
<li>impl</li>
<li>in</li>
<li>let</li>
<li>loop</li>
<li>macro</li>
<li>match</li>
<li>mod</li>
<li>move</li>
<li>mut</li>
<li>override</li>
<li>priv</li>
<li>pub</li>
<li>ref</li>
<li>return</li>
<li>self</li>
<li>static</li>
<li>struct</li>
<li>super</li>
<li>trait</li>
<li>true</li>
<li>try</li>
<li>type</li>
<li>typeof</li>
<li>unsafe</li>
<li>unsized</li>
<li>use</li>
<li>virtual</li>
<li>where</li>
<li>while</li>
<li>yield</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✓|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
|MockServer|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid|✗|
|Array|✓|OAS2,OAS3
|Null|✗|OAS3
|AnyType|✗|OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✓|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
|allOf|✗|OAS2,OAS3
|anyOf|✗|OAS3
|oneOf|✗|OAS3
|not|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✓|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
|SignatureAuth|✗|OAS3
|AWSV4Signature|✗|ToolingExtension
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✓|OAS2,OAS3

View File

@@ -51,6 +51,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|generateBuilders|Whether to generate builders for models| |false|
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
|generateGenericResponseEntity|Use a generic type for the `ResponseEntity` wrapping return values of generated API methods. If enabled, method are generated with return type ResponseEntity&lt;?&gt;| |false|
|generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hateoas|Use Spring HATEOAS library to allow adding HATEOAS links| |false|

View File

@@ -75,20 +75,42 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Array</li>
<li>Awaited</li>
<li>Blob</li>
<li>Boolean</li>
<li>Capitalize</li>
<li>ConstructorParameters</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>Exclude</li>
<li>Extract</li>
<li>File</li>
<li>Float</li>
<li>InstanceType</li>
<li>Integer</li>
<li>Long</li>
<li>Lowercase</li>
<li>Map</li>
<li>NoInfer</li>
<li>NonNullable</li>
<li>Object</li>
<li>Omit</li>
<li>OmitThisParameter</li>
<li>Parameters</li>
<li>Partial</li>
<li>Pick</li>
<li>Readonly</li>
<li>ReadonlyArray</li>
<li>Record</li>
<li>Required</li>
<li>ReturnType</li>
<li>Set</li>
<li>String</li>
<li>ThisParameterType</li>
<li>ThisType</li>
<li>Uncapitalize</li>
<li>Uppercase</li>
<li>any</li>
<li>boolean</li>
<li>number</li>

View File

@@ -55,19 +55,41 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Array</li>
<li>Awaited</li>
<li>Boolean</li>
<li>Capitalize</li>
<li>ConstructorParameters</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>Exclude</li>
<li>Extract</li>
<li>File</li>
<li>Float</li>
<li>InstanceType</li>
<li>Integer</li>
<li>Long</li>
<li>Lowercase</li>
<li>Map</li>
<li>NoInfer</li>
<li>NonNullable</li>
<li>Object</li>
<li>Omit</li>
<li>OmitThisParameter</li>
<li>Parameters</li>
<li>Partial</li>
<li>Pick</li>
<li>Readonly</li>
<li>ReadonlyArray</li>
<li>Record</li>
<li>Required</li>
<li>ReturnType</li>
<li>Set</li>
<li>String</li>
<li>ThisParameterType</li>
<li>ThisType</li>
<li>Uncapitalize</li>
<li>Uppercase</li>
<li>any</li>
<li>boolean</li>
<li>number</li>

View File

@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
|enumPropertyNamingReplaceSpecialChar|Set to true to replace '-' and '+' symbols with 'minus_' and 'plus_' in enum of type string| |false|
|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|<dl><dt>**false**</dt><dd>No changes to the enum's are made, this is the default option.</dd><dt>**true**</dt><dd>With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.</dd></dl>|false|
|importFileExtension|File extension to use with relative imports. Set it to '.js' or '.mjs' when using [ESM](https://nodejs.org/api/esm.html).| ||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|licenseName|The name of the license| |Unlicense|
|modelPackage|package for generated models| |null|
@@ -65,19 +66,41 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Array</li>
<li>Awaited</li>
<li>Boolean</li>
<li>Capitalize</li>
<li>ConstructorParameters</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>Exclude</li>
<li>Extract</li>
<li>File</li>
<li>Float</li>
<li>InstanceType</li>
<li>Integer</li>
<li>Long</li>
<li>Lowercase</li>
<li>Map</li>
<li>NoInfer</li>
<li>NonNullable</li>
<li>Object</li>
<li>Omit</li>
<li>OmitThisParameter</li>
<li>Parameters</li>
<li>Partial</li>
<li>Pick</li>
<li>Readonly</li>
<li>ReadonlyArray</li>
<li>Record</li>
<li>Required</li>
<li>ReturnType</li>
<li>Set</li>
<li>String</li>
<li>ThisParameterType</li>
<li>ThisType</li>
<li>Uncapitalize</li>
<li>Uppercase</li>
<li>any</li>
<li>boolean</li>
<li>number</li>

View File

@@ -66,19 +66,41 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Array</li>
<li>Awaited</li>
<li>Boolean</li>
<li>Capitalize</li>
<li>ConstructorParameters</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>Exclude</li>
<li>Extract</li>
<li>File</li>
<li>Float</li>
<li>InstanceType</li>
<li>Integer</li>
<li>Long</li>
<li>Lowercase</li>
<li>Map</li>
<li>NoInfer</li>
<li>NonNullable</li>
<li>Object</li>
<li>Omit</li>
<li>OmitThisParameter</li>
<li>Parameters</li>
<li>Partial</li>
<li>Pick</li>
<li>Readonly</li>
<li>ReadonlyArray</li>
<li>Record</li>
<li>Required</li>
<li>ReturnType</li>
<li>Set</li>
<li>String</li>
<li>ThisParameterType</li>
<li>ThisType</li>
<li>Uncapitalize</li>
<li>Uppercase</li>
<li>any</li>
<li>boolean</li>
<li>number</li>

View File

@@ -60,20 +60,42 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Array</li>
<li>Awaited</li>
<li>Blob</li>
<li>Boolean</li>
<li>Capitalize</li>
<li>ConstructorParameters</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>Exclude</li>
<li>Extract</li>
<li>File</li>
<li>Float</li>
<li>InstanceType</li>
<li>Integer</li>
<li>Long</li>
<li>Lowercase</li>
<li>Map</li>
<li>NoInfer</li>
<li>NonNullable</li>
<li>Object</li>
<li>Omit</li>
<li>OmitThisParameter</li>
<li>Parameters</li>
<li>Partial</li>
<li>Pick</li>
<li>Readonly</li>
<li>ReadonlyArray</li>
<li>Record</li>
<li>Required</li>
<li>ReturnType</li>
<li>Set</li>
<li>String</li>
<li>ThisParameterType</li>
<li>ThisType</li>
<li>Uncapitalize</li>
<li>Uppercase</li>
<li>any</li>
<li>boolean</li>
<li>number</li>

View File

@@ -57,19 +57,41 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Array</li>
<li>Awaited</li>
<li>Boolean</li>
<li>Capitalize</li>
<li>ConstructorParameters</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>Exclude</li>
<li>Extract</li>
<li>File</li>
<li>Float</li>
<li>InstanceType</li>
<li>Integer</li>
<li>Long</li>
<li>Lowercase</li>
<li>Map</li>
<li>NoInfer</li>
<li>NonNullable</li>
<li>Object</li>
<li>Omit</li>
<li>OmitThisParameter</li>
<li>Parameters</li>
<li>Partial</li>
<li>Pick</li>
<li>Readonly</li>
<li>ReadonlyArray</li>
<li>Record</li>
<li>Required</li>
<li>ReturnType</li>
<li>Set</li>
<li>String</li>
<li>ThisParameterType</li>
<li>ThisType</li>
<li>Uncapitalize</li>
<li>Uppercase</li>
<li>any</li>
<li>boolean</li>
<li>number</li>

View File

@@ -66,20 +66,42 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Array</li>
<li>Awaited</li>
<li>Blob</li>
<li>Boolean</li>
<li>Capitalize</li>
<li>ConstructorParameters</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>Exclude</li>
<li>Extract</li>
<li>File</li>
<li>Float</li>
<li>InstanceType</li>
<li>Integer</li>
<li>Long</li>
<li>Lowercase</li>
<li>Map</li>
<li>NoInfer</li>
<li>NonNullable</li>
<li>Object</li>
<li>Omit</li>
<li>OmitThisParameter</li>
<li>Parameters</li>
<li>Partial</li>
<li>Pick</li>
<li>Readonly</li>
<li>ReadonlyArray</li>
<li>Record</li>
<li>Required</li>
<li>ReturnType</li>
<li>Set</li>
<li>String</li>
<li>ThisParameterType</li>
<li>ThisType</li>
<li>Uncapitalize</li>
<li>Uppercase</li>
<li>any</li>
<li>boolean</li>
<li>number</li>

View File

@@ -56,23 +56,45 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Array</li>
<li>Awaited</li>
<li>Boolean</li>
<li>Buffer</li>
<li>Capitalize</li>
<li>ConstructorParameters</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>Exclude</li>
<li>Extract</li>
<li>File</li>
<li>Float</li>
<li>InstanceType</li>
<li>Integer</li>
<li>Long</li>
<li>Lowercase</li>
<li>Map</li>
<li>NoInfer</li>
<li>NonNullable</li>
<li>Object</li>
<li>Omit</li>
<li>OmitThisParameter</li>
<li>Parameters</li>
<li>Partial</li>
<li>Pick</li>
<li>ReadStream</li>
<li>Readonly</li>
<li>ReadonlyArray</li>
<li>Record</li>
<li>RequestDetailedFile</li>
<li>RequestFile</li>
<li>Required</li>
<li>ReturnType</li>
<li>Set</li>
<li>String</li>
<li>ThisParameterType</li>
<li>ThisType</li>
<li>Uncapitalize</li>
<li>Uppercase</li>
<li>any</li>
<li>boolean</li>
<li>number</li>

View File

@@ -58,19 +58,41 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Array</li>
<li>Awaited</li>
<li>Boolean</li>
<li>Capitalize</li>
<li>ConstructorParameters</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>Exclude</li>
<li>Extract</li>
<li>File</li>
<li>Float</li>
<li>InstanceType</li>
<li>Integer</li>
<li>Long</li>
<li>Lowercase</li>
<li>Map</li>
<li>NoInfer</li>
<li>NonNullable</li>
<li>Object</li>
<li>Omit</li>
<li>OmitThisParameter</li>
<li>Parameters</li>
<li>Partial</li>
<li>Pick</li>
<li>Readonly</li>
<li>ReadonlyArray</li>
<li>Record</li>
<li>Required</li>
<li>ReturnType</li>
<li>Set</li>
<li>String</li>
<li>ThisParameterType</li>
<li>ThisType</li>
<li>Uncapitalize</li>
<li>Uppercase</li>
<li>any</li>
<li>boolean</li>
<li>number</li>

View File

@@ -57,20 +57,42 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Array</li>
<li>Awaited</li>
<li>Blob</li>
<li>Boolean</li>
<li>Capitalize</li>
<li>ConstructorParameters</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>Exclude</li>
<li>Extract</li>
<li>File</li>
<li>Float</li>
<li>InstanceType</li>
<li>Integer</li>
<li>Long</li>
<li>Lowercase</li>
<li>Map</li>
<li>NoInfer</li>
<li>NonNullable</li>
<li>Object</li>
<li>Omit</li>
<li>OmitThisParameter</li>
<li>Parameters</li>
<li>Partial</li>
<li>Pick</li>
<li>Readonly</li>
<li>ReadonlyArray</li>
<li>Record</li>
<li>Required</li>
<li>ReturnType</li>
<li>Set</li>
<li>String</li>
<li>ThisParameterType</li>
<li>ThisType</li>
<li>Uncapitalize</li>
<li>Uppercase</li>
<li>any</li>
<li>boolean</li>
<li>number</li>

View File

@@ -63,19 +63,41 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul">
<li>Array</li>
<li>Awaited</li>
<li>Boolean</li>
<li>Capitalize</li>
<li>ConstructorParameters</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>Exclude</li>
<li>Extract</li>
<li>File</li>
<li>Float</li>
<li>InstanceType</li>
<li>Integer</li>
<li>Long</li>
<li>Lowercase</li>
<li>Map</li>
<li>NoInfer</li>
<li>NonNullable</li>
<li>Object</li>
<li>Omit</li>
<li>OmitThisParameter</li>
<li>Parameters</li>
<li>Partial</li>
<li>Pick</li>
<li>Readonly</li>
<li>ReadonlyArray</li>
<li>Record</li>
<li>Required</li>
<li>ReturnType</li>
<li>Set</li>
<li>String</li>
<li>ThisParameterType</li>
<li>ThisType</li>
<li>Uncapitalize</li>
<li>Uppercase</li>
<li>any</li>
<li>boolean</li>
<li>number</li>

View File

@@ -22,7 +22,7 @@ npm install @openapitools/openapi-generator-cli -g
To install a specific version of the tool, pass the version during installation:
<!-- RELEASE_VERSION -->
```bash
openapi-generator-cli version-manager set 7.12.0
openapi-generator-cli version-manager set 7.14.0
```
<!-- /RELEASE_VERSION -->
To install the tool as a dev dependency in your current project:
@@ -119,18 +119,18 @@ docker run --rm \
<!-- RELEASE_VERSION -->
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 11 runtime at a minimum):
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.12.0/openapi-generator-cli-7.12.0.jar`
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.14.0/openapi-generator-cli-7.14.0.jar`
For **Mac/Linux** users:
```bash
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.12.0/openapi-generator-cli-7.12.0.jar -O openapi-generator-cli.jar
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.14.0/openapi-generator-cli-7.14.0.jar -O openapi-generator-cli.jar
```
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
```powershell
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.12.0/openapi-generator-cli-7.12.0.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.14.0/openapi-generator-cli-7.14.0.jar
```
<!-- /RELEASE_VERSION -->

View File

@@ -16,7 +16,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.12.0</version>
<version>7.14.0</version>
<executions>
<execution>
<goals>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -162,7 +162,7 @@ public class Generate extends OpenApiGeneratorCommand {
@Option(
name = {"--openapi-generator-ignore-list"},
title = ".openapi-generaotr-ignore list",
title = ".openapi-generator-ignore list",
description = "specifies entries in the .openapi-generator-ignore file relative/path/to/file1,relative/path/to/file2. For example: README.md,pom.xml"
+ " You can also have multiple occurrences of this option.")
private List<String> openapiGeneratorIgnoreList = new ArrayList<>();

View File

@@ -6,7 +6,7 @@
<artifactId>openapi-generator-project</artifactId>
<groupId>org.openapitools</groupId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -97,7 +97,7 @@ task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valid
[source,group]
----
plugins {
id "org.openapi.generator" version "7.12.0"
id "org.openapi.generator" version "7.14.0"
}
----
@@ -113,7 +113,7 @@ buildscript {
// url "https://plugins.gradle.org/m2/"
}
dependencies {
classpath "org.openapitools:openapi-generator-gradle-plugin:7.10.0"
classpath "org.openapitools:openapi-generator-gradle-plugin:7.14.0"
}
}
@@ -759,7 +759,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath('org.openapitools:openapi-generator-gradle-plugin:7.10.0') {
classpath('org.openapitools:openapi-generator-gradle-plugin:7.14.0') {
exclude group: 'com.google.guava'
}
}

View File

@@ -1,5 +1,5 @@
# RELEASE_VERSION
openApiGeneratorVersion=7.14.0-SNAPSHOT
openApiGeneratorVersion=7.15.0-SNAPSHOT
# /RELEASE_VERSION
# BEGIN placeholders

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -19,5 +19,5 @@ gradle generateGoWithInvalidSpec # expected outcome: BUILD FAILED
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
```bash
gradle -PopenApiGeneratorVersion=7.12.0 openApiValidate
gradle -PopenApiGeneratorVersion=7.14.0 openApiValidate
```

View File

@@ -1,3 +1,3 @@
# RELEASE_VERSION
openApiGeneratorVersion=7.14.0-SNAPSHOT
openApiGeneratorVersion=7.15.0-SNAPSHOT
# /RELEASE_VERSION

View File

@@ -117,6 +117,7 @@ class OpenApiGeneratorPlugin : Plugin<Project> {
additionalProperties.set(generate.additionalProperties)
serverVariables.set(generate.serverVariables)
languageSpecificPrimitives.set(generate.languageSpecificPrimitives)
openapiGeneratorIgnoreList.set(generate.openapiGeneratorIgnoreList)
importMappings.set(generate.importMappings)
schemaMappings.set(generate.schemaMappings)
inlineSchemaNameMappings.set(generate.inlineSchemaNameMappings)

View File

@@ -570,4 +570,55 @@ class GenerateTaskDslTest : TestBase() {
"Dry run results message is missing."
)
}
@Test
fun `openapiGenerate should set openapiGeneratorIgnoreList option`() {
// Arrange
val projectFiles = mapOf(
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml")
)
withProject(
"""
plugins {
id 'org.openapi.generator'
}
openApiGenerate {
generatorName = "kotlin"
inputSpec = file("spec.yaml").absolutePath
outputDir = file("build/kotlin").absolutePath
apiPackage = "org.openapitools.example.api"
invokerPackage = "org.openapitools.example.invoker"
modelPackage = "org.openapitools.example.model"
configOptions = [
dateLibrary: "java8"
]
openapiGeneratorIgnoreList = ["README.md"]
}
""".trimIndent(),
projectFiles
)
// Act
val result = GradleRunner.create()
.withProjectDir(temp)
.withArguments("openApiGenerate")
.withPluginClasspath()
.build()
// Assert
assertTrue(
result.output.contains("Successfully generated code to"),
"User friendly generate notice is missing."
)
assertTrue(
"README.md" !in File(temp, "build/kotlin/").list(),
"README.md should not be generated when it is in the openapiGeneratorIgnoreList."
)
assertEquals(
TaskOutcome.SUCCESS, result.task(":openApiGenerate")?.outcome,
"Expected a successful run, but found ${result.task(":openApiGenerate")?.outcome}"
)
}
}

View File

@@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.12.0</version>
<version>7.14.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -15,7 +15,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -19,7 +19,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<dependencies>
<dependency>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -20,7 +20,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -5,7 +5,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -563,12 +563,18 @@ public class CodeGenMojo extends AbstractMojo {
}
if (StringUtils.isNotBlank(inputSpecRootDirectory)) {
// make sure the path can be processed correct under Windows OS
inputSpecRootDirectory = inputSpecRootDirectory.replaceAll("\\\\", "/");
inputSpec = new MergedSpecBuilder(inputSpecRootDirectory, mergedFileName,
mergedFileInfoName, mergedFileInfoDescription, mergedFileInfoVersion)
.buildMergedSpec();
LOGGER.info("Merge input spec would be used - {}", inputSpec);
}
// make sure the path can be processed correct under Windows OS
inputSpec = inputSpec.replaceAll("\\\\", "/");
File inputSpecFile = new File(inputSpec);
if (output == null) {

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>7.14.0-SNAPSHOT</version>
<version>7.15.0-SNAPSHOT</version>
<!-- /RELEASE_VERSION -->
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@@ -54,6 +54,7 @@ import org.openapitools.codegen.examples.ExampleGenerator;
import org.openapitools.codegen.languages.PhpNextgenClientCodegen;
import org.openapitools.codegen.languages.RustAxumServerCodegen;
import org.openapitools.codegen.languages.RustServerCodegen;
import org.openapitools.codegen.languages.RustServerCodegenDeprecated;
import org.openapitools.codegen.meta.FeatureSet;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
@@ -334,6 +335,12 @@ public class DefaultCodegen implements CodegenConfig {
// Whether to automatically hardcode params that are considered Constants by OpenAPI Spec
@Setter protected boolean autosetConstants = false;
@Setter @Getter boolean arrayDefaultToEmpty, arrayNullableDefaultToEmpty, arrayOptionalNullableDefaultToEmpty, arrayOptionalDefaultToEmpty;
@Setter @Getter boolean mapDefaultToEmpty, mapNullableDefaultToEmpty, mapOptionalNullableDefaultToEmpty, mapOptionalDefaultToEmpty;
@Setter @Getter protected boolean defaultToEmptyContainer;
final String DEFAULT_TO_EMPTY_CONTAINER = "defaultToEmptyContainer";
final List EMPTY_LIST = new ArrayList();
@Override
public boolean getAddSuffixToDuplicateOperationNicknames() {
return addSuffixToDuplicateOperationNicknames;
@@ -392,8 +399,12 @@ public class DefaultCodegen implements CodegenConfig {
convertPropertyToBooleanAndWriteBack(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, this::setDisallowAdditionalPropertiesIfNotPresent);
convertPropertyToBooleanAndWriteBack(CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, this::setEnumUnknownDefaultCase);
convertPropertyToBooleanAndWriteBack(CodegenConstants.AUTOSET_CONSTANTS, this::setAutosetConstants);
}
if (additionalProperties.containsKey(DEFAULT_TO_EMPTY_CONTAINER) && additionalProperties.get(DEFAULT_TO_EMPTY_CONTAINER) instanceof String) {
parseDefaultToEmptyContainer((String) additionalProperties.get(DEFAULT_TO_EMPTY_CONTAINER));
defaultToEmptyContainer = true;
}
}
/***
* Preset map builder with commonly used Mustache lambdas.
@@ -3671,7 +3682,8 @@ public class DefaultCodegen implements CodegenConfig {
if (ModelUtils.isComposedSchema(schema) && !this.getLegacyDiscriminatorBehavior()) {
List<MappedModel> otherDescendants = getOneOfAnyOfDescendants(schemaName, discriminatorPropertyName, schema);
for (MappedModel otherDescendant : otherDescendants) {
if (!uniqueDescendants.contains(otherDescendant)) {
// add only if the model names are not the same
if (uniqueDescendants.stream().map(MappedModel::getModelName).noneMatch(it -> it.equals(otherDescendant.getModelName()))) {
uniqueDescendants.add(otherDescendant);
}
}
@@ -4226,6 +4238,11 @@ public class DefaultCodegen implements CodegenConfig {
}
}
// override defaultValue if it's not set and defaultToEmptyContainer is set
if (p.getDefault() == null && defaultToEmptyContainer) {
updateDefaultToEmptyContainer(property, p);
}
// set the default value
property.defaultValue = toDefaultValue(property, p);
property.defaultValueWithParam = toDefaultValueWithParam(name, p);
@@ -4235,6 +4252,99 @@ public class DefaultCodegen implements CodegenConfig {
return property;
}
/**
* update container's default to empty container according rules provided by the user.
*
* @param cp codegen property
* @param p schema
*/
void updateDefaultToEmptyContainer(CodegenProperty cp, Schema p) {
if (cp.isArray) {
if (!cp.required) { // optional
if (cp.isNullable && arrayOptionalNullableDefaultToEmpty) { // nullable
p.setDefault(EMPTY_LIST);
} else if (!cp.isNullable && arrayOptionalDefaultToEmpty) { // non-nullable
p.setDefault(EMPTY_LIST);
}
} else { // required
if (cp.isNullable && arrayNullableDefaultToEmpty) { // nullable
p.setDefault(EMPTY_LIST);
} else if (!cp.isNullable && arrayDefaultToEmpty) { // non-nullable
p.setDefault(EMPTY_LIST);
}
}
} else if (cp.isMap) {
if (!cp.required) { // optional
if (cp.isNullable && mapOptionalNullableDefaultToEmpty) { // nullable
p.setDefault(EMPTY_LIST);
} else if (!cp.isNullable && mapOptionalDefaultToEmpty) { // non-nullable
p.setDefault(EMPTY_LIST);
}
} else { // required
if (cp.isNullable && mapNullableDefaultToEmpty) { // nullable
p.setDefault(EMPTY_LIST);
} else if (!cp.isNullable && mapOptionalDefaultToEmpty) { // non-nullable
p.setDefault(EMPTY_LIST);
}
}
}
}
/**
* Parse the rules for defaulting to the empty container.
*
* @param input a set of rules separated by `|`
*/
void parseDefaultToEmptyContainer(String input) {
String[] inputs = ((String) input).split("[|]");
String containerType;
for (String rule: inputs) {
if (StringUtils.isEmpty(rule)) {
LOGGER.error("updateDefaultToEmptyContainer: Skipped empty input in `{}`.", input);
continue;
}
if (rule.startsWith("?") && rule.endsWith("?")) { // nullable optional
containerType = rule.substring(1, rule.length() - 1);
if ("array".equalsIgnoreCase(containerType)) {
arrayOptionalNullableDefaultToEmpty = true;
} else if ("map".equalsIgnoreCase(containerType)) {
mapOptionalNullableDefaultToEmpty = true;
} else {
LOGGER.error("Skipped invalid container type `{}` in `{}`.", containerType, input);
}
} else if (rule.startsWith("?")) { // nullable (required)
containerType = rule.substring(1, rule.length());
if ("array".equalsIgnoreCase(containerType)) {
arrayNullableDefaultToEmpty = true;
} else if ("map".equalsIgnoreCase(containerType)) {
mapNullableDefaultToEmpty = true;
} else {
LOGGER.error("Skipped invalid container type `{}` in `{}`.", containerType, input);
}
} else if (rule.endsWith("?")) { // optional
containerType = rule.substring(0, rule.length()-1);
if ("array".equalsIgnoreCase(containerType)) {
arrayOptionalDefaultToEmpty = true;
} else if ("map".equalsIgnoreCase(containerType)) {
mapOptionalDefaultToEmpty = true;
} else {
LOGGER.error("Skipped invalid container type `{}` in the rule `{}`.", containerType, input);
}
} else { // required
containerType = rule;
if ("array".equalsIgnoreCase(containerType)) {
arrayDefaultToEmpty = true;
} else if ("map".equalsIgnoreCase(containerType)) {
mapDefaultToEmpty = true;
} else {
LOGGER.error("Skipped invalid container type `{}` in the rule `{}`.", containerType, input);
}
}
}
}
/**
* Update property for array(list) container
*
@@ -5220,7 +5330,7 @@ public class DefaultCodegen implements CodegenConfig {
parameterSchema = unaliasSchema(parameter.getSchema());
parameterModelName = getParameterDataType(parameter, parameterSchema);
CodegenProperty prop;
if (this instanceof RustServerCodegen) {
if (this instanceof RustServerCodegen || this instanceof RustServerCodegenDeprecated) {
// for rust server, we need to do something special as it uses
// $ref (e.g. #components/schemas/Pet) to determine whether it's a model
prop = fromProperty(parameter.getName(), parameterSchema, false);

View File

@@ -418,18 +418,7 @@ public class InlineModelResolver {
if (schema.getAllOf().size() == 1) {
// handle earlier in this function when looping through properties
} else if (schema.getAllOf().size() > 1) {
// Check if there is only one "non metadata" schema.
// For example, there may be an `description` only schema that is used to override the descrption.
// In these cases, we can simply discard those schemas.
List<Schema> nonMetadataOnlySchemas = (List<Schema>) schema.getAllOf().stream()
.filter(v -> ModelUtils.isMetadataOnlySchema((Schema) v))
.collect(Collectors.toList());
if (nonMetadataOnlySchemas.size() == 1) {
schema.setAllOf(nonMetadataOnlySchemas);
} else {
LOGGER.warn("allOf schema `{}` containing multiple types (not model) is not supported at the moment.", schema.getName());
}
LOGGER.warn("allOf schema `{}` containing multiple types (not model) is not supported at the moment.", schema.getName());
} else {
LOGGER.error("allOf schema `{}` contains no items.", schema.getName());
}

View File

@@ -851,6 +851,52 @@ public class OpenAPINormalizer {
}
}
protected void refactorAllOfWithMetadataOnlySchemas(Schema schema) {
if (schema.getAllOf() == null) {
return;
}
// Check if there are metadata schemas.
// For example, there may be an `description` only schema that is used to override the descrption.
List<Schema> nonMetadataOnlySchemas = new ArrayList<>();
List<Schema> metadataOnlySchemas = new ArrayList<>();
for (Object s: schema.getAllOf()) {
if (s instanceof Schema) {
if (ModelUtils.isMetadataOnlySchema((Schema) s)) {
metadataOnlySchemas.add((Schema) s);
} else {
nonMetadataOnlySchemas.add((Schema) s);
}
}
}
// ReferenceNumber:
// allOf:
// - $ref: '#/components/schemas/IEAN8'
// - description: Product Ref
// - example: IEAN1234
//
// becomes the following after the following code block
//
// ReferenceNumber:
// allOf:
// - $ref: '#/components/schemas/IEAN8'
// description: Product Ref
// example: IEAN1234
//
// which can be further processed by the generator
if (nonMetadataOnlySchemas.size() > 0) {
// keep the non metadata schema(s)
schema.setAllOf(nonMetadataOnlySchemas);
// copy metadata to the allOf schema
for (Schema metadataOnlySchema: metadataOnlySchemas) {
ModelUtils.copyMetadata(metadataOnlySchema, schema);
}
}
}
/*
* Remove unsupported schemas (e.g. if, then) from allOf.
*
@@ -882,6 +928,8 @@ public class OpenAPINormalizer {
protected Schema normalizeAllOf(Schema schema, Set<Schema> visitedSchemas) {
removeUnsupportedSchemasFromAllOf(schema);
refactorAllOfWithMetadataOnlySchemas(schema);
if (schema.getAllOf() == null) {
return schema;
}

View File

@@ -18,7 +18,9 @@
package org.openapitools.codegen.languages;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.base.Strings;
import com.google.common.collect.Sets;
import com.samskivert.mustache.Mustache;
@@ -1240,7 +1242,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
if (schema.getDefault() instanceof ArrayNode) { // array of default values
ArrayNode _default = (ArrayNode) schema.getDefault();
if (_default.isEmpty()) { // e.g. default: []
return getDefaultCollectionType(schema);
return getDefaultCollectionType(schema, "");
}
List<String> final_values = _values;
@@ -1253,6 +1255,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
_default.forEach((element) -> {
final_values.add(String.valueOf(element));
});
if (_default != null && _default.isEmpty() && defaultToEmptyContainer) {
// e.g. [] with the option defaultToEmptyContainer enabled
return getDefaultCollectionType(schema, "");
}
} else { // single value
_values = java.util.Collections.singletonList(String.valueOf(schema.getDefault()));
}
@@ -1306,7 +1313,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
public String toDefaultValue(CodegenProperty cp, Schema schema) {
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
if (ModelUtils.isArraySchema(schema)) {
if (schema.getDefault() == null) {
if (defaultToEmptyContainer) {
// if default to empty container option is set, respect the default values provided in the spec
return toArrayDefaultValue(cp, schema);
} else if (schema.getDefault() == null) {
// nullable or containerDefaultToNull set to true
if (cp.isNullable || containerDefaultToNull) {
return null;
@@ -1323,6 +1333,16 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return null;
}
if (defaultToEmptyContainer) {
// respect the default values provided in the spec when the option is enabled
if (schema.getDefault() != null) {
return String.format(Locale.ROOT, "new %s<>()",
instantiationTypes().getOrDefault("map", "HashMap"));
} else {
return null;
}
}
// nullable or containerDefaultToNull set to true
if (cp.isNullable || containerDefaultToNull) {
return null;
@@ -1399,7 +1419,74 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return null;
} else if (ModelUtils.isObjectSchema(schema)) {
if (schema.getDefault() != null) {
return super.toDefaultValue(schema);
try {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("new " + cp.datatypeWithEnum + "()");
Map<String, Schema> propertySchemas = schema.getProperties();
if(propertySchemas != null) {
// With `parseOptions.setResolve(true)`, objects with 1 key-value pair are LinkedHashMap and objects with more than 1 are ObjectNode
// When not set, objects of any size are ObjectNode
ObjectMapper objectMapper = new ObjectMapper();
ObjectNode objectNode;
if(!(schema.getDefault() instanceof ObjectNode)) {
objectNode = objectMapper.valueToTree(schema.getDefault());
} else {
objectNode = (ObjectNode) schema.getDefault();
}
Set<Map.Entry<String, JsonNode>> defaultProperties = objectNode.properties();
for (Map.Entry<String, JsonNode> defaultProperty : defaultProperties) {
String key = defaultProperty.getKey();
JsonNode value = defaultProperty.getValue();
Schema propertySchema = propertySchemas.get(key);
if (!value.isValueNode() || propertySchema == null) { //Skip complex objects for now
continue;
}
String defaultPropertyExpression = null;
if(ModelUtils.isLongSchema(propertySchema)) {
defaultPropertyExpression = value.asText()+"l";
} else if(ModelUtils.isIntegerSchema(propertySchema)) {
defaultPropertyExpression = value.asText();
} else if(ModelUtils.isDoubleSchema(propertySchema)) {
defaultPropertyExpression = value.asText()+"d";
} else if(ModelUtils.isFloatSchema(propertySchema)) {
defaultPropertyExpression = value.asText()+"f";
} else if(ModelUtils.isNumberSchema(propertySchema)) {
defaultPropertyExpression = "new java.math.BigDecimal(\"" + value.asText() + "\")";
} else if(ModelUtils.isURISchema(propertySchema)) {
defaultPropertyExpression = "java.net.URI.create(\"" + escapeText(value.asText()) + "\")";
} else if(ModelUtils.isDateSchema(propertySchema)) {
if("java8".equals(getDateLibrary())) {
defaultPropertyExpression = String.format(Locale.ROOT, "java.time.LocalDate.parse(\"%s\")", value.asText());
}
} else if(ModelUtils.isDateTimeSchema(propertySchema)) {
if("java8".equals(getDateLibrary())) {
defaultPropertyExpression = String.format(Locale.ROOT, "java.time.OffsetDateTime.parse(\"%s\", %s)",
value.asText(),
"java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME.withZone(java.time.ZoneId.systemDefault())");
}
} else if(ModelUtils.isUUIDSchema(propertySchema)) {
defaultPropertyExpression = "java.util.UUID.fromString(\"" + value.asText() + "\")";
} else if(ModelUtils.isStringSchema(propertySchema)) {
defaultPropertyExpression = "\"" + value.asText() + "\"";
} else if(ModelUtils.isBooleanSchema(propertySchema)) {
defaultPropertyExpression = value.asText();
}
if(defaultPropertyExpression != null) {
stringBuilder
// .append(System.lineSeparator())
.append(".")
.append(toVarName(key))
.append("(").append(defaultPropertyExpression).append(")");
}
}
}
return stringBuilder.toString();
} catch (ClassCastException e) {
LOGGER.error("Can't resolve default value: "+schema.getDefault(), e);
return null;
}
}
return null;
} else if (ModelUtils.isComposedSchema(schema)) {
@@ -1418,12 +1505,31 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
private String getDefaultCollectionType(Schema schema, String defaultValues) {
String arrayFormat = "new %s<>(Arrays.asList(%s))";
if (defaultToEmptyContainer) {
// respect the default value in the spec
if (defaultValues == null) { // default value not provided
return null;
} else if (defaultValues.isEmpty()) { // e.g. [] to indicates empty container
arrayFormat = "new %s<>()";
return getDefaultCollectionType(arrayFormat, defaultValues, ModelUtils.isSet(schema));
} else { // default value not empty
return getDefaultCollectionType(arrayFormat, defaultValues, ModelUtils.isSet(schema));
}
}
if (defaultValues == null || defaultValues.isEmpty()) {
// default to empty container even though default value is null
// to respect default values provided in the spec, set the option `defaultToEmptyContainer` properly
defaultValues = "";
arrayFormat = "new %s<>()";
}
if (ModelUtils.isSet(schema)) {
return getDefaultCollectionType(arrayFormat, defaultValues, ModelUtils.isSet(schema));
}
private String getDefaultCollectionType(String arrayFormat, String defaultValues, boolean isSet) {
if (isSet) {
return String.format(Locale.ROOT, arrayFormat,
instantiationTypes().getOrDefault("set", "LinkedHashSet"), defaultValues);
}

View File

@@ -572,7 +572,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
if (value.isEmpty()) {
modified = "EMPTY";
} else {
modified = value;
modified = value.replaceAll("-", "_");
modified = sanitizeKotlinSpecificNames(modified);
}

View File

@@ -149,6 +149,10 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
cliOptions.add(new CliOption(VARIABLE_NAMING_CONVENTION, "naming convention of variable name, e.g. camelCase.")
.addEnum("camelCase", "Use camelCase convention")
.addEnum("PascalCase", "Use PascalCase convention")
.addEnum("snake_case", "Use snake_case convention")
.addEnum("original", "Do not change the variable name")
.defaultValue("snake_case"));
cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, "The main namespace to use for all classes. e.g. Yay\\Pets"));
cliOptions.add(new CliOption(PACKAGE_NAME, "The main package name for classes. e.g. GeneratedPetstore"));
@@ -451,6 +455,8 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
name = camelize(name, LOWERCASE_FIRST_LETTER);
} else if ("PascalCase".equals(variableNamingConvention)) {
name = camelize(name, UPPERCASE_FIRST_CHAR);
} else if ("original".equals(variableNamingConvention)) {
// return the name as it is
} else { // default to snake case
// return the name in underscore style
// PhoneNumber => phone_number

View File

@@ -1061,6 +1061,8 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
}
public String toEnumVariableName(String name, String datatype) {
name = name.replace(".", "_DOT_");
if ("int".equals(datatype)) {
return "NUMBER_" + name.replace("-", "MINUS_");
}

View File

@@ -1593,6 +1593,8 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
}
public String toEnumVariableName(String name, String datatype) {
name = name.replace(".", "_DOT_");
if ("int".equals(datatype)) {
return "NUMBER_" + name.replace("-", "MINUS_");
}

View File

@@ -183,8 +183,8 @@ public abstract class AbstractRustCodegen extends DefaultCodegen implements Code
throw new IllegalArgumentException("Unknown CasingType");
}
// Replace hyphens with underscores
name = name.replaceAll("-", "_");
// Replace hyphens and periods with underscores
name = name.replaceAll("[\\.\\-]", "_");
// Apply special character escapes, e.g. "@type" => "At_type"
// Remove the trailing underscore if necessary
@@ -346,6 +346,10 @@ public abstract class AbstractRustCodegen extends DefaultCodegen implements Code
@Override
public String toModelName(String name) {
if (modelNameMapping.containsKey(name)) {
return modelNameMapping.get(name);
}
return sanitizeIdentifier(addModelNamePrefixAndSuffix(name), CasingType.CAMEL_CASE, "model", "model", false);
}

View File

@@ -304,6 +304,14 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
// Typescript reserved words
"abstract", "await", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "let", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "transient", "true", "try", "typeof", "var", "void", "volatile", "while", "with", "yield"));
Set<String> utilityTypes = new HashSet<>(Arrays.asList(
"Awaited","Partial","Required","Readonly","Record","Pick","Omit","Exclude","Extract","NonNullable",
"Parameters","ConstructorParameters","ReturnType","InstanceType","NoInfer","ThisParameterType",
"OmitThisParameter","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize")
);
defaultIncludes = new HashSet<>();
defaultIncludes.addAll(utilityTypes);
languageSpecificPrimitives = new HashSet<>(Arrays.asList(
"string",
"String",
@@ -325,6 +333,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
"object",
"Set"
));
languageSpecificPrimitives.addAll(utilityTypes);
languageGenericTypes = new HashSet<>(Collections.singletonList(
"Array"
@@ -805,7 +814,8 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
return openAPIType;
} else if (typeMapping.containsKey(openAPIType)) {
type = typeMapping.get(openAPIType);
if (languageSpecificPrimitives.contains(type)) {
String typeWithoutGeneric = typeWithoutGeneric(type);
if (languageSpecificPrimitives.contains(typeWithoutGeneric)) {
return type;
}
} else {
@@ -1157,6 +1167,16 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
}).distinct().collect(Collectors.toList());
}
@Override
protected boolean needToImport(String type) {
return super.needToImport(typeWithoutGeneric(type));
}
private String typeWithoutGeneric(String type) {
int genericIndex = type.indexOf("<");
return genericIndex == -1 ? type : type.substring(0, genericIndex);
}
@Override
public GeneratorLanguage generatorLanguage() {
return GeneratorLanguage.TYPESCRIPT;

View File

@@ -134,7 +134,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
private SortingMethod modelPropertySorting = SortingMethod.DEFAULT;
protected boolean caseInsensitiveResponseHeaders = Boolean.FALSE;
protected String releaseNote = "Minor update";
@Setter protected String licenseId;
@Setter protected String packageTags;
@Setter protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup
@@ -213,10 +212,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
CodegenConstants.LICENSE_ID_DESC,
this.licenseId);
addOption(CodegenConstants.RELEASE_NOTE,
CodegenConstants.RELEASE_NOTE_DESC,
this.releaseNote);
addOption(CodegenConstants.PACKAGE_TAGS,
CodegenConstants.PACKAGE_TAGS_DESC,
this.packageTags);
@@ -1293,11 +1288,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
this.caseInsensitiveResponseHeaders = caseInsensitiveResponseHeaders;
}
@Override
public void setReleaseNote(String releaseNote) {
this.releaseNote = releaseNote;
}
public boolean getUseOneOfDiscriminatorLookup() {
return this.useOneOfDiscriminatorLookup;
}

View File

@@ -387,6 +387,10 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|| ModelUtils.isFileSchema(p) || ModelUtils.isUUIDSchema(p)
|| languageSpecificPrimitives.contains(openAPIType)) {
return toModelName(openAPIType);
} else if (ModelUtils.isObjectSchema(p)) {
return "std::shared_ptr<Object>";
} else if(typeMapping.containsKey(super.getSchemaType(p))) {
return openAPIType;
}
return "std::shared_ptr<" + openAPIType + ">";

View File

@@ -670,6 +670,17 @@ public class DartDioClientCodegen extends AbstractDartCodegen {
op.imports.remove("Uint8List");
}
if (SERIALIZATION_LIBRARY_JSON_SERIALIZABLE.equals(library)) {
// built_value serialization uses Uint8List for all MultipartFile types
// in json_serialization, MultipartFile is used as the file parameter type, but
// MultipartFile isn't readable, instead we convert this to a Uin8List
if (op.isResponseFile) {
op.imports.add("Uint8List");
op.returnType = "Uint8List";
op.returnBaseType = "Uint8List";
}
}
resultImports.addAll(rewriteImports(op.imports, false));
if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) {

Some files were not shown because too many files have changed in this diff Show More