-
-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Description
Hi!
I'm currently working on rewriting the PHP Laravel OpenAPI generator (merge request here). I was planning on using this package to handle serialization and deserialization. However, I'm running into an issue and I was hoping you could help me!
I am generating classes such as this one for OpenAPI schemas which specify an oneOf.
#[Serde\ClassSettings(renameWith: Cases::snake_case)]
class GetClientProducts200Response
{
public function __construct(
public \OpenAPI\Server\Model\ClientProduct|\OpenAPI\Server\Model\ClientCustomPackage $getClientProducts200ResponseInner,
) {}
}And in my generated controller I will then try and serialize it using Serde:
if ($apiResult instanceof \OpenAPI\Server\Model\GetClientProducts200Response) {
return response()->json($this->serde->serialize($apiResult, format: 'array'), 200);
}However, Serde currently does not support serializing union types. Could you think of a workaround for this use case? I'd really like to use this package in the generator.
Thanks in advance!
Gijs
Metadata
Metadata
Assignees
Labels
No labels