ccpgames / alviss

Configuration file reader with some nifty bells and whistles added
MIT License
0 stars 0 forks source link

Keys with dots not resolving correctly in some edge cases #6

Open CCP-Zeulix opened 1 month ago

CCP-Zeulix commented 1 month ago

The TL;DR version is that the format where nested keys are references (for overwriting in this case) in one key with dots instead of a nested mapping, isn't being "broken down" correctly in some cases.

The example here goes something like this:

First we have defaults.yaml:

runner:
  grpc:
    server:
      port: "[::]:50051"
  implementation:
    class_name: .impl.mock.MockGrpcService  

Then simple_grpc_service.yaml:

__extends__: defaults.yaml
runner.grpc:
  implementation.class_name: .impl.SimpleHelloService

And this should result in:

runner:
  grpc:
    server:
      port: "[::]:50051"
  implementation:
    class_name: .impl.SimpleHelloService

But instead this happens:

runner:
  grpc:
    server:
      port: '[::]:50051'
    implementation:
      class_name: .impl.mock.MockGrpcService
runner.grpc:
  implementation:
    class_name: .impl.SimpleHelloService

What's interesting is to see that there are TWO composite keys insimple_grpc_service.yaml, runner.grpc and then implementation.class_name and while the latter, resolves correctly into a nested implementation and class_name, the former remains a single key runner.grpc and thus the intended overwriting of class_name under runner / grpc / implementation does not happen.