Closed ofalvai closed 2 months ago
Hello, thanks for the report!
I think the issue is that the netlify schema verifies the structure of a record, but std.serialize 'Toml
will produce a string. Thus, it seems the example is indeed wrong, and we should apply the schema before serializing (notice the parentheses around the config and the contract application)
files."netlify.toml".content = std.serialize 'Toml ({
build.command = "gatsby build",
build.publish = "public/",
} | netlify_schema)
Or, maybe slightly more readable:
files."netlify.toml".content =
let config | netlify_schema = {
build.command = "gatsby build",
build.publish = "public/",
}
in
std.serialize 'Toml config,
If I try that, I now get a contract error missing required field backend
. Which still makes the example wrong, but at least the schema check seems to trigger :upside_down_face:
Thank you @yannham, it's now working with my specific schema and file content! 🙂
Good :slightly_smiling_face: let's keep this issue open until we fix the documentation.
Thanks for catching that. I indeed managed to write something twice wrong for two independent reasons in 6 lines of code (I guess I'm a good userbase for Nickel :smile: )
I've opened #197 to provide a better and working example
I tried to generate a file conforming to one of the schemas in the schemastore repo, but ran into an
error: contract broken by a value: value is not of type Record
error.To make sure it's not a problem with the specific schema, I also tried running the
netlify.toml
example in the docs. It fails with the same error, here is the full output:My
flake.lock
file: