8358 Commits

Author SHA1 Message Date
William Cheng
0da60def01 update samples 2024-06-26 10:04:23 +08:00
William Cheng
da7105bc6a
fix NPE in get type, add test (#19014) 2024-06-25 18:05:09 +08: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
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
Jimmy Ma
4e89436177
[kotlin] Fix a leak in the ApiClient (#18997) 2024-06-23 17:17:05 +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
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
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
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
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
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
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
Filipe Silva
e8bbfe23b4
[csharp] fix system.web warning and removed unneeded fqn (#18902)
* Refactor validatable.mustache moved fqn types to using directive for cleaner code

Fix netcore_project.mustache conditional "System.Web", more details:
https://learn.microsoft.com/en-us/aspnet/core/migration/inc/adapters?view=aspnetcore-7.0

* updated csharp samples
2024-06-11 19:53:39 +08:00
Filipe Silva
7f34e11a7f
[csharp] Refactor anyOf model template (#18901)
* Refactor AnyOf model removed "this."

* Updated csharp samples
2024-06-11 18:43:27 +08:00
Nate Todd
00f2cd573c
[Elixir] Fix generation issues and compilation warnings in Elixir generator (#18788)
* Format Elixir generator

* Update Elixir reserved words

* Update Elixir generator docs

* Improve typespec generation to avoid double ".t" issues

* Fix compilation warnings by changing reserved words to use suffix instead of underscore prefix

* Include additional reserved words and handle words with leading underscores

* Update samples and docs

* Uses dataType instead of baseType for non-struct types

* Generate elixir samples

* Fixes issue with AnyType in a list

* Generate elixir samples

* Removes normalizeTypeName for arrays as they correct by getTypeDeclaration

* CodeStyle

---------

Co-authored-by: Michael Ramstein <michael@ramste.in>
2024-06-10 14:06:16 +02:00
Pierre B
f517bf7b98
[typescript-fetch] - Fix Nullable Types (#18887)
* fix nullable types

* fix samples

* fix samples

* fix samples

* fix samples

---------

Co-authored-by: Pierre Berube <pberube@blackpointcyber.com>
2024-06-10 11:35:20 +02:00
Philzen
5adf1ff522
Avoid UnsupportedEncodingException by design, replacing magic string "UTF-8" with StandardCharsets.UTF_8 (#18851)
* Replace magic string "UTF-8" with StandardCharsets.UTF_8

This avoids an UnsupportedEncodingException by design.

* Remove unused UnsupportedCharsetException import
2024-06-08 15:23:24 +08:00
William Cheng
4be5971e0f
[cpp-restsdk] add support for oneOf via std::variant (#18821)
* Revert "Revert "[cpp-restsdk] add support for oneOf via std::variant (#18474)…"

This reverts commit 8d398719c99fbcbfa6471e0bb938f9d384454f8f.

* update samples

* update pom

* set cxx 17

* Revert "set cxx 17"

This reverts commit 0cec8f725dd8017217b75e827a54da5440dd55d1.

* install clang 6.0

* Update CI/circle_parallel.sh

Co-authored-by: Amin Yahyaabadi <aminyahyaabadi74@gmail.com>

* fix include

---------

Co-authored-by: Amin Yahyaabadi <aminyahyaabadi74@gmail.com>
2024-06-07 12:24:39 +08:00
Nikita Shmakov
3aba42733b
clone Schema using AnnotationUtils.clone with WA (to clone schemas wi… (#18867)
* clone Schema using AnnotationUtils.clone with WA (to clone schemas with example field set)

* changes after scripts run
2024-06-06 20:55:51 +08:00
ふぁ
6ae8a8f4c7
[python] fix deserialize on basic str fails (#18800)
* [python] fix #18774 Deserialize on basic str fails

* [python] update sample

* [python] update test

* [python] remove type

* [python] fix test

* [python] add top level type test

* Update deserialize content_type parameter and quote

* [python] restore echo_api test

* [python] add allow empty json in Response
2024-06-06 16:15:50 +08:00
julien Lengrand-Lambert
42c78403cb
JetBrains HTTP Client - Adds support for query and header params and env file (#18844)
* Adds basic support for query params.

* Need to parameterize them
* Need to add tests
* Need to add option to skip, maybe
* Need to add support for header params too

* Parameterizes query param values

* Need to add tests
* Need to add option to skip, maybe
* Need to add support for header params too

* Remove extra empty line

* Adds support for header params

* Also fixes extra end of line bug.

* Fixing failing test

* Adding tests for query params

* Adding tests for header params

* Adding basic support for env file

* Add support for env file for path variables and custom header variables

* TODO : Add tests

* Adding tests for env generation

* Adding generated test files

* Fix namefile
2024-06-05 10:30:25 +08:00
devhl-labs
91a1931bd9
[csharp][generichost] Add support for primitive composed (#18825)
* add support for primitive composed

* build samples again

* rebuild tests

* addressed comment
2024-06-04 12:38:53 +08:00
Philzen
ed2aad6756
[JAVA: okhttp-gson, rest-assured, retrofit2] Don't generate Jackson import when serialization library is GSON (#18811)
* Partially revert "replace deprecated ISO8601Utils with StdDateFormat (#17052)"

This partially reverts commit 76560e34c9aacd9d7593ac45bd204e2edf38abd9, namely anything
related to generators and samples using GSON instead of Jackson.

Changes to Jackson-only generation and generator-online regarding RFC3339DateFormat
are not being reverted.

* Test for default serialization library fallback

* Convert repetitive tests to parameterized test

* Add regression test for #18515

* [FEIGN] Only include <jackson-databind-version> property in pom.xml when required

* [RETROFIT2] Only include jackson-databind in gradle file when actually required

* [FEIGN] Don't include jackson dep's in sbt file when GSON is selected

* [FEIGN] Don't include jackson dep's in gradle file when GSON is selected

* DRY refactor JavaClientCodegen test code, increase readability

- use fluent assertions
- use helper method newTempFolder()
- use Java 9 static factory methods for maps
- don't declare variables that are only used once
- group declarations and usages
- use non-blocking java.nio.file API wherever possible

* Regenerate samples
2024-06-02 21:42:55 +08:00
William Cheng
713aa92b22
add tests for 18772 (#18828) 2024-06-02 18:10:46 +08:00
Gerwin Jansen
c08afa37e4
[BUG][Csharp][GenericHost] OpenApi 3.1: Model property of type map/additionalproperties gets generated as object (#18772)
* Fix the bug + add test case

* Add sample output

* Update version number in new sample output

---------

Co-authored-by: Gerwin Jansen <gerwinjansen@users.noreply.github.com>
2024-06-02 17:31:53 +08:00
Philzen
2b9949a66b
Bump Jackson to latest v2.17.1 and sync in templates (#18799)
* Drop separate version property

Not required as all Jackson packages usually tether on a version bump.

* Update Jackson to v2.17.1

* Sync Jackson version used by Spring Boot with project version

* Sync jackson update to v2.17.1 with generator templates

* Regenerate samples with updated versions

* Adjust test to current exception msg behavior

* Add dependency mgmt to ensure matching version for transitive dependencies

* Update library descriptions with correct Jackson version number

* Update library descriptions with correct GSON and JSONB versions

* Update retrofit library description with correct version number

* Update retrofit description to include Jackson as an option

This should have been done as part of in #16853.

* Update remaining libary version descriptions with correct versions

* Generate updated doc
2024-06-02 15:17:38 +08:00
William Cheng
8d398719c9
Revert "[cpp-restsdk] add support for oneOf via std::variant (#18474)" (#18820)
This reverts commit 6a3d406690a732486af8f32a63c9dbdcdb47e8c5.
2024-06-01 19:04:03 +08:00
Amin Yahyaabadi
6a3d406690
[cpp-restsdk] add support for oneOf via std::variant (#18474)
* [cpp-restsdk] add support for oneOf via std::variant

* [cpp-restsdk] detect the latest supported C++ standard in CMake

* [cpp-restsdk] add test with oneOf support for cpprest

* [cpp-restsdk] avoid warnings because of implicit this capture

* [cpp-restsdk] avoid deprecated CMake version warnings

* [cpp-restsdk] build the test into the build directory - parallel build

* [cpprest-sdk] use absolute source path for cmake + debug build

* fix: remove inheritance due to template not overriding

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2024-06-01 17:48:02 +08:00
Lars van Leeuwen
8783ad8a18
[Python] List enum members in docs (#18804)
* List enum values in docs

* Remove newline

* Remove another newline

* Generate samples
2024-06-01 17:00:11 +08:00
devhl-labs
368110a631
[csharp][generichost] Added 4.8 samples (#18791)
* added 4.8 samples

* easer to understand diff

* build samples again

* build samples again
2024-06-01 16:17:58 +08:00
William Cheng
353320cb04
[kotlin] better oneOf, anyOf support (#18382)
* add validteJsonElement

* add oneOf support

* various fixes, add tests

* minor fixes

* minor fixes

* update data class

* remove comments

* array support, add test

* update api client constructor

* add anyOf support

* add new files

* fix merge

* update

* update

* update

* update
2024-05-31 12:22:27 +08:00
devhl-labs
b19fc67a53
added framework support (#18776) 2024-05-29 20:58:52 +08:00
HentaiHeavenVR
edaace9323
Fix TS7053 errors in generated instanceOf* methods (#18770)
* Fix bug referenced in #18746 , introduced in #18418

* Generate examples
2024-05-28 14:18:39 +02:00
Marcel Huber
74a9509e0c
[Java][native] Fix: DateTime in deepObjects is no longer serialized correctly [fix #18742] (#18743)
* fix serialization of OffsetDateTime

* update samples

* wrap import
2024-05-27 16:32:32 +08:00
Philzen
9c999b6559
[General] Remove defunct global property withXml from generator, docs, maven & gradle plugin (#18568)
* Mention that Golang generator also supports XML annotations

Looking at src/main/resources/go/model_simple.mustache and
src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java
the GoLang seems to cater for withXml=true

* Fix maven plugin config description for `withXml`

* Add basic test for global withXml setting

* Use global withXml setting if not configured in ConfigOptions

Resolves #3839 and #5764

* Don't generate metadata or other files when only Models are tested

* Reformat table for readability

* Remove global property `withXml` from generator and docs

* Move WITH_XML constant out of system constants block

Currently there is only a single reference to this value in the whole
codebase (GoClientOptionsProvider). Maybe we should re-think how this
file is organised (i.e. provide a clearer split / mapping / understanding
what are system properties vs. global properties vs. configOptions and
where to put them).

* Remove global option `withXml` from Maven plugin (Breaking change)

This is a "soft" breaking change: Plugin will no longer execute if
user have this option – which is good, b/c it never worked as expected.
We may want to hint this in the 8.0 release notes.

* Remove global property `withXml` from Gradle plugin (Breaking change)

This is a "soft" breaking change: Plugin will no longer execute if
user have this option – which is good, b/c it never worked as expected.
We may want to hint this in the 8.0 release notes, so they can add it
to the `configOptions` map if required, or simply delete it

* Update samples to reflect removed `withXml` property

* Move `withXml` option into ConfigOptions for Java Microprofile sample

* Remove unused local vars and parameters

* Avoid repetition using fluent assertions

* Remove extraneous debug output
2024-05-27 14:35:32 +08:00
William Cheng
258b7af727 update samples 2024-05-26 21:42:10 +08:00
devhl-labs
ee3ff39225
fixed sorting (#18706) 2024-05-26 18:07:31 +08:00
Marcel Huber
728abafdfa
[Java][native] Fix: empty deepObject can produce invalid query [fix #18736] (#18737)
* fix empty query parameter string

* update samples
2024-05-26 15:54:58 +08:00
Jonathan Siegel
77365c34fa
[crystal-lang] Resolve type check compile error in ApiError (#18759)
* Even with .nil? typecheck, compiler still fails due to .empty? call on nillable type. This appears a poor implementation issue by crystal-lang, but this explicit try avoids the issue for now.

* Made call more succinct.
2024-05-26 11:44:07 +08:00