You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at official AWS SDKs for other languages (the official PHP SDK does not returned typed responses and so cannot be used as comparison), here is how they represent it:
Based on that analysis and to be idiomatic to PHP, I suggest represent document shapes as a native PHP value and using bool|string|int|float|null|list<mixed>|array<string, mixed> as phpdoc type (bool|string|int|float|null|array as native type).
The text was updated successfully, but these errors were encountered:
AWS has some services where they accept an arbitrary JSON document (older services with such need were using a string property containing a JSON string, but this causes double JSON encoding when the main serialization is also JSON).
The metadata file represents that as a shape with no member and a
document: true
property: https://github.com/aws/aws-sdk-php/blob/33f6d393834053b11a5fc10573a211d92e61c2db/src/data/bedrock-runtime/2023-09-30/api-2.json#L970-L974Looking at official AWS SDKs for other languages (the official PHP SDK does not returned typed responses and so cannot be used as comparison), here is how they represent it:
Document
class provided in their core package, with accessors to check the type of the value and read it in this type (with a hook in the JSON unmarshaller to decode it in a custom way): https://github.com/aws/aws-sdk-net/blob/09201e894db71b5d536db6cb0975f361b85f1f52/sdk/src/Core/Amazon.Runtime/Documents/Document.csDocument
interface in their core package, with internal implementations for each type of JSON values: https://github.com/aws/aws-sdk-java-v2/blob/033602390807ad60802b9752bb6518ab1e6102c6/core/sdk-core/src/main/java/software/amazon/awssdk/core/document/Document.java#L48. This SDK seems to use its own JSON representation (they have JsonNode) to handle the unmarshalled representation of JSON.Based on that analysis and to be idiomatic to PHP, I suggest represent document shapes as a native PHP value and using
bool|string|int|float|null|list<mixed>|array<string, mixed>
as phpdoc type (bool|string|int|float|null|array
as native type).The text was updated successfully, but these errors were encountered: