Created by: githubERIK
PR checklist
-
Read the contribution guidelines. -
Ran the shell script under ./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first. -
Filed the PR against the correct branch: master
,4.1.x
,5.0.x
. Default:master
. Master should be🆗 . -
Copied the technical committee to review the pull request if your PR is targeting a particular programming language. @jebentier, @dkarlovi, @mandrean, @jfastnacht, @ackintosh, @ybelenko, @renepardon
Description of the PR
Fix https://github.com/OpenAPITools/openapi-generator/issues/2199
How to check the outcome
- Create an account → https://dashboard.messente.com/register
- Setup API username and password → https://messente.com/documentation/api-setup (click the green "Update" button to start using the credentials)
- Create a new composer project and run
composer require messente/messente-api-php
- Use the following code with correct credentials
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Messente\Api\Configuration;
use GuzzleHttp\Client;
use Messente\Api\Api\ContactsApi;
use Messente\Api\Model\ContactUpdateFields;
$config = Configuration::getDefaultConfiguration();
$config->setUsername('____');
$config->setPassword('____');
$api = new ContactsApi(new Client(), $config);
try {
$response = $api->createContact([
'phoneNumber' => '+37251000000',
'email' => 'anyone@messente.com',
'firstName' => 'Any',
'lastName' => 'One',
'company' => 'Messente',
'title' => 'Sir',
'custom' => 'Any custom',
'custom2' => 'Any custom two',
'custom3' => 'Any custom three',
'custom4' => 'Any custom four'
]);
echo $response.PHP_EOL;
echo '----'.PHP_EOL;
$response = $api->fetchContact('+37251000000');
echo $response.PHP_EOL;
echo '----'.PHP_EOL;
$updateFields = new ContactUpdateFields([
'lastName' => 'Johnson',
'custom2' => null,
]);
$response = $api->updateContact('+37251000000', $updateFields);
echo $response.PHP_EOL;
echo '----'.PHP_EOL;
} catch (Exception $e) {
echo 'Exception when calling the API: ', $e->getMessage(), PHP_EOL;
}
?>
and given "email", "firstName","lastName", "company", "title", "custom", "custom2","custom3", "custom4" are nullable:true
check that ...
When a request goes out
- field is nullable and value is null
-
✅ when somebody set the value to null on purpose then this should not be filtered out by ObjectSerializer -
✅ when somebody did not specify the value when using the constructor (causing the constructor to automatically set the value to null) then that null value should be filtered out
-
When a response comes in
- field is nullable and value is null
-
✅ echo $response should show all null values.
-