GithubHelp home page GithubHelp logo

Comments (6)

dmcclory avatar dmcclory commented on August 30, 2024

@di, what's happening is, we're initializing a Vlad object inside a function, like so: (in a python notebook)

def run_validators():
    Vlad(source=LocalFile(_output_path('plan_benefits.csv')), validators=FunValidator.validators).validate()

if there's a problem, the output looks correct the first time we call run_validators:

ERROR:vlad_logger:  SetValidator failed 4 time(s) on field: 'Subject to Cool Thing?'
ERROR:vlad_logger:    Invalid fields: ['YES', 'N/A']

if we run the same function again & again though, the error counts start increasing. (And the UniquenessValidators start to break)

ERROR:vlad_logger:  SetValidator failed 8 time(s) on field: 'Subject to Cool Thing?'
ERROR:vlad_logger:    Invalid fields: ['YES', 'N/A']
ERROR:vlad_logger:  UniqueValidator failed 40296 time(s) on field: 'Plan ID'
ERROR:vlad_logger:    Invalid fields: ['('fjsdlfjdsf', '30', '2')', '('dfklsdjfdf', '47', '2')', '('sdfjdskfjd', '28', '2')', '('sdkfjdfdk', '41', '2')'.....

from vladiate.

di avatar di commented on August 30, 2024

I think doing validators=copy.deepcopy(CignaPlanBenefitInfoValidator.validators) instead will solve this issue.

from vladiate.

dmcclory avatar dmcclory commented on August 30, 2024

Yeah, I'll definitely try that out. It requires a lot of knowledge about Vladiate though.

I think this would be nicer API:

PlanInfoValidator(source=LocalFile(_output_path('plan_info.csv'))).validate()

from vladiate.

csojinb avatar csojinb commented on August 30, 2024

Is there any reason why you'd want to pass validators into a new Vlad with state already attached? If not, we could flush them or something in the Vlad instatiation.

from vladiate.

di avatar di commented on August 30, 2024

I decided this is a bug, because it is using the default validators argument (an empty dict) without checking to see if the class variable exists or not. Pushing a fix shortly.

from vladiate.

di avatar di commented on August 30, 2024

Is there any reason why you'd want to pass validators into a new Vlad with state already attached?

I guess if you wanted to override them for some reason, you would expect to be able to do this.

from vladiate.

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.