hnn-core icon indicating copy to clipboard operation
hnn-core copied to clipboard

validate the keys of params file

Open jasmainak opened this issue 5 years ago • 4 comments

Sometimes, the correct key may not be used because of a typo. The params object should check and not allow any key.

jasmainak avatar Aug 28 '19 04:08 jasmainak

This would be useful. Also mentioned in https://github.com/jonescompneurolab/hnn/issues/22

blakecaldwell avatar Sep 25 '19 18:09 blakecaldwell

It could be a good first issue for @rythorpe

jasmainak avatar Sep 28 '19 19:09 jasmainak

@jasmainak Since I haven't encountered this problem myself, is the idea here to add a method referenced by Param.__init__(), Param.__getitem__(), and Param.__setitem__() that validates all new input keys according to a preconfigured set of possible param keys?

rythorpe avatar Mar 27 '20 02:03 rythorpe

yep, you would need to the validation only in setitem I think. You should raise ValueError etc. when the right parameters are not present or they are not in the right ranges. Since the param files are all converted to dictionary ultimately, you could probably use JSON schemas to make your life easier.

jasmainak avatar Mar 27 '20 06:03 jasmainak

This is no longer relevant as we are moving to create a new file format with @gtdang's work

ntolley avatar Jul 10 '24 20:07 ntolley