Giter VIP home page Giter VIP logo

Comments (9)

justinlindh-wf avatar justinlindh-wf commented on August 12, 2024

Note: I believe the workaround of just using strings works here, but obviously isn't preferred.

from frugal.

justinlindh-wf avatar justinlindh-wf commented on August 12, 2024

This diff seems to resolve the issue, but I'm not informed enough on thrift/frugal to say whether it would cause any problems elsewhere...

diff --git a/compiler/generator/golang/generator.go b/compiler/generator/golang/generator.go
index 216dafa..d5b82bd 100644
--- a/compiler/generator/golang/generator.go
+++ b/compiler/generator/golang/generator.go
@@ -2152,10 +2152,7 @@ func (g *Generator) isPointerField(field *parser.Field) bool {
        hasDefault := field.Default != nil
        switch underlyingType.Name {
-       case "binary":
-               // According to thrift, these are always like this, not sure why
-               return false
-       case "bool", "byte", "i8", "i16", "i32", "i64", "double", "string":
+       case "bool", "byte", "i8", "i16", "i32", "i64", "double", "string", "binary":
                // If there's no default, needs to be a pointer to be nillable
                return !hasDefault
        case "list", "set", "map":

from frugal.

tylertreat-wf avatar tylertreat-wf commented on August 12, 2024

@justinlindh-wf Thanks for the detailed issue. We will work on adding the patch.

from frugal.

natewoods-wf avatar natewoods-wf commented on August 12, 2024

Also, when @benechols-wf and I were testing this, we found compiled our client to use string fields and had a server using binary fields and we were able to successfully communicate between each other. Thus the Audit tool should be updated as well to allow binary <-> string type changes w/o raising an error.

from frugal.

tylertreat-wf avatar tylertreat-wf commented on August 12, 2024

@natewoods-wf there could be potential for issues there as string is encoded as UTF-8 and binary is an unencoded sequence of bytes.

from frugal.

natewoods-wf avatar natewoods-wf commented on August 12, 2024

+1

from frugal.

clarkrabel-wf avatar clarkrabel-wf commented on August 12, 2024

I also ran into this issue sending a pdf. String type does not work. When trying to open the pdf the conversion to string changes the number of bytes in the pdf. Then when parsing it, the library fails because the PDF streams are the incorrect length.

from frugal.

brianshannan-wf avatar brianshannan-wf commented on August 12, 2024

This appears to be a bug in thrift as well

from frugal.

tylertreat-wf avatar tylertreat-wf commented on August 12, 2024

Addressed in #586.

from frugal.

Related Issues (20)

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.