Open devlounge opened 1 month ago
Thanks for the clear steps to reproduce!
There may have been a reason it was implemented this way, but if someone wants to try to convert the parse()
results into keyword arguments that may make this more robust:
Alternatively, datafiles
could raise an exception when the field ordering does not match the pattern.
Or we simply call out this gotcha in the documentation.
I'm open to suggestions!
It looks to me that the order in which the dataclass fields are declared is super important.
Example directory structure:
Datafile definition:
When running:
It ends up raising:
FileNotFoundError: [Errno 2] No such file or directory: '/project/configuration/environments/server-1/config/servers/dev/server.yaml'
This seems to come from when the manager.all method does yield self.get(*values) with values ["server-1", "dev"] which ends up building the path posted above as manager.get iterates on the fields in the order they are declared and sets the values accordingly.
If I declare:
It works.