linkml / linkml-validator

[retired]
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

TypeError: validate() got an unexpected keyword argument 'obj' #21

Closed plbremer closed 8 months ago

plbremer commented 8 months ago

Hello,

When attempting to replicate the behavior described in the docs

https://linkml.io/linkml-validator/usage/#using-linkml-validator-as-a-module

with something like

from linkml.validator import Validator

my_dict={
    'species':'Homo sapiens'
}

schema_path='/Users/pgleasonbremer/coding_projects/altos/altos-labs-ontology/src/alo/schema/alo.yaml'

my_Validator=Validator(schema=schema_path)

my_Validator.validate(
    obj=my_dict,
    target_class='DataPackage'
)

I get

Traceback (most recent call last):
  File "/Users/pgleasonbremer/coding_projects/altos/linkml/mwe_validator_broken.py", line 12, in <module>
    my_Validator.validate(
TypeError: validate() got an unexpected keyword argument `obj`

however, I get no error when changing the keyword to instance

my_Validator.validate(
    instance=my_dict,
    target_class='DataPackage'
)

I would submit a PR to fix it, but i looked at the source and it looks like validate expects keyword obj, so i was a little confused, thanks.

plbremer commented 8 months ago

wrong place