Git Product home page Git Product logo

streamy-dart's Introduction

This package is deprecated

Consider the following alternatives:

  • built_value provides advanced features for building any Dart client for JSON-speaking APIs
  • googleapis is a collection of pregenerated clients to various pubilc Google APIs.
  • gRPC is a high-performance, open-source universal RPC framework (https://grpc.io/)

What was Streamy?

Streamy was a JSON RPC framework for applications written using Dart programming language. It generated a Dart client library from a Google API Discovery file.

streamy-dart's People

Contributors

adam-singer avatar alxhub avatar azenla avatar cbracken avatar gsadams avatar jacob314 avatar justinfagnani avatar mary-poppins avatar matanlurey avatar srawlins avatar tvolkert avatar yjbanov avatar zachconrad 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

streamy-dart's Issues

streamy does not permit assigning null to list fields

An attempt at doing so results in this:

Unhandled exception:
The null object does not have a getter 'iterator'.

NoSuchMethodError : method not found: 'iterator'
Receiver: null
Arguments: []
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#1      List.addAll (dart:core-patch/growable_array.dart:186)
#2      ObservableList.addAll (package:observe/src/observable_list.dart:144:17)
#3      ObservableList.ObservableList.from (package:observe/src/observable_list.dart:42:38)

StreamTracer breaks when RPC finishes unsuccessfully, e.g. with HTTP 500

Error details:

Bad state: Cannot add new events after calling close

STACKTRACE:
#0 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:217)
#1 _StreamTrace.record (package:streamy/lib/runtime/tracing.dart:50:20)
#2 Multiplexer._sendRpc. (package:streamy/lib/runtime/multiplexer.dart:135:23)
#3 Multiplexer._removeActive (package:streamy/lib/runtime/multiplexer.dart:239:40)
#4 Multiplexer._newActiveStream. (package:streamy/lib/runtime/multiplexer.dart:83:51)
#5 _Future._propagateToListeners. (dart:async/future_impl.dart:485)
#6 _rootRun (dart:async/zone.dart:720)
#7 _ZoneDelegate.run (dart:async/zone.dart:438)
#8 _onRun. (package:angular/lib/core/zone.dart:62:63)
#9 NgZone._onRunBase (package:angular/lib/core/zone.dart:49:16)
#10 _onRun (package:angular/lib/core/zone.dart:62:22)
#11 _ZoneDelegate.run (dart:async/zone.dart:438)
#12 _CustomizedZone.run (dart:async/zone.dart:657)
#13 _Future._propagateToListeners (dart:async/future_impl.dart:449)
#14 _Future._complete (dart:async/future_impl.dart:302)
#15 _Future._asyncComplete. (dart:async/future_impl.dart:358)
#16 _rootRun (dart:async/zone.dart:720)
#17 _ZoneDelegate.run (dart:async/zone.dart:438)
#18 _onScheduleMicrotask. (package:angular/lib/core/zone.dart:70:39)
#19 _rootRun (dart:async/zone.dart:725)
#20 _ZoneDelegate.run (dart:async/zone.dart:438)
#21 NgZone._finishTurn (package:angular/lib/core/zone.dart:95:23)
#22 NgZone._onRunBase (package:angular/lib/core/zone.dart:57:20)
#23 _onRun (package:angular/lib/core/zone.dart:62:22)
#24 _ZoneDelegate.run (dart:async/zone.dart:438)

Provide example of Google Discovery format for own servers

Hi, README.md file says that Google Discovery format is suitable for "own APIs hosted on own servers". Haven't found any example. Please, could you provide a reference to any relevant example? What are requirements to server-side implementation to support the same set of features listed in the README.md? Thanks!

Allow adding "local" fields to all objects of the same type

The idea is to provide a way to say "I want all entities of type 'Foo' to have field 'bar', which is a computation on ..."

Sample usage:

// Makes field named 'bar' available to all entities of type 'Foo'
// and its value is a computation on fields 'a' and 'b'. This would
// be done during the initialization of the app.
Foo.addCommonLocalField('bar', (Foo entity) => entity.a + entity.b);

// In any other part of the code a developer could do this
Foo e = new Foo()  // note that we're not setting 'bar' explicitly
  ..a = 1
  ..b = 3;
expect(e.local['bar'], 4);  // and yet it is available

Handle 204 responses correctly

A 204 response from a HTTP DELETE request is not handled correctly. The response body of a 204 is empty, but Streamy attempts to parse it, throwing a FormatException in the JsonParser.

Wrap genapi.dart as a barback transformer

It would be nice to define how to generate the API from pubspec.yaml, either from a local .json discovery file or from a URL:

transformers:
  streamy:
    discovery_services: [
      "prefetched_discovery_files/auth_service.json",
      "https://www.googleapis.com/discovery/v1/apis/urlshortener/v1/rest"
    ]

Writing & bundling a transformer is very simple, happy to give it a go if that's a feature that makes sense to you guys :-)

If the API name is the same as the schema object name, then Streamy generates two classes with the same name

I've just used Streamy to generate the code to talk to the Google Calendar API.

https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest

The API is called Calendar, and the schema object is also called Calendar. So, I end up with generated code including:

class Calendar extends base.EntityWrapper {
....
}

class Calendar extends base.Root {
...
}

As you can imagine, this causes unhappiness when the Streamy API layer is used.

Provide a facility to automate retrying

It would be nice if the caller were able to specify a list of return codes (504, etc.) that would trigger an automatic retry. This way, if there's a temporary resource issue, it won't force the user of the app to reload the entire page to work around it, or require custom code all over the app to do it everywhere Streamy is called.

error importing files

streamy-dart # /home/albertog/dart/dart-sdk/bin/dart bin/apigen.dart --discover_file=urlshortener.json --client_file=urlshortener.dart --library_name=urlshortener
Unable to open file: /home/albertog/Documents/streamy-dart/bin/packages/args/args.dart'file:///home/albertog/Documents/streamy-dart/bin/apigen.dart': error: line 2 pos 1: library handler failed
import 'package:args/args.dart';
^

windows7 32bits

anything happend

when in run app to generate lib not happend anything only show again and again the paremeters message but not error, not messages and of course not generate lib anything. I do not what solve problemn.

casa bin # ./dart /home/albertog/streamy-dart/bin/apigen.dart --client-file-name=aa.dart --discovery-file=urlshortener.json --output-dir=url

-c, --client-file-name Prefix for the .dart files generated.
-d, --discovery-file Path to the discovery file.
-o, --output-dir Directory for the generated client library package.
-a, --addendum-file Path to addendum to the discovery file.
-t, --templates-dir Directory containing code templates.
(defaults to "templates")

-v, --package-version Version to be specified in the generated pubspec.yaml
(defaults to "0.0.0")

--local-streamy-location    Path to a local Streamy package. If specified the local version will be used instead of pub version.

apigen crashes with Class '_LocalClassMirror' has no instance getter 'members'.

When running

dart bin/apigen.dart -d urlshortener.json -o shortener

I get

Unhandled exception:
Class '_LocalClassMirror' has no instance getter 'members'.

NoSuchMethodError : method not found: 'members'
Receiver: Instance of '_LocalClassMirror'
Arguments: []
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#1      _Template._getNamedProperty (package:mustache/template.dart:162:29)
#2      _Template._resolveValue (package:mustache/template.dart:132:30)
#3      _Template._renderVariable (package:mustache/template.dart:179:30)
#4      _renderNode (package:mustache/template.dart:101:20)
#5      List.forEach (dart:core-patch/growable_array.dart:240)
#6      _Template._renderSectionWithValue (package:mustache/template.dart:197:24)
#7      _Template._renderSection.<anonymous closure> (package:mustache/template.dart:206:48)
#8      List.forEach (dart:core-patch/growable_array.dart:240)
#9      _Template._renderSection (package:mustache/template.dart:206:17)
#10     _renderNode (package:mustache/template.dart:107:19)
#11     List.forEach (dart:core-patch/growable_array.dart:240)
#12     _Template._renderSectionWithValue (package:mustache/template.dart:197:24)
#13     _Template._renderSection.<anonymous closure> (package:mustache/template.dart:206:48)
#14     List.forEach (dart:core-patch/growable_array.dart:240)
#15     _Template._renderSection (package:mustache/template.dart:206:17)
#16     _renderNode (package:mustache/template.dart:107:19)
#17     List.forEach (dart:core-patch/growable_array.dart:240)
#18     _Template.render (package:mustache/template.dart:89:25)
#19     _Template.renderString (package:mustache/template.dart:80:9)
#20     _InternalTemplate.render (package:streamy/generator/emitter.dart:655:41)
#21     _Emitter.processObjectType (package:streamy/generator/emitter.dart:283:19)
#22     _Emitter.processType (package:streamy/generator/emitter.dart:242:26)
#23     _Emitter.generate.<anonymous closure> (package:streamy/generator/emitter.dart:142:18)
#24     _HashMap&_LinkedHashMapMixin.forEach (dart:collection-patch/collection_patch.dart:965)
#25     _Emitter.generate (package:streamy/generator/emitter.dart:141:36)
#26     emitCode (package:streamy/generator/emitter.dart:4:32)
#27     generateStreamyClientLibrary (package:streamy/generator_utils.dart:39:11)
#28     main (file:///usr/local/google/home/polux/projects/streamy-dart/bin/apigen.dart:17:31)
#29     _startIsolate.isolateStartHandler (dart:isolate-patch/isolate_patch.dart:214)
#30     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:115)

Add containsDeepKey to Entity

(logging this request on behalf of @irfantusneem from an offline conversation)

In Streamy entities are nested within entities. Currently, you can use operator[] with a deep key, e.g. e["a.b"] fetches e.a.b in a null-safe manner. However, there's no way to check if key "a.b" exists. We need a "contains" method that complements the behavior of operator[].

ComparableMap extends HashMap

While you can currently let ComparableMap extend HashMap, it's likely to not be possible in the future.
I recommend delegating to an internal Map instead of extending HashMap. That will also make it work for any Map, not just HashMap.

Support Transactional APIs via a Batch interface.

Per alk@'s API proposal for transactions, Streamy needs to support batching and sending multipart requests together in a single transaction.

I have some ideas for how this might work and will be implementing them in Streamy so we can hit the ground running with transactional support.

Remove generated addGlobal functions and *GlobalFn typedefs

With GlobalView.register the value of generated addGlobal functions and *GlobalFn typedefs is dubious, but they are guaranteed to waste valuable code size budget. Let's remove them.

This is an API breaking proposal, so let's postpone it till after 0.2 is released.

Ability to override hashCode and equals for a Streamy Entity

Would like to override hashCode and equals for a streamy entity? It is reasonable for it to throw an exception if someone attempts to override it more than once.

Ex:

var x = new AbcRef()..id = 1;
var y = new AbcRef()..id = 1
..name = 'hi';

It should be reasonable for x == y to be true since the id is the unique identifier of the object and name is a helper/computed field.

Separate resource, method and entity class namespaces

Streamy generates a request class for each API method by capitalizing method name and appending "Request" and using that as the request class' name. Unfortunately this leads to name conflicts if there is a schema object with the same name.

Streamy should split resources, methods and entities into separate libraries to avoid name conflicts.

Cleanup warnings/errors from Dart analyzer

As of now (9/9/14), there are 52 problems, 295 warnings, and 39 hints from Dart analyzer in a clean external copy of the Streamy master branch. Many are due to using dynamics without casting.

This should be cleaned up to make it easier / less scary for more contributors. I'll contribute, but I could use your help ๐Ÿ‘

null properties are serialized to JSON as missing keys

The implementation of toJson in RawEntity is flawed. Instead of serializing null properties as nulls, it simply removes them from JSON. This is wrong, because JSON is perfectly capable of expressing nulls and missing properties and Streamy already provides remove* methods to actually remove properties.

Utility function for observing deeply

Could we have a utility function that listens to all changes deep within an entity (to be used with caution, of course). Right now, we can only watch the top level using item.changes.listen. If I had these example classes:

class Item1 {
String attribute1;
Object2 attribute2;
}

class Item2 {
String attributeA;
Item2 attributeB;
List attributeC;
}

and I had an object:
Item1 objectX = new Item1();

If I wanted to watch for all changes in 'objectX', I could not just use objectX.changes.listen, because it would only observe changes in objectX.attribute1 and any additions or removals from objectX.attributeC. It would not observe changes to attributeB or any changes to existing Item2s in attributeC.

Please add a utility for listening to deep changes in an entity. Thanks.

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.