Codegen parameter for query json serialization (#21718)

* Add endpoints with query parameters that require Json-serialization

* Add property for query json-serialization

* Update samples

* Adjust indentation for specification
This commit is contained in:
Mattias Sehlstedt
2025-08-10 16:47:51 +02:00
committed by GitHub
parent 6ff9e67bad
commit 8874df4702
75 changed files with 4461 additions and 2 deletions

View File

@@ -121,6 +121,7 @@ Class | Method | HTTP request | Description
*QueryApi* | [**test_query_style_form_explode_true_array_string**](docs/QueryApi.md#test_query_style_form_explode_true_array_string) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
*QueryApi* | [**test_query_style_form_explode_true_object**](docs/QueryApi.md#test_query_style_form_explode_true_object) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
*QueryApi* | [**test_query_style_form_explode_true_object_all_of**](docs/QueryApi.md#test_query_style_form_explode_true_object_all_of) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
*QueryApi* | [**test_query_style_json_serialization_object**](docs/QueryApi.md#test_query_style_json_serialization_object) | **GET** /query/style_jsonSerialization/object | Test query parameter(s)
## Documentation For Models

View File

@@ -14,6 +14,7 @@ Method | HTTP request | Description
[**test_query_style_form_explode_true_array_string**](QueryApi.md#test_query_style_form_explode_true_array_string) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
[**test_query_style_form_explode_true_object**](QueryApi.md#test_query_style_form_explode_true_object) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
[**test_query_style_form_explode_true_object_all_of**](QueryApi.md#test_query_style_form_explode_true_object_all_of) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
[**test_query_style_json_serialization_object**](QueryApi.md#test_query_style_json_serialization_object) | **GET** /query/style_jsonSerialization/object | Test query parameter(s)
# **test_enum_ref_string**
@@ -700,3 +701,73 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **test_query_style_json_serialization_object**
> str test_query_style_json_serialization_object(json_serialized_object_ref_string_query=json_serialized_object_ref_string_query, json_serialized_object_array_ref_string_query=json_serialized_object_array_ref_string_query)
Test query parameter(s)
Test query parameter(s)
### Example
```python
import openapi_client
from openapi_client.models.pet import Pet
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:3000
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost:3000"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.QueryApi(api_client)
json_serialized_object_ref_string_query = openapi_client.Pet() # Pet | (optional)
json_serialized_object_array_ref_string_query = [openapi_client.Pet()] # List[Pet] | (optional)
try:
# Test query parameter(s)
api_response = api_instance.test_query_style_json_serialization_object(json_serialized_object_ref_string_query=json_serialized_object_ref_string_query, json_serialized_object_array_ref_string_query=json_serialized_object_array_ref_string_query)
print("The response of QueryApi->test_query_style_json_serialization_object:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling QueryApi->test_query_style_json_serialization_object: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**json_serialized_object_ref_string_query** | [**Pet**](.md)| | [optional]
**json_serialized_object_array_ref_string_query** | [**List[Pet]**](Pet.md)| | [optional]
### Return type
**str**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Successful operation | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -2765,3 +2765,283 @@ class QueryApi:
)
@validate_call
def test_query_style_json_serialization_object(
self,
json_serialized_object_ref_string_query: Optional[Pet] = None,
json_serialized_object_array_ref_string_query: Optional[List[Pet]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> str:
"""Test query parameter(s)
Test query parameter(s)
:param json_serialized_object_ref_string_query:
:type json_serialized_object_ref_string_query: Pet
:param json_serialized_object_array_ref_string_query:
:type json_serialized_object_array_ref_string_query: List[Pet]
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_query_style_json_serialization_object_serialize(
json_serialized_object_ref_string_query=json_serialized_object_ref_string_query,
json_serialized_object_array_ref_string_query=json_serialized_object_array_ref_string_query,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def test_query_style_json_serialization_object_with_http_info(
self,
json_serialized_object_ref_string_query: Optional[Pet] = None,
json_serialized_object_array_ref_string_query: Optional[List[Pet]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[str]:
"""Test query parameter(s)
Test query parameter(s)
:param json_serialized_object_ref_string_query:
:type json_serialized_object_ref_string_query: Pet
:param json_serialized_object_array_ref_string_query:
:type json_serialized_object_array_ref_string_query: List[Pet]
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_query_style_json_serialization_object_serialize(
json_serialized_object_ref_string_query=json_serialized_object_ref_string_query,
json_serialized_object_array_ref_string_query=json_serialized_object_array_ref_string_query,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def test_query_style_json_serialization_object_without_preload_content(
self,
json_serialized_object_ref_string_query: Optional[Pet] = None,
json_serialized_object_array_ref_string_query: Optional[List[Pet]] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)],
Annotated[StrictFloat, Field(gt=0)]
]
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""Test query parameter(s)
Test query parameter(s)
:param json_serialized_object_ref_string_query:
:type json_serialized_object_ref_string_query: Pet
:param json_serialized_object_array_ref_string_query:
:type json_serialized_object_array_ref_string_query: List[Pet]
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._test_query_style_json_serialization_object_serialize(
json_serialized_object_ref_string_query=json_serialized_object_ref_string_query,
json_serialized_object_array_ref_string_query=json_serialized_object_array_ref_string_query,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "str",
}
response_data = self.api_client.call_api(
*_param,
_request_timeout=_request_timeout
)
return response_data.response
def _test_query_style_json_serialization_object_serialize(
self,
json_serialized_object_ref_string_query,
json_serialized_object_array_ref_string_query,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {
'json_serialized_object_array_ref_string_query': 'csv',
}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
# process the query parameters
if json_serialized_object_ref_string_query is not None:
_query_params.append(('json_serialized_object_ref_string_query', json_serialized_object_ref_string_query))
if json_serialized_object_array_ref_string_query is not None:
_query_params.append(('json_serialized_object_array_ref_string_query', json_serialized_object_array_ref_string_query))
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[
'text/plain'
]
)
# authentication setting
_auth_settings: List[str] = [
]
return self.api_client.param_serialize(
method='GET',
resource_path='/query/style_jsonSerialization/object',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth
)