Code Monkey home page Code Monkey logo

Comments (3)

hardeker avatar hardeker commented on July 20, 2024 1

I just had a look at the Python bindings. The json library commonly used in Python does differentiate between int and float. If the number contains a dot, it is considered as a float, otherwise, it is considered as an int. Thus, the problem does not appear in Python.

from govpp.

hardeker avatar hardeker commented on July 20, 2024

I will have a look at other VPP bindings generators to see how they react to that.

from govpp.

ondrej-fabry avatar ondrej-fabry commented on July 20, 2024

I have played around a bit with this and so far it seems the library we are using to process JSON does not seem to be flexible for parsing numbers. There is MustGetUint64 method, but it does not return the correct number, most likely due incorrect conversions.

I also tried standard encoding/json to parse number with max uint64 value and I was able to properly parse it only when decoding the value directly into uint64 variable or decoding into json.Number (practically a string) and then using strconv.ParseUint to convert it into uint64, because the json.Number only has Float64 and Int64 methods for quick conversion.

I don't want to spend much more time than I already did, but I plan to come back to this issue later after I am done with other more urgent matters. The default option for field is not used anywhere in the GoVPP beside being set as struct tag in the generated bindings and also there is no case that I know of in the official VPP API that has the default set to max uint64.

Anyone is welcome to take a shot and open PR if you find a fix for this.

from govpp.

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.