cloudevents / sdk-php Goto Github PK
View Code? Open in Web Editor NEWPHP SDK for CloudEvents
License: Apache License 2.0
PHP SDK for CloudEvents
License: Apache License 2.0
CloudEvent specification (https://github.com/cloudevents/spec/blob/main/cloudevents/formats/json-format.md#3-envelope) suggests to use media type application/cloudevents+json when event encoded to json.
Current implementation of setter forbid to set such type because of regexp:
https://github.com/cloudevents/sdk-php/blob/main/src/V1/CloudEventTrait.php#L158
Is it possible to solve this problem?
Per the June 2 call, the group decided to ask each repo in the CE org to switch from master
to main
as the default branch.
Just curious... it's been empty for a while now.
The TimeFormatter class causes error when deserializing CloudEvents. It does not accept all of the valid examples given in https://www.rfc-editor.org/rfc/rfc3339
The PHP RFC3339 implementation should probably be used instead.
Repro:
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Psr7\ServerRequest;
use CloudEvents\Serializers\JsonDeserializer;
$request = new ServerRequest(
'POST',
'',
[],
'{
"specversion": "1.0",
"type": "google.firebase.database.ref.v1.written",
"source": "//firebasedatabase.googleapis.com/projects/_/locations/europe-west1/instances/my-project-id",
"subject": "refs/gcf-test/xyz",
"id": "aaaaaa-1111-bbbb-2222-cccccccccccc",
"time": "1985-04-12T23:20:50.52Z",
"datacontenttype": "application/cloudevents+json",
"data": {
"data": {
"grandchild": "other"
},
"delta": {
"grandchild": "other changed"
}
}
}'
);
$event = JsonDeserializer::create()->deserializeStructured($request->getBody());
echo $event;
Results in:
PHP Fatal error: Uncaught ValueError: CloudEvents\Utilities\TimeFormatter::decode(): Argument #1 ($time) is not a valid RFC3339 timestamp in /usr/local/google/home/anniefu/code/testing/php/vendor/cloudevents/sdk-php/src/Utilities/TimeFormatter.php:37
We are going to use CE as base for negotiation between PHP based producers and go based consumers.
I know that there are a lot of CE adapters.But anyway - did you test compatibility between php serialization and go deserialization? (and vice versa)
Why is there no version of the ? I have set in composer.json "minimum-stability": "RC" and i am not able to install it. This package is only under developing ?
I was searching for similar issue and found #35, but this SDK still can't parse 7 digit precision in the timestamp, for example 2023-04-12T12:50:04.2121108Z
CloudEvents\Utilities\TimeFormatter::decode(): Argument #1 ($time) is not a valid RFC3339 timestamp
Interestingly, the 7 digit precision comes from CloudEvents C# SDK. One would assume these SDKs would be compatible.
Can something be done about this? Right now, I have to write a custom Denormalizer class which parses the timestamp and formats it back to 6 digit precision, before passing it to the original (included) denormalizer.
@jlaswell I saw https://github.com/cloudevents/sdk-php/projects/1#card-53275424 and was wondering if that ties into attribute extensions. Just trying to see what you're thinking with attribute validation in general and how that will play into this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.