feat: Abort build if config file contains invalid keys. #823
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #822 (Maybe)
fix(example): Remove extra
openfield from example config file.feat: Reject aditional fields in schema.
fix: Flatten
Corefor schema generation.fix: Actually deny unknown fields in schema.
The change is a workaround the conflict of
#[serde(flatten)], and#[serde(deny_unknown_fields)].There is a downside of this workaround which may be undesired. Since we use the remaining top level fields to initialize
Core, there is no way to flatten multiple structures at the top level without increasing complexity quite a bit (At least i couldn't find an easy way). While it is unlikely we will have a many structs that are flattened at the top level, it is still something worth mentioning.Example error message:
The config file that caused the error:
When the incorrect field
random_fieldis moved to the top the error turns into:While the PR is in a working state, I haven't bothered with writing testing yet as I had a few problems.
Core's dist field is not being used from what I can tell. Perhaps its a seperate issue but I'm mainly asking since if the intention is to removeCore, and just useBuild. In that case this whole PR should be much simpler.schema.jsonis correct. Any of the tools I tried give errors before and after the PR. Taking a look at the file things look fine, but I would be happy if someone is able to verify the generated schema. (I also tried with the yaml config in the examples, still had schema errors)As mentioned above this is a workaround, I was able to come up with based on the docs of the attribute macro for flatten. So if the PR is closed due it being a workaround I would completely understand.