7852 Commits

Author SHA1 Message Date
William Cheng
48ef1e6cf1 Merge branch 'AddRefreshToCsharpTemplate' of https://github.com/BryanAldrich/openapi-generator into BryanAldrich-AddRefreshToCsharpTemplate3 2024-12-07 13:21:38 +08:00
Bryan Aldrich
12e29e4eeb fix to remove nullable reference types (the ! to remove the warning) and add documentation comments to the public members. 2024-12-06 12:26:00 -05:00
drewble
ba5ecbccde
Improved Elixir Atom Generation (#20229)
* Update ElixirClientCodegen.java

* Refine the regular expression for atoms

The original regex incorrectly matched `@atom` (unquoted atoms
cannot begin with @). However, through testing with `iex`, it also turns out that the atom
`:@` is legal.

The following atoms will now be quoted that would have been
incorrectly not quoted:

- `:@type`

* Add model to petstore client to test new atom creation regex pattern
2024-12-06 14:26:39 +08:00
Ernesto Fernández
52b5b8fb76
Fix a few issues with the C generator (part 2) (#20227)
* [C] Don't convert post body strings to JSON

If the body provided for the api request is a just a string itself,
don't try to convert it to JSON, simply submit the string.

* [C] Implement BearerToken authentication

* [C] Handle nullable fields correctly

* [C] Fix implementation of FromString for enums

* [C] Update the test schemas to cover the changes

* Update samples

* Fix the updated samples

* [C] Add the new samples folder to the CI workflow
2024-12-06 01:32:34 +08:00
Daniel Owens
387fd9986c
[typescript-fetch] fix API signature return type for empty 20x responses (#20249)
* typescript-fetch: fix promise return type for optional responses

* Remove unnecessary change
2024-12-05 13:44:08 +01:00
Jan Holy
f603f04bc4
[Kotlin] fix 20228 - spring-kotlin insert override modifier to interface if it is needed (#20246) 2024-12-05 10:01:02 +00:00
William Cheng
8035da8639
Revert "[Kotlin] fix #20231, OkHttp client can handle a field with a list of…" (#20257)
This reverts commit 71ccc88037216d973b0df12d4b6c618ae00b355b.
2024-12-05 17:04:42 +08:00
William Cheng
6ba311e85c
add a test for generateParameterId (#20256) 2024-12-05 12:59:26 +08:00
Jean-Pierre Portier
b2507777e6
fix (DefaultGenerator): Handle "$ref" parameter reference to identify parameter ID (#20239) (#20240) 2024-12-05 12:16:17 +08:00
William Cheng
f406f78978
[cpprestsdk] Better code format (#20237)
* remove blank lines

* fix summary, add line break bwtween vars

* update
2024-12-05 12:07:14 +08:00
Kirill Romanov
05d4aa9f62
[kotlin][client] support text/plain in okhttp (#20250)
* refactor: simplify application/octet-stream check

* feat: support text/plain in kotlin okhttp client

* refactor: remove redundant always-false condition

content is ByteArray is checked earlier
2024-12-05 11:51:10 +08:00
Thibaud Sowa
8a07557865
fix(typescript-angular): fix new angular dependency cli option usage (#20247)
Co-authored-by: Thibaud SOWA <thibaud.sowa@equasens.com>
2024-12-04 21:52:08 +01:00
Bryan Aldrich
ee15594da7 fix nullable de-reference on Created. 2024-12-04 13:37:18 -05:00
Bryan Aldrich
b582764d99 fix compile error for projects without default using statement.
make the created date nullable.
2024-12-04 10:21:43 -05:00
Jorge Fernandez
71ccc88037
[Kotlin] fix #20231, OkHttp client can handle a field with a list of files (#20232)
* feat(issue-20231): Kotlin okhttp client handles correctly fields that are optional with multiple files.

* docs(issue-20231): add docstrings

* feat(issue-20231): Remove unnecessary test spec
2024-12-04 22:41:37 +08:00
Francesco Saverio
0183620854
[cpprestsdk] Implement Enum inside Objects (#19919)
* Fix #19566 implemented the missing definition of declared methods inside openapi-generator/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache, have also be added two missing body of methods definitions

* Regenerated cpp-restsdk client samples

* Fixed shared_ptr creation

* [cpprestsdk] Implement enum inside objects
2024-12-04 16:06:45 +08:00
Nate Todd
4a6dbace73
[elixir] Update dialyzer spec (#20024)
* Update evaluate_response spec to support returning a list of structs

* Update elixir samples
2024-12-04 15:25:24 +08:00
Fionn O'Connor
e131d52ad0
[kotlin-spring] Handle arrays of files correctly using MultipartFile (#20108)
* [kotlin-spring] Fix no List being used for an array of files using multipart/form-data

* [kotlin-spring] Use Spring's MultipartFile class for incoming Files instead of Spring's Resource class.

* [kotlin-spring] Add test to ensure that return type for files is `org.springframework.core.io.Resource`

* [kotlin-spring] Ensure Array is used for lists of files in generated Api class

* Update samples

* [kotlin-spring] Move conditional usage of MultipartFile to optionalDataType.mustache. Update samples

* update samples

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2024-12-04 15:24:47 +08:00
William Cheng
b3d172a44f
use elixir petstore spec for testing (#20236) 2024-12-04 15:05:48 +08:00
Bryan Aldrich
3915e020cf quick edit to allow tokens to refresh if they specify an expires_in and created fields. Also supports refresh_token if that is passed. 2024-12-03 22:00:21 -05:00
Thibaud Sowa
423ba6739a
feat(typescript-angular): add support for Angular V19 (#20205)
* feat(typescript-angular): add support for Angular V19

fix #20204

* feat(typescript-angular): add options to override angular deps + refactor deps definition

add tsVersion, rxjsVersion, ngPackagrVersion and zonejsVersion options to override default config if new version of Angular is available but not yet implemented in openapi-generator
refactor Angular dependencies definition in separate readable yaml config file

fix #20204

* feat(typescript-angular): add better angular 19 exemple for ci testing

fix #20204

* feat(typescript-angular): unify tsVersion param

fix #20204

---------

Co-authored-by: Thibaud SOWA <thibaud.sowa@equasens.com>
2024-12-03 17:58:17 +01:00
Gregory Merlet
cf78f1028d
Fix dangerous destructuration in typescript-nestjs services (#20157)
* refactor: remove requestParameters destructuration

* feat: add reserved param names sample

* feat: quote params

* feat: improve with reservedWords

* feat: use vendorExtensions instead of extending CodegenParameter
2024-12-03 11:38:43 +01:00
Kirill Romanov
26609e9ad3
fix: register gson CustomTypeAdapterFactory in kotlin-client if generateOneOfAnyOfWrappers enabled (#20217) 2024-12-03 12:10:41 +08:00
William Cheng
25d780ee6d
update python multipart dep to 0.0.18 (#20225) 2024-12-03 12:08:29 +08:00
DielN
b9f6fe6b1f
[Java] [Microprofile] Add Json-B polymorphism type info annotations (#20164)
* [Microprofile] Add Json-B polymorphism annotations

* [Microprofile] Set openApiNullable in configs to false

* [Microprofile] Bump JSON Bind version to 3.0

* [Microprofile] Only apply JSON-B polymorphism for MP 3.0

* Update samples

* [Microprofile] Update documentation/configs for openApiNullable

* Update docs
2024-12-03 12:02:54 +08:00
Colin Ihrig
06f0b68eee
fix(typescript): remove incorrect file extensions (#20194)
* fix(typescript): remove incorrect file extensions

url, http, and https are Node.js core modules, and form-data
should be loaded using a bare specifier. This commit removes
the file extensions from these imports.

* update samples
2024-12-02 15:51:49 +01:00
Joris Dobbelsteen
1eaa75bd36
Fix python code when receiving JSON data without a property that is a dict to ref/enum causing AttributeError (#20022) 2024-12-02 16:25:23 +08:00
daniel
88be078c68
Trim the input of operationId filter in OpenAPINormalizer (#20186) (#20189) 2024-11-30 23:15:10 +08:00
Ingars Ribners
3f6c3de029
Updated README.mustache template for the Erlang server generator (#20138)
* Updated README.mustache file for the Erlang server generator. Fixed one error and updated the usage instructions

Changes made to the Erlang server generator's user instructions ("README.mustache" file):

1. Corrected the argument in section 4.1 of the user instructions.
   In openapi_server:start/2, the second argument for the generated Erlang code must now be in a different format than proposed in the instructions (see lines 13-16 of the "server.mustache" file).
   Initially, the server failed to start, and after some debugging, I discovered that the argument format did not match the server's expectations, causing the port number not to be passed to cowboy:start_clear/3. This has now been fixed.

2. Reviewed and updated the text of the user instructions to remove any ambiguities.

3. Tested the user instructions for accuracy and completeness.

* erlang-server sample recompiled

* README fix

* Fixed README.mustache template markdown for erlang-server. Re-generated erlang-server sample.

* Update README.mustache

* Sample 'erlang-server' re-generated

* update samples

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2024-11-30 17:31:56 +08:00
William Cheng
878148e66d
update kotlin option description to clarify the support (#20211) 2024-11-30 13:32:15 +08:00
jops-wtakase
2aa49227b0
Bugfix: #1666: Change requestBody argument name to 'body' (#20207)
Since Connexion defaults to using 'body' as the argument name for the requestBody, the controller's argument name is adjusted accordingly.
2024-11-30 10:20:06 +08:00
Cedric Ziel
706c0a177e
fix: close quotes in cargo manifest (#20209) 2024-11-30 10:12:15 +08:00
William Cheng
711e53a90c
[Java] Add option to fallback to legacy enum naming (#20172)
* add option to fallback legacy enum naming (java)

* fix tests
2024-11-29 17:12:12 +08:00
Thomas Ville
34bd02109e
[rust][reqwest] support binary type for download (#20031)
* [rust][reqwest] support binary type for upload and download

* [rust][reqwest] support binary download in supportMultipleResponses contexts

* [rust][reqwest] support binary responses that don't have any return type
2024-11-29 17:07:30 +08:00
Timon Borter
326f100f0e
fix(#20201): static access to normalizeMediaType in typescript object serializer (#20202)
accessing `normalizeMediaType` should be done static in `ObjectSerializer`, as described
in https://github.com/OpenAPITools/openapi-generator/issues/20201.

fix applies only to the `typescript` generator.
2024-11-28 11:01:37 +01:00
Matt Pollock
e3e06af5f4
[R] fix to-list and to-json functionality (#20132)
* [r client] fix to-list and to-json functionality

* fix type of json string

* wip

* refactor pr

* regenerate samples

* update to-dataframe example to use non-superceded tidyverse functions

* fix typo
2024-11-28 16:31:21 +08:00
Ernesto Fernández
037cb12f34
Tests for recent C fixes (#20200)
* [C] Add test schemas for the recent changes

The recent commit 47665aaa97cb ("Fix a few issues with the C generator
(part 1 version 2) (#14434)") didn't include any test schemas. Add them
now, as requested:

  https://github.com/OpenAPITools/openapi-generator/pull/14434#issuecomment-2497497110

* Update samples

* Fix sample update with missing files

* More fixes for sample updates
2024-11-28 16:27:42 +08:00
Nelson Vides
f8ca36b97e
Erlang server – minor fix to return type and generated doc (#20197)
* erlang-server: add jesse to app.up release

* erlang-server: remove dialyzer errors that might not be related to the program

* erlang-server: minor fixes to return types and generated docs
2024-11-27 22:09:21 +08:00
Ernesto Fernández
47665aaa97
Fix a few issues with the C generator (part 1 version 2) (#14434)
* C: add a template for an empty any_type.h header

Some generated C apis fail to build because the source files get
'#include "any_type.h"' lines, but no such header gets generated. As a
simple fix, add a new template for an empty file with that name. This is
enough to fix the problem for us, because all the generic type stuff is
handled by object_t.

* C: fix enums

I'm guessing that enums have not been used much with the C generator
before, because they always seem to produce code that doesn't build, or
that tries to free them after use. This patch fixes all the problems
we've encountered so far, except for those that need checking the return
type. I'll come back to that later.

* C: fix confusion of 'classname'/'classFilename'

* C: fix issues with returned enums

Currently, the C templates never check if a function returns an enum
inside mustache, so when that happens the generated code has broken
return types and doesn't build. I originally tried to fix this by
extending CodegenOperation to implement a 'returnTypeIsEnum' check, but
William Cheng suggested[1] that I use the existing 'returnProperty'
instead:

  https://github.com/OpenAPITools/openapi-generator/pull/14379#discussion_r1064636735

So do that.

* C: update the samples

As required for a pull request, run the generate-samples.sh script and
commit the changes.

* update samples

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2024-11-27 18:16:10 +08:00
Per Hallgren
8a94fc667e
[BUG][GO] use value receiver for JSON marshal (#19962)
* chore(go): add failing test for JSON marshalling

Adds a small schema (FruitJuice) which contains a required gmFruit,
which inherits using AnyOf. This fails to correctly marshal as JSON.

* fix(go): use non-pointer receiver for JSON marshal

In the case of a required anyOf property, JSON marshalling would has
been incorrect.

Required properties are not nullable, and thus always use value
receivers. For the single case of anyOf models, a pointer receiver was
used for MarshalJSON. All other instances of json marshalling use value
receivers.

This change is simply to use a value receiver instead of a pointer
receiver in the template for `MarshalJSON` on anyOf models.

---------

Co-authored-by: Per Hallgren <perhallgren@users.noreply.github.com>
2024-11-27 18:09:11 +08:00
jops-wtakase
7b35613cfc
[python] Encode list query params (#20148)
* Bugfix: #17688: Encode list query params

* Test: #17688: Update validation error message tests for Pydantic 2.10+

Pydantic 2.10+ introduced changes to validation error messages,
requiring updates to the affected test cases.
2024-11-26 23:53:12 +08:00
Victoria Casasampere Fernandez
7072009ab5
[Rust-Axum] Support quotes in string literals (#20176)
* Allow quotes in string literals

* Update samples
2024-11-26 21:36:11 +08:00
Linh Tran Tuan
19e21416ed
[Rust-Axum] BugFix: handling non-lowercase Header in Request/Response (#20178) 2024-11-26 18:39:29 +08:00
Qluxzz
ed211050f1
[Elm] Fix not sanitizing param name (#20171)
* Add failing example

* Sanitize param name

* Regenerate fixed sample

* Override toParamName instead
2024-11-26 17:30:04 +08:00
Lennard Sprong
55f02e995b
[swift6] Change Response to struct (#20185) 2024-11-26 08:30:50 +00:00
Lennard Sprong
af89ed8043
[swift5] Add Identifiable conformance to supported models (#20179) 2024-11-25 17:43:51 +00:00
Victoria Casasampere Fernandez
a7cacce30e
[Rust-Axum] Dynamically set the types of integer literals (#20133)
* Dynamically set the types of integer literals

* Change the literal limits from i32 to adaptive limits

* Remove length literal types
2024-11-26 00:24:06 +08:00
Lennard Sprong
4c5a57fe7b
[swift6] Add Identifiable conformance to supported models (#20166) 2024-11-24 22:35:17 +00:00
Bragolgirith
8ce332a540
[Java] Fix compilation for Map of InnerEnum (#19401) 2024-11-25 00:40:44 +08:00
altro3
cdafa5a0cc
Deprecate micronaut openapi generator (#20107)
* Deprecate micronaut openapi generator

* update get help message

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2024-11-24 23:26:37 +08:00