Git Product home page Git Product logo

Comments (6)

dktapps avatar dktapps commented on June 18, 2024

https://github.com/cuyz/valinor seems like a decent replacement

from pocketmine-mp.

ShockedPlot7560 avatar ShockedPlot7560 commented on June 18, 2024

https://github.com/cuyz/valinor seems like a decent replacement

After exploring the possibilities provided by this library :

  1. The rewriting of JsonMapper -> Valinor works very well, the structure is practically the same with similar functions.
  2. It is not possible to tag properties as optional unless you create a constructor with optional parameters for each class mapping (annoying).
  3. Customisation and configuration seem simpler, allowing more things to be done
  4. It isnt possible to deal with objet, only array or file is allowed.

The only current limitation I can see is the inability to tag properties as optional.

from pocketmine-mp.

dktapps avatar dktapps commented on June 18, 2024

It is not possible to tag properties as optional unless you create a constructor with optional parameters for each class mapping (annoying).

My understanding was that properties with default values are considered optional, am I wrong? AFAIK it should work pretty much seamlessly with the existing models (caveat: I have not tested)

from pocketmine-mp.

ShockedPlot7560 avatar ShockedPlot7560 commented on June 18, 2024

What i've tested is to create a constructor with all value at null by default. If its different than null, setting the properties.

I havent tested with direct default value in the properties.
The annoying side of this stay in the need to write all this constructor or default value in properties (which can cause unexpected bug if its set directly)

from pocketmine-mp.

dktapps avatar dktapps commented on June 18, 2024

I think the current JSON models already set default values for all optional stuff anyway, so it shouldn't be an issue.

I wouldn't worry about the constructor stuff. We don't manually construct the model objects anyway.

from pocketmine-mp.

ShockedPlot7560 avatar ShockedPlot7560 commented on June 18, 2024

I think the current JSON models already set default values for all optional stuff anyway, so it shouldn't be an issue.

Is it null ?

from pocketmine-mp.

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.