Giter Club home page Giter Club logo

sdk-php's People

Contributors

cesarkohl avatar disc avatar duglin avatar grahamcampbell avatar harrisonde avatar jlaswell avatar rubenrangel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdk-php's Issues

JsonDeserializer can't handle all RFC3339 timestamps

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

[Question] PHP->Go and vice versa

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)

Version

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 ?

Unable to parse 7 digit precision in the "time" field

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.