1494 Commits

Author SHA1 Message Date
masudanaokinino
0357a1b1dd
fix "parameters_to_url_query" throws an error (#17638) 2024-01-23 16:31:47 +08:00
Robert Schweizer
a0418c2855
[python][client] Clean up samples and CI (#17509)
* chore: Remove leftover Github action file

This was probably added by mistake. A similar file is active in
.github/workflows/samples-python-pydantic-v1-petstore.yaml.

* chore: Remove leftover VERSION from old python-experimental sample

* ci: Stop running Python integration tests in Circle CI

These Python clients are all tested with Github Actions already, which
is faster, more cleanly separated and only runs on modifications.

I'm not cleaning up the pydantic-v1 client, I expect it to be removed soon anyway.

* chore: Remove true from sample folder name

python-disallowAdditionalPropertiesIfNotPresent-true
-> python-disallowAdditionalPropertiesIfNotPresent
2024-01-16 10:34:04 +08:00
Gonzalo Gomez
af71460c86
[Go-Server] Use ParseQuery For Parsing Query Parameters (#17585)
* Uses ParseQuery to check for malform paramater value pairs.
Runs ./mvnw clean package, ./bin/generate-samples.sh ./bin/configs/*.yaml, and ./bin/utils/export_docs_generators.sh.

* Adds missing import

* Only import url if hasQueryParams.

* Adds helper function to wrap url.ParseQuery.

* Fixes function return signature
2024-01-15 13:43:04 +08:00
William Cheng
6518932ccf add tests for oneOf object (go) 2024-01-15 12:06:56 +08:00
Huan-Cheng Chang
8e9a17fe02
[Python] Handle nullable dictionary values (#17605)
* fix nullable elements in maps

* update examples

* exclude values typed as Any
2024-01-13 18:45:22 +08:00
Roi Shacham
406bc28a3d
Fix parameters_to_url_query doesn't properly convert lists to string (#17592)
* fix parameters_to_url_query to properly handle lists

* fix query parameters bug in sample clients

* add tests for url query list value

* build project

* tests fix

* Revert "build project"

This reverts commit a486a6de7528302db92c36e64dcd20d41ada51b9.
2024-01-13 11:36:01 +08:00
Huan-Cheng Chang
968c6dc418
[Python] Handle nullable list items (#17594)
* fix nullable elements

* update type info in docs

* update examples
2024-01-13 11:29:22 +08:00
William Cheng
75ef9e0b02 update java samples 2024-01-12 12:51:33 +08:00
Alexis Couvreur
dd5c7e3b9a
fix: ExampleGenerator correctly generates allOf composed schemas (#17499)
* fix: ExampleGenerator correctly generates allOf composed schemas

Changes the previous behavior of generating `null` examples for allOf composed schemas.

Fixes #17497

* fix: ExampleGenerator correctly generates anyOf and oneOf composed schemas

Changes the previous behavior of generating `null` examples for anyOf and oneOf composed schemas.

To generate a oneOf/anyOf example, we generate the example using the first valid schema available. In case of a $ref, we use the first valid reference.

Fixes #17497
2024-01-10 11:04:11 +08:00
Erik Booij
90f3b24edc
fix(go-server): ensure original filename can be deduced from tmp file (#17416) 2024-01-10 02:00:44 +08:00
Thomas Kläger
69a4a65bc7
fix spring generator dto annotations (#17054) 2024-01-09 16:47:10 +08:00
Jonathan Ballet
df7976c1a3
python: enable more mypy checks 1/n (#17556)
* python: more mypy checks

* mypy: check_untyped_defs

* mypy: disallow_subclassing_any

* mypy: disallow_untyped_decorators

* mypy: disallow_any_generics
2024-01-09 16:45:05 +08:00
Jonathan Ballet
22a0fc1727
python: adjust basic typing information (#17511)
* python: adjust basic typing information

This is an initial pass to fix and adjust the typing information for the
generated client. This is enough to have mypy runnning without complains
on all the (modern) generated clients (Pydantic v1 code is not checked
for instance)

mypy is also now run directly in the CI, so further changes will also be
checked and thus, will need to be compliant with good typing
information.

Note that this doesn't *fully* type all the code: mypy is not run in
"strict" mode and there are still many functions/methods/attributes
which are still not fully typed, but it's a first good step in that
direction.

* ApiResponse's raw_data can't be None

* Fix indentation

* Revert test changes

* run mypy on tests/ directory

* don't forcefully convert the client response headers to dict

* override petstore ApiResponse model

* adjust type of 'any/one_of_schemas' fields
2024-01-06 15:40:42 +08:00
William Cheng
c782526556 update samples 2024-01-05 14:28:13 +08:00
martin-mfg
64f2cad9e8
fix #17258 - use model class only if it is generated (#17490)
* fix  #16797 and #15796 spring child constructor missing parent params

* root cause and update the DefaultCodegen.java to add missing property when with multi inheritance

* rollback SpringCodegen.java

* update samples

* rollback with master cause #16992 fixed this issue too

* still using orignal design

* catchup master

* catchup master

* catchup master

* fix

* add tests

---------

Co-authored-by: dabdirb <dabdirb@gmail.com>
2024-01-05 10:30:28 +08:00
Jonathan Ballet
063865973d
python: simplify module imports (#17507)
In #16624, I introduced a new mechanism to record imports to other
modules, instead of having specialized datetime/typing/pydantic objects
to manage imports for these modules.

This change reuses the mechanism from #16624 and replace the specialized
import managers by the generic one. Unused imports from various
.mustache templates are also cleaned up.
2024-01-03 21:22:53 +08:00
Ghufran Zahidi
c252216700
[go]: Accept APIKey as string, byte array or stream using io.Reader interface (#17432)
* Added support for APIKey as string or bytes stream for golang sdk.

* updated the sample code

* Update modules/openapi-generator/src/main/resources/go/signing.mustache

Co-authored-by: Vikrant Balyan <vvb@users.noreply.github.com>

* updated the sample code

---------

Co-authored-by: Aanisha Mishra <aanisha.mishra05@gmail.com>
Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
Co-authored-by: Vikrant Balyan <vvb@users.noreply.github.com>
Co-authored-by: Sebastien Rosset <serosset@cisco.com>
2023-12-26 17:39:53 +08:00
William Cheng
5eab3cef19
Prepare 7.3.0-SNAPSHOT (#17456)
* Revert "v7.2.0 release (#17455)"

This reverts commit fe638d009363c142c246ff089032f243e0b4ee01.

* set version to 7.3.0-SNAPSHOT

* update doc
2023-12-22 16:55:58 +08:00
Charles Treatman
da13013a27
[Go] fix validation of property names when a model has required fields and doesn't allow additional properties (#17267)
* update template for required field validation when additional properties are not allowed

* regenerate samples

* move bytes import from template to GoClientCodegen

* regenerate samples

* add test for model with required fields and additionalProperties: false
2023-12-22 12:35:52 +08:00
Ween Jiann
bf4c98a82a
[go-server] Add ability to handle nullable query param (#17321)
* Update

* Regen
2023-12-21 19:13:05 +08:00
William Cheng
a62132ecd9
fix exception in request body with enum ref (#17438) 2023-12-21 15:22:28 +08:00
Anton Ignatov
aacea3477f
Generalized mime type support (#17285)
* implemented generalized content-type handling

* regenerated samples

* addressed implementation review feedback

* added tests for proposed improvements
2023-12-19 13:23:36 +01:00
William Cheng
809d7151c6
remove auto-generated ruby tests (#17402) 2023-12-15 14:47:15 +08:00
Aliaksei
809b3331a9
[4947][java]: adds support for validation of primitives in arrays (#17165)
* [4947][java]: adds support for validation of primitives in arrays

* [4947][java]: prevents generation '@Valid' for Object

* [4947][java]: test against different codegens and stick to primitive

* [4947][java]: code review

* [4947][java]: enhance getBeanValidation

* [4947][java]: adds email

* [4947][java]: removes unnecessary override

* [4947][java]: adds postProcessResponseWithProperty

* [4947][java]: adds missing import {{javaxPackage}}.validation.Valid

* [4947][java]: adds missing useBeanValidation

* [4947][java]: fix use rootJavaEEPackage for helidon
2023-12-11 20:55:38 +08:00
William Cheng
62399b1897
add a test for SecretStr in the python client (#17364) 2023-12-11 13:18:36 +08:00
TAKAHiRO TOMiNAGA
004c7e8c8d
[Style][Go] standardize the format of mustache (tiny change) (#17363)
* fix: change indent style to tab in the mustache to generate Go code

* docs: standardize the language names for code blocks

* docs: change indent style to tab in the code blocks

* update: regenerate samples

* `./bin/generate-samples.sh ./bin/configs/*.yaml`
2023-12-10 10:13:49 +08:00
William Cheng
10da7a3c5a
[Ruby] add file download tests (#17362)
* add new ruby echo api clients

* add tests for ruby faraday file download

* add file download test to ruby Typhoeus

* add ruby workflow, add tests for ruby httpx

* update

* fix
2023-12-09 22:05:27 +08:00
Dennis Melzer
e37decff7b
Add Java Optional for POJOs in JavaSpring templates (#17202)
* Add optional parameter for request body

* Adapt Test

* Add test

* Format code

* Remove extra method

* Add optional for pojos

* Add optional for pojos

* Add bean validation for Optional

* Add default values + test

* Rename test
2023-12-08 21:46:13 +08:00
Robert Schweizer
6a43a371f1
fix: Configure python urllib3 connection pool size (#17323)
This was removed in #16802, but using a higher value than 1,
or at least making this configurable makes complete sense.

Without this, we get a lot of these log messages:

[ WARNING] Connection pool is full, discarding connection:
2023-12-06 15:49:10 +08:00
William Cheng
bbd0ce38be
add enum mapping option to dart generators (#17298) 2023-12-04 12:32:36 +08:00
William Cheng
b19bc59c6a
add enum name mapping feature to go generators (#17289) 2023-12-04 10:52:58 +08:00
Pat Buxton
9970c06f8c
Adds basic retries to rest API requests for Python asyncio (#17014)
* Adds basic retries to API requests

 * This mimics the basic retries performed by urllib3 in the sync version

* update samples

* Only use retry client if number of retries is specified in the config

* Reorganize

* Remove class attribute

* close retry_client

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2023-11-21 10:42:34 +08:00
William Cheng
8e36014ae6 update samples 2023-11-19 17:36:25 +08:00
William Cheng
186fde250b
[spring-cloud] add http basic test (#17135)
* update samples

* add tests for spring cloud http basic

* fix path

* update samples
2023-11-19 16:07:28 +08:00
Robert Schweizer
75ff110449
[python] Some cleanup of samples folder (#17127)
* Delete sample folders of discontinued clients

* Remove duplicate python-flask server sample

The python-flask sample actually lives in samples/server/petstore/python-flask.

* Move hand-written test to "tests" folder

Now, "test" only contains generated stubs and all hand-written tests are in "tests".

* Delete left-over files in Python samples

These are not created by the generators (anymore) and not hand-written
for testing.

* Regenerate test file to fix import error
2023-11-19 14:43:34 +08:00
Petar Karadzhov
dc4c72c85c
[BUG] [dart-dio] Support for Analyzer configuration options changes in Dart 3 (#17099) 2023-11-18 12:46:03 +08:00
Robert Schweizer
5e7f2f274c
fix: Annotate free-form object as dict in Python (#17082) 2023-11-18 10:46:01 +08:00
William Cheng
d9920a5b81 update samples 2023-11-16 00:56:05 +08:00
Robert Schweizer
e47e7041f7
[python][Feat] Deserialize error responses (#17038)
* refactor: Clean up _response_types_map formatting

It matches black's behavior of having trailing commas now.

* test: Add test to reproduce #16967

* fix: deserialize responses even if no returnType

Closes #16967

* refactor: Simplify ApiException subclasses

* refactor: Move exception subtype choice to ApiException

* feat: Deserialize error responses and add to exceptions

* test: Add for error responses with model
2023-11-16 00:37:04 +08:00
Robert Schweizer
61fde48501
fix: Disable warnings for model_* properties (#17066)
For model classes with model_something fields, pydantic raises a warning by default:
`Field "model_something" has conflict with protected namespace "model_".`.

These warnings make no sense here, because most users of the generator have established APIs
that they cannot change to conform to pydantic's safety rules.

Pydantic will raise an error if we ever conflict with a current attribute like `model_dump`.
2023-11-14 21:50:35 +08:00
Rolf Rando
2ca958642b
Add socks5 proxy support for OpenAPI generated python client (#16918)
* add socks5 proxy support (requires additional import)

* updated examples

* build samples. updated to support pydantic python option

* rename sock to socks for correct protocol name

* add proxy headers for pydantic

* fixed param changes from conflict resolution
2023-11-14 12:28:05 +08:00
OliverTetzTT
d1b148a7d3
[python] added handling for boolean content type (#17020)
* added handling for boolean content type

* adapted addition to newer version of template

* [python] updated samples
2023-11-14 11:30:10 +08:00
William Cheng
53289263d9
Prepare v7.2.0 (#17050)
* update version to 7.2.0-SNAPSHOT

* update samples

* update doc
2023-11-13 18:53:20 +08:00
Ian Cubbon
c9f7af752f
Verify Path params that fall into the string bucket are supplied (#17032) 2023-11-13 11:02:33 +08:00
Robert Schweizer
65ccf0492c
fix: Raise exceptions on non-2xx responses (#16999) 2023-11-07 10:44:45 +08:00
William Cheng
74363a3eb8
Add tests for go generateMarshalJSON option (#16993)
* add tests for go generateMarshalJSON option

* update samples
2023-11-06 12:04:19 +08:00
Charles Treatman
db9fd9a094
[Go] validate required fields when unmarshalling JSON (#16863)
* validate required properties when unmarshalling JSON

* build project & update samples

* Add test for required field validation
2023-11-04 22:58:25 +08:00
Yohei Kitamura
61629ae8ed
[python] Add back __enter__ and __exit__ methods for non asyncio (#16979) 2023-11-04 16:54:17 +08:00
Kapil Gupta
c4b18f206d
[Server][Spring] fix support interface and implementation classes for API controllers (#16945)
* [Server][Spring] support interface and implementation classes for API controllers

* Omitted new string calls

* Added Log messages

* remove else

* Removed redundant if

* Update missed ;
2023-11-04 16:52:17 +08:00
ふぁ
1092593841
[python] add circular reference import (#16940)
* [python] add circular reference import

Signed-off-by: ふぁ <yuki@yuki0311.com>

* [python] update samples

Signed-off-by: ふぁ <yuki@yuki0311.com>

---------

Signed-off-by: ふぁ <yuki@yuki0311.com>
2023-11-02 22:14:20 +08:00