json-spec icon indicating copy to clipboard operation
json-spec copied to clipboard

problem with FilesystemProvider resolving lookup in __get_item__

Open mdmiller53 opened this issue 9 years ago • 2 comments

in __get_item__(), when the spec portion of the uri is obtained, the ':' is not stripped. this results in a key error on line 138: return self.data[spec]

mdmiller53 avatar Feb 08 '16 18:02 mdmiller53

@mdmiller53 can you give an example of breaking uri?

johnnoone avatar Feb 09 '16 16:02 johnnoone

@johnnoone i defined the prefix like: provider = FilesystemProvider(json_config['api_config_dir'], 'cur:config')

then the file i wanted to reference was named 'test_cohort_api.json'. the problem looks like it doesn't matter how the files are named, it's a one off error in: spec = uri[len(self.prefix):] len(self.prefix) is where the delimiter ':' will be in front of the file name prefix, so it is included in spec. that takes 'cur:config:test_cohort_api' and returns ':test_cohort_api' and causes the lookup in the map to fail. (i used aliases to work around this)

by the by, thanks for the package, it's been handy.

mdmiller53 avatar Feb 09 '16 16:02 mdmiller53