13645 Commits

Author SHA1 Message Date
William Cheng
7dac40e31c update comment 2024-06-26 09:55:31 +08:00
William Cheng
81feb4ba78 Merge remote-tracking branch 'origin/master' into normalizer-rule-default 2024-06-26 09:54:38 +08:00
martin-mfg
045b6012b3
[Spring] replace MultipartFile by Resource (#18509)
* replace MultiPartFile by Resource

* fix SpringCodegenTest

* new approach: small scoped fix

* move to JDK17 workflow

* update samples

* fix formParams
2024-06-25 18:26:09 +08:00
William Cheng
da7105bc6a
fix NPE in get type, add test (#19014) 2024-06-25 18:05:09 +08:00
William Cheng
6aa825bcf7
[Go] Fix an issue causing int array reference translated to an invalid type []Integer (#19013)
* [Go] Fix an issue causing int array ref be converted into an invalid type, `[]Integer`

* Add test case: wrapped and referenced integer of an array to Go client samples

* add check for ref to property in go abstract

* Update modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java

Co-authored-by: Zhiwei <zhiwei.liang27@pm.me>

---------

Co-authored-by: Zhiwei Liang <zhi.wei.liang@outlook.com>
Co-authored-by: Zhiwei <zhiwei.liang27@pm.me>
2024-06-25 16:29:28 +08:00
jpfinne
ba9ac74237
revert lsot testMicroprofileGenerateCorrectJacksonGenerator_issue18336 (#19005) 2024-06-24 17:01:02 +08:00
Rodrigo de Almeida - RMA3
5532203f9f
fix issue 18959 (#18962)
Co-authored-by: Rodrigo Maciel de Almeida <rodrigo.almeida@wefin.com.br>
2024-06-24 16:58:02 +08:00
Lucas
861e8f0656
[kotlin] implement serializable data classes (#8317) (#18386) 2024-06-24 08:13:32 +01:00
GregDThomas
0368f4e031
Add support for a bearer token supplier to OAuth based RestTemplate clients. Fixes #19000 (#19002) 2024-06-24 13:37:04 +08:00
William Cheng
c0be6ba9df update undetow to newer version 2024-06-24 12:43:22 +08:00
Yannick Wiesner
c5daf8193b
dart - make the dependency on the http, collection and meta package less strict (#18952) 2024-06-24 12:02:30 +08:00
William Cheng
d5f42500ab
[Golang] Move utility functions from client.mustache to utils.mustache (#19001)
* [Golang] Move utility functions from client.mustache to utils.mustache

* re-generate Go samples

* re-generate Go samples again

* re-generate samples once more

* update go samples

---------

Co-authored-by: Martin Lakov <martin.lakov@ocado.com>
2024-06-24 11:58:57 +08:00
William Cheng
1064cb6a68
Allow to pass a str to the Python aiohttp client (#18985)
* see #18972

Add support for `str`

* update python samples

---------

Co-authored-by: David Riccitelli <david@wordlift.io>
2024-06-23 17:19:26 +08:00
Jimmy Ma
4e89436177
[kotlin] Fix a leak in the ApiClient (#18997) 2024-06-23 17:17:05 +08:00
Nathaniel Cook
640ef9d944
fix(rust-server): remove duplicate allow(unused_imports) directive (#18983)
New versions of rust clippy catch errors with duplicate allow
directives. This change fixes the duplicate directives in generated rust
code.
2024-06-20 22:14:57 +08:00
Vito De Tullio
e5ae07c2b4
avoid setting debug property if not needed (#18872)
* avoid setting debug property if not needed

* update samples

* fix compatibility with python 3.7

* always set Configuration.__debug

* update samples

* check `Configuration` behavior when debug parameter is / is not set

* address PR requests
2024-06-20 18:23:34 +08:00
William Cheng
7747cc93e0
[Kotlin] update ApiClient to register all adapters for GsonBuilder (#18965)
* update api client to register type adapter

* update samples

* remove json array variable name
2024-06-20 00:20:11 +08:00
Johann-Peter
cf303d4e03
[csharp] Don't apply OpenAPIDateConverter json converter attribute for DateOnly properties (#18874)
* [csharp] Don't apply json converter attribute for DateOnly (#18541)

Applying the OpenAPIDateConverter to an DateOnly property fails at runtime with an exception.

* [csharp] Update samples
2024-06-19 17:53:00 +08:00
Cameron Koegel
9919c23267
[Ruby] Add Flag to Allow Ignoring Operation Servers (#18934)
* [Ruby] Add Flag to Allow Ignoring Operation Servers

* update samples

* add tests

* fix tests
2024-06-19 17:24:59 +08:00
ReneZeidler
5bc7aa3cd6
Never create inline model for allOf with single $ref (#18945)
Fixes #15077

The previous fix for this in #16096 is incomplete because it still
generates unnecessary inline models when readOnly or
nullable is used in conjunction with other properties like
description.
This commit fixes the logic error and adds testcases.
2024-06-19 17:15:33 +08:00
Val Packett
da57701569
[haskell-http-client] Support --name-mappings and handle _ name (#18943) (#18944)
* [haskell-http-client] Support --name-mappings and handle _ name (#18943)

Fixes #18943

* [haskell-http-client] Add missing TypeOperators flag

-Wtype-equality-requires-operators:
    The use of ‘~’ without TypeOperators
    will become an error in a future GHC release.
2024-06-19 17:07:26 +08:00
Oleg Gromiak
c3a2fe0592
[Python] Add retries option to Configuration constructor (#18919)
* Python: add retries option to Configuration constructor

* Update autogenerated sample clients
2024-06-19 17:06:33 +08:00
Andy☼ McSherry☼
a4b577ddc7
[swift] Issue 18940: Rename url & path variables to avoid collision (#18969) 2024-06-19 17:03:12 +08:00
Andreas Maechler
a4d43a8376
Add default (#18968) 2024-06-19 13:01:47 +08:00
William Cheng
819083b1ba
update urllib3 to newer version (#18957) 2024-06-18 14:32:20 +08:00
Cameron Koegel
abc4461e88
[python] Fix Typo in Model Test (#18953) 2024-06-18 11:59:17 +08:00
Oğuz Demirbaşcı
18b4bcba0d
useEnumCaseInsensitive option fixed in Java Native Model Enum (#18762) 2024-06-17 17:49:50 +08:00
Dennis Ameling
793aba724a
[kotlin-server][javalin6] Add Javalin 6 support (#18928)
* [kotlin-server][javalin6] Add Javalin 6 support

Javalin 5 support was added in 13edc5d. Javalin 6 has been released, with some breaking changes. Let's add a new supportedLibrary to not break existing users of Javalin 5.

https://javalin.io/migration-guide-javalin-5-to-6

* Fix Gradle config and don't include JVM 8 CI anymore (JVM 11 is the minimum for Javalin)

* Update docs

* Fix optional query parameter handling and turn into expected type
2024-06-17 11:38:17 +08:00
Peter Storch
c806ea51b3
requestMappingMode: Explicit configuration to control the location of the generated class level RequestMapping annotation (#18896)
Based on #13838 but for kotlin-spring.

Fixes #18884
2024-06-17 11:36:03 +08:00
jpfinne
129e4dc9c9
Fix #18715 [JAVA] ensure codegen fields and additionalProperties are not conflicting (#18935)
* Java generators:  use codegen fields in mustable

* Java generators:  use codegen fields in mustable

* Java generators:  use codegen fields in mustable

* Use MUSTACHE_PARENT_CONTEXT in additionalProperties

* Fix link to mustache documentation
2024-06-17 11:35:40 +08:00
Val Packett
989a79811a
[Android][Volley] Build fixes (#18899)
* [android] Fix useAndroidMavenGradlePlugin type in template

* [android][volley] Use version variables in template

* [android][volley] Exclude httpclient

As it is incompatible with Android

* [android][volley] Resolve file conflict between httpcomponents modules

* [android] Update Gradle, the plugins, build tools

This fixes building with current Android Studio.

Android Gradle plugin version 8.0.0 was chosen for wider compatibility
with Android Studio versions (as far back as 2022.2.1).

The Maven plugin has been abandoned since the functionality is now
built in, and manual jar tasks are not necessary with it.

* [android] Regenerate samples
2024-06-16 17:17:59 +08:00
Philzen
6f9ad31df3
[JAVA-SPRING] Avoid broken code due to duplicate rendering of @Deprecated annotation with generateBuilders=true (#18917)
* Implement regression test for #12804

* Fix duplicate rendering of @Deprecated annotation on Builder methods

* Regenerate samples

* Sort entries so it's easier to parse if an entry already exists

* Add sample that uses generateBuilders=true to test build matrix

Serves as an additional regression check for #12804

* Add --no-transfer-progress to mvn build command to increase log legibility
2024-06-16 12:02:53 +08:00
Philzen
ec8998b39f
[test-stack] Implement inner class assertion and fix typo "doesNotContains" (#18921)
* Implement InnerClassAssert for easy inner class testing

* Suppress "'Optional.get()' without 'isPresent()' check" warning

For now, until https://youtrack.jetbrains.com/issue/IDEA-354935
is solved.

* Apply DRY refactoring

* Move newTempFolder helper method into TestUtils

* Fix typo `doesNotContains`

* Pluralize assertion classes that extend ListAssert

* Add short-hand has/doesNotHaveAnnotation methods to Method assertions

So .hasAssertion(String) can replace .assertMethodAnnotations().containsWithName(String)

* Refactor tests, simplifying setup using CodegenConfigurator

* Harmonize API, removing confusion between has… and assert…

This makes our the assertion API more consistent, in the way that
assertSomething("") will always return a different assertion type,
while hasSomething("") will always return the same type.

* Use simplified hasAnnotation/doesNotHaveAnnotation assertions
2024-06-16 10:03:11 +08:00
Ghufran Zahidi
3d93862c6d
OneOf should handle Inheritance based type (#18892) 2024-06-16 00:06:56 +08:00
Philzen
642b1a3a95
[JAVA] [SPRING] [PKMST] [MICRONAUT] XML wireformat: Fix Jackson useWrapping=false, JAXB+Jackson namespaces (#18870)
* Fix XML annotations on model properties (JavaSpring)

* generate JAXB annotations for attributes and elements

* generate wrapper annotations (JAXB and Jackson)

* use XML config from items for annotations of containers

* Add test for Jackson XML wrapper correctness

* Add additional test cases to cover all xml applications in spec

Test now covers all use cases described in
- https://web.archive.org/web/20240424203304/https://swagger.io/docs/specification/data-models/representing-xml/
- https://spec.openapis.org/oas/v3.0.0#xml-arrays

* Fix basename used instead of xmlName when items.xmlName is unset

See last example in spec: https://spec.openapis.org/oas/v3.0.0#xml-arrays

* Harmonize spacing between Annotation attribute name and value

* Refactor and group JAXB vs. Jackson XML annotations, only generate latter if enabled

This is in line with the way the class annotations in `xmlAnnotations.mustache`
are rendered – which only renders the `@Jackson`… xml annotations if
additionalProperty jackson is true.

Also reorder annotation attributes in the following order:
- localName/name
- namespace (optional)
- isAttribute/useWrapping (optional)

* Explicitly render `useWrapping = true` to @JacksonXmlElementWrapper

This was slightly inspired by @jzrebiec via PR #5371.

Wrapping is the default since Jackson 2.1 – so explicitly rendering
this will:
- make generated model work out-of-the-box in Jackson 2.0 for instance
- ensure the models still work if the local `XmlWrapper` was
  configured with `useXmlWrapper(false)`

* Move xml test spec to java resources folder (not spring specific)

* Make test class name match class-under-test

This makes discovery & cross-navigation in IDE easier.

* Add complete xml annotations test for Java generators

* Fix Java PKMST generator not generating @JacksonXmlElementWrapper

* Fix Java microprofile generator missing @JacksonXmlRootElement

* Fix Java microprofile generator not using wrapper annotations and namespaces

* Fix Java Micronaut Client creating invalid (unclosed) @XmlAttribute annotations

* Fix Micronaut Client using wrong localName for @JacksonXmlElementWrapper

* Fix Micronaut client rendering @JacksonXmlProperty annotation twice

* Make Java Micronaut render @JacksonXmlElementWrapper(useWrapping=false) for non-wrapped elements

* Fix Jackson element using `xml.name` when it should be `items.xml.name`

Closes #5989
Closes #3223
Relates to #9371

* Fix JAXB element using `baseName` instead of `xmlName` when items.xmlName is unset

* Remove XML generation debug output from templates

* Remove redundant newline between XML class annotations and class

Brings the SpringCodegen in line with other Java Codegen's

* Remove redundant newline between XML setter annotations and setter

* Fix multiline JavaDoc block indentation and format

* Simplify / condense xml annotation template into single lines

May look a bit more complex, but cuts out a lot of repetitiveness.
Also reorders annotation attributes in the following order:
- localName/name
- namespace (optional)
- isAttribute/useWrapping (optional)

* Harmonize spacing between Annotation attribute name and value

* Remove unused jackson_annotations partial

Was not referenced anywhere in java-helidon resources folder

---------

Co-authored-by: Christian Schuster <christian@dnup.de>
2024-06-15 23:02:32 +08:00
William Cheng
13facdaab5
[python] Add an option to add ensure_ascii=False to json.dumps (#18888)
* Added ensure ascii

* add option to add ensure_ascii=False in jsom.dumps

* remove option

* update workflow

---------

Co-authored-by: Emile Girard <Emile.Girard@opal-rt.com>
2024-06-15 18:39:06 +08:00
Emmanuel Mathot
0aac363ca0
[rust-axum] Support for response status code ranges (#18895)
This PR adds support for response ranges in rust-axum server, as defined in section 4.8.16.2 of the spec.

### PR checklist

- [X] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
- [X] Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
- [X] Run the following to [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) and update samples:
  ```
  ./mvnw clean package
  ./bin/generate-samples.sh ./bin/configs/*.yaml
  ./bin/utils/export_docs_generators.sh
  ```
  (For Windows users, please run the script in [Git BASH](https://gitforwindows.org/))
  Commit all changed files.
  This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit as it would merge with master.
  These must match the expectations made by your contribution.
  You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example `./bin/generate-samples.sh bin/configs/java*`.
  IMPORTANT: Do **NOT** purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
- [X] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master` (upcoming 7.6.0 minor release - breaking changes with fallbacks), `8.0.x` (breaking changes without fallbacks)
- [X] If your PR is targeting a particular programming language, @mention the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) members, so they are more likely to review the pull request.
@frol @farcaller @richardwhiuk @paladinzh @jacob-pro
2024-06-15 18:12:47 +08:00
Emily Crandall Fleischman
cc24106832
[Rust-Axum] Use x-response-id if specified (#18906)
* [Rust-Axum] Use x-response-id if specified

* update samples
2024-06-15 18:12:38 +08:00
Filipe Silva
8bac93e23b
[csharp] Improved apiclient.mustache (#18915)
* improved apiclient.mustache to keep it dry, sharing a single exec with Action<> delegate.

* updated samples and test

* Removed async from ApiClient.mustache

Updated samples

* Revert change to CSharpClientDeepObjectTest.java

* Fix async await (it was not waiting creating a null exception)

Updated samples

* Fix File IO namespace with using directive

* Improved comments on new methods

Added new DRY method DeserializeRestResponseFromPolicy

* Fix comments and parameters for new method DeserializeRestResponseFromPolicy

Updated samples
2024-06-15 17:54:14 +08:00
Tobias Zink
01fec76ab1
feat(typescript-angular): add support for Angular V18 (#18916)
* feat/typescript-angular/add-v17-support

* HTTP_TRANSFER_CACHE_IN_OPTIONS for angular 17 as well

* run build scripts again because of angular 17 HTTP_TRANSFER_CACHE_IN_OPTIONS
2024-06-14 15:14:28 +02:00
Daniel Imber
f36590051f
[Enhancement] [Gradle Plugin] Allow templates from classpath (#14909)
* [Enhancement] [Gradle Plugin] Allow templates from classpath

* Adding missing argument binding.
2024-06-13 21:20:41 +08:00
Jean-Donald Roselin
ea0190324e
fixes #18853: provide support of array attributes in multipart/form-data request for axios and fetch typescript clients (#18855) 2024-06-13 14:49:55 +02:00
Max Lapshin
788fd6f725
Golang client can use pattern-based discriminator between oneOf (#18760)
* Enable reading schemas with pattern-based discriminator between oneOf for golang client #5311

* Codegen after changing to golang templates #5311
2024-06-13 16:31:36 +08:00
William Cheng
26a164e57f
[Java][Spring] enumUnknownDefaultCase true now returns correctly in fromValue (#18914)
* enumUnknownDefaultCase true added for Spring

* Resource added for test

* Updated tests

---------

Co-authored-by: Dean <dean.kane@opencastsoftware.com>
2024-06-13 16:23:56 +08:00
William Cheng
1765efc1ff
[Golang] Introduce 'lambda.type-to-name' in models_anyof.mustache (#18912)
* Update model_anyof.mustache

* add tests for anyof in go client

---------

Co-authored-by: Martin Lakov <85170913+martinlakov@users.noreply.github.com>
2024-06-13 16:01:58 +08:00
devhl-labs
3abe2512c5
[csharp][generichost] Add options for model parameter sorting (#18886)
* fixed parameter ordering

* placed changes behind a switch

* bug fix

* minor revert

* use lombok.Setter

* addressed comment

* lint

* minor refactor

* massively improve csharp templates code

improved apiclient.mustache to keep it dry, sharing a single exec with Action<> delegate.
improved api.mustache to keep it dry, used chain constructors, kept RequestOptions in a single method, set configuration with alias directive
moved fqn types to using directive for cleaner code
removed 'this' from variables/props that are redundant
fix CSharpClientDeepObjectTest code is now DRY so count must only be one

* updated test samples csharp

* removed async from ExecAsync (not needed here anymore)

* updated samples csharp

* nullable property not working on models due to not being defined in yaml schema

updated samples

* added options

* rebuild tests

* revert unintended commits

* rebuild samples

* rebuild samples

* rererebuild samples

* fix manual tests

---------

Co-authored-by: filipe <filipe_ds@live.com.pt>
2024-06-13 00:25:29 +08:00
William Cheng
fc0105e214
[Java][jaxrs-spec] enumUnknownDefaultCase true now returns correctly in fromValue (#18910)
* enumUnknownDefaultCase true added for Jaxrs-spec

* Updated tests

---------

Co-authored-by: Dean <dean.kane@opencastsoftware.com>
2024-06-12 23:43:43 +08:00
William Cheng
ef7654958e
Marketplace software zapier request middleware (#18907)
* feat: add middleware for requests

* update samples

---------

Co-authored-by: Stephen (Alex) Wallen <wallenstephen@outlook.com>
2024-06-12 16:32:08 +08:00
Dennis Melzer
7084e87140
Remove bean validation for uuid (#18900)
* Remove bean validation for uuid

* Add maxLenght to test the uuid validation
2024-06-12 11:53:14 +08:00
William Cheng
37ea82b2c7
Fix list in kotlin client templates (#18891)
* fix list in kotlin client templates

* remove java syntax in kotlin template

* fix array check
2024-06-12 11:42:44 +08:00