Git Product home page Git Product logo

Comments (3)

jhalterman avatar jhalterman commented on July 3, 2024

Right now ModelMapper's validation is intended to verify that the structure of some class maps to the structure of another class, via the validate() method. It is possible that the source object you use might have some null values which obviously would result in null values being set on the destination, but ModelMapper will still copy those null values over as long as the source/destination properties are mapped.

Can you give me a better idea of what you had in mind for asserting things?

from modelmapper.

vishalmanohar avatar vishalmanohar commented on July 3, 2024

I was thinking on the lines of code generation for asserts so that the developer knows exactly how things are getting mapped. Also, refactorings like field name changes can be guarded with the tests.

from modelmapper.

jhalterman avatar jhalterman commented on July 3, 2024

I think that code gen for assertions is outside the scope of ModelMapper for now. I would like to support any sort of validation that can be done without code gen, but code gen adds more complexity for users than I'd like.

I would encourage you to take a stab at building and publishing your own extension/library for this though. If you do, let me know when it's completed and I'll link to it on the site :)

from modelmapper.

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.