Giter Site home page Giter Site logo

Comments (4)

robbkidd avatar robbkidd commented on May 20, 2024

I've reproduced in a draft PR the ultimate issue: a person cannot set a false value on a boolean field that has a default of true. @fchikwekwe and I were able to sort of work around this by flubbing the default: tag annotation syntax.

from defaults.

robbkidd avatar robbkidd commented on May 20, 2024

Updated the PR to demonstrate that a bool pointer is necessary to be able to have a boolean field that defaults to true and still be able for a user to set the field to false. If this is the only or best way to accomplish default-true booleans, we can open a new PR or update the existing one to not add tests but instead update the README documentation to warn users about defaulting a bool field to true and recommend using a *bool.

from defaults.

fchikwekwe avatar fchikwekwe commented on May 20, 2024

The scope of this issue is now to document the boolean pointer workaround in the README. I'll open a PR for that and link it shortly.

from defaults.

robbkidd avatar robbkidd commented on May 20, 2024

Then I discover #15 and #30 which describe the same situation. In addition to documenting "bool fields set to default:'true' will not behave how you might think!" would it be helpful for the library to warn or error when setting a field of type bool whose default is true?

from defaults.

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.