Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,17 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
op.vendorExtensions.put("x-comment-type", "void");
}
// Create a variable to add typing for return value of interface
if (op.returnType != null) {
if ("bool".equals(op.returnType)) {
op.vendorExtensions.put("x-return-type", "bool");
} else if ("UploadedFile".equals(op.returnType)) {
op.vendorExtensions.put("x-return-type", "string");
} else if ("int".equals(op.returnType)) {
op.vendorExtensions.put("x-return-type", "int");
} else if ("float".equals(op.returnType)) {
op.vendorExtensions.put("x-return-type", "float");
} else if ("string".equals(op.returnType)) {
op.vendorExtensions.put("x-return-type", "string");
} else if (op.returnType != null) {
op.vendorExtensions.put("x-return-type", "array|object|null");
} else {
op.vendorExtensions.put("x-return-type", "void");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ class Controller extends AbstractController
return 'application/xml';
}

if (in_array('*/*', $accept)) {
return $produced[0];
}

// If we reach this point, we don't have a common ground between server and client
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ class JmsSerializer implements SerializerInterface
*/
public function serialize($data, string $format): string
{
return SerializerBuilder::create()->build()->serialize($data, $this->convertFormat($format));
$convertFormat = $this->convertFormat($format);
if ($convertFormat !== null) {
return SerializerBuilder::create()->build()->serialize($data, $convertFormat);
} else {
return is_string($data) ? $data : var_export($data, true);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ public function deleteOrder(
* @param int &$responseCode The HTTP Response Code
* @param array $responseHeaders Additional HTTP headers to return with the response ()
*
* @return array|object|null
* @return int
*/
public function getInventory(
int &$responseCode,
array &$responseHeaders
): array|object|null;
): int;

/**
* Operation getOrderById
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ public function getUserByName(
* @param int &$responseCode The HTTP Response Code
* @param array $responseHeaders Additional HTTP headers to return with the response ()
*
* @return array|object|null
* @return string
*/
public function loginUser(
string $username,
string $password,
int &$responseCode,
array &$responseHeaders
): array|object|null;
): string;

/**
* Operation logoutUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ protected function getOutputFormat(string $accept, array $produced): ?string
return 'application/xml';
}

if (in_array('*/*', $accept)) {
return $produced[0];
}

// If we reach this point, we don't have a common ground between server and client
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ public function __construct()
*/
public function serialize($data, string $format): string
{
return SerializerBuilder::create()->build()->serialize($data, $this->convertFormat($format));
$convertFormat = $this->convertFormat($format);
if ($convertFormat !== null) {
return SerializerBuilder::create()->build()->serialize($data, $convertFormat);
} else {
return is_string($data) ? $data : var_export($data, true);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class StoreApi implements StoreApiInterface
/**
* Implementation of StoreApiInterface#getInventory
*/
public function getInventory(int &$responseCode, array &$responseHeaders): array|object|null
public function getInventory(int &$responseCode, array &$responseHeaders): int
{
// Implement the operation ...
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ class UserApi implements UserApiInterface
/**
* Implementation of UserApiInterface#loginUser
*/
public function loginUser(string $username, string $password, int &$responseCode, array &$responseHeaders): array|object|null
public function loginUser(string $username, string $password, int &$responseCode, array &$responseHeaders): string
{
// Implement the operation ...
}
Expand Down
Loading