recent commit 40894382fc9fe959f3beacd20cfd6421eaf840b0 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.
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
* add asJsonObject method to OAIEnum class to fix enum handling in query parameters
* update samples
---------
Co-authored-by: William Cheng <wing328hk@gmail.com>
* [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.
* [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
* Chores : update $request->bool to $request->boolean
$request->bool is not a laravel function should be $request->boolean()
* Chores : update FakeController.php $request->boolean()
* [kotlin] Added path sanitization in javadoc comments
* added sample as regression test
* Added samples/client/others/kotlin-jvm-okhttp-path-comments to github workflow
* Make all Java ApiClients in templates extendable
* Make all Java ApiClients in samples extendable
* Fix compilation of enum constructor
* Fix compilation of enum constructor in templates
Static analysis tools such as PHPStan report errors when dynamic calls are used
for static methods.
```
ERROR Dynamic call to static method PHPUnit\Framework\Assert::assertEquals().
```
According to the source code of PHPUnit
(https://github.com/sebastianbergmann/phpunit/blob/9.5.0/src/Framework/Assert.php)
the function is indeed static.
```php
public static function assertTrue($condition, string $message = ''): void
```
This change updates to PHP Flight test template `register_routes_test.mustache`
to use static calls for PHPUnit assertions.
* [cpp-rest-sdk] support serializing models as parameters
This fixes the code generation for the cases where the model is referenced as a parameter
* [cpprest-sdk] avoid newlines when no model import
* feature: implement deepObject query params as per documentation.
ClosesOpenAPITools/openapi-generator#19342.
* chore: regenerate samples.
* chore: symplify code (via @joscha)
* chore: regenerate samples
* test: add integration test for typescript-angular deepObject query params
* fix: typo in the integration tests path
* chore: use node v18 for integration tests
* chore: make ES6 compliant
* chore: make test name semantically accurate
* chore: regenerate samples
* test: add angular v16 deep-object test
* chore: delete previous bespoke test for deep objects (uses test introduced in 71629f8d9a instead)
* chore: restore missing OAS for deep object API tests
* test: move angular deepObject tests to v19 and delete v16 ones
* test: atomic deepObject test on service rather than integration with app component
* chore: clean up superfluous import
* [cpp-rest-sdk] fix finding of the crypto libraries
This fixes finding of the crypto for cpprest sdk via find_library. It also bumps the minimum CMake version to 3.10 to avoid deprecation warnings
* docs: add myself as a technical committee member
The dev container fails to build because of the outdated docker-in-docker feature. This updates the docker-in-docker and fixes the build. I also updated the docker compose references in the docs.
* Optimize HashSet Initialization
Noticed this while debugging - we can avoid wasting memory/cpu creating 16 buckets when we only need one or a few.
* generate samples
* use Arrays.asList
* fix spring multipart optional parameters
* use optional only in not required params
* remove debug line
---------
Co-authored-by: Jaime Sanchez <jaime.sanchezf@externos.santalucia.es>
Co-authored-by: William Cheng <wing328hk@gmail.com>