GithubHelp home page GithubHelp logo

Comments (4)

evermeer avatar evermeer commented on August 27, 2024

Comparing the types before setting the values is not so easy. The dictionary from the json string will contain NSString, NSNumber, arrays and dictionary values. The object itself will have Swift.String, Swift,Int, Swift.Int64, Swift.Double, various enums and other values. The types are almost always different.

Besides that the check should also not break the workarounds that are in WorkaroundsTests.swift.

I would rather turn it around and also set the value when you are trying to put a number into a string. That would mean I only have to add 1 exception when setting the value. You have a property that has the same name in the json. the chance is big you want that json value in your object anyway.

from evreflection.

evermeer avatar evermeer commented on August 27, 2024

I have added the exception where a NSNumber can be set to a string property in the latest release 2.4.6. I would like to know what your idea is regarding that workaround. What objections could you thing of for solving it this way.

As an alternative I could also skip setting the value in the 2 specific situations (string to number and number to string) But then what happens when you have a string and someone forgot to set the quotes around a number in the json. I think I still favorite setting the value over not setting the value.

from evreflection.

kukudas avatar kukudas commented on August 27, 2024

Your solution is ok. The only objection i see right now is that it can cause confusion why this is possible.

from evreflection.

evermeer avatar evermeer commented on August 27, 2024

Thanks, then I will leave the fix as it is now.

from evreflection.

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.