Git Product home page Git Product logo

thrift-clj's Issues

Working with unions

I'm fine playing around with structs, but when I add the following to the thrift file:

union Identity {
  1: string email;
  2: string ssn;
}

I can't instantiate the Identity union. It feels like I should be able to use:

(thrift/->thrift (map->Identity {:ssn "21582"}))

but this throws the error "Not an optional field: email"

Does the library currently support unions? If so, I'd be happy to add documentation to the readme.

No protocol version header

Thanks for your great work!
I encountered a problem and not sure what is the reason. I am using :binary protocol. It works well with Clojure server and client. But when trying with thriftpy client, it throws the error: cybin.ProtocolError: No protocol version header.

Below is the python client code I am trying. It works with the Java thrift server, but not Clojure server with thrift-clj.

import thriftpy
from thriftpy.rpc import make_client
api_thrift = thriftpy.load("./idl/api.thrift", module_name="myapi_thrift")
api_service = make_client(api_thrift.AService, '192.168.0.2', 9011)
print api_service.ping()

ClassCastException: Cannot convert String to ByteBuffer

In thrift IDL I have a struct with binary field

struct A {
 1: binary field;
}

What is correct way to create this field on server side?

For example to create binary from int I use

(doto (ByteBuffer/allocate 4)
  (.putInt (int 3))
  (.array)))

support for inherited services?

First, thanks for the work on this project - very useful and clean API with good docs/tests!

quick question: In the later versions of thrift, one can inherit in thrift services. Are there any plans to support this in the (near) future? Currently I receive various errors about namespace collisions when I import e.g. two services with the same inherited "base" service.

No default constructor for thrift types

Assuming I have a simple thrift struct

struct A {
 1: string a;
 2: i32 b;
} 

Generated class A.java have default constructor, but if I use (thrift/import (:types [A]))
no default constructor is available.

Though, it may be a useful as a restriction but prevent common way to fill java structure:

(doto (A.)
  (.setA "some)
  (.setB 42))

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.