build icon indicating copy to clipboard operation
build copied to clipboard

chore: add JSON schema for `netlify.toml`

Open danez opened this issue 1 year ago • 7 comments

Summary

This PR adds a new JSON schema file for netlify.toml. A direct link to this file will be added to https://github.com/SchemaStore/schemastore. Most IDEs (vscode with extension, intellij) try to read schemas from this store.

In the future, the schema could even be used to validate the netlify.toml file in @netlify/config, as I saw right now we have some hardcoded validation in the code.

The new package is private for now, so even if we want to rename it later into maybe config-validation we can simply do this.

I added docs as reviewer, because I added a lot of links pointing to the docs and also copied most of the text from the docs.

Ref: https://github.com/netlify/pod-compute/issues/138

Kapture 2022-07-06 at 19 03 48

Screenshot 2022-07-06 at 19 16 12

Screenshot 2023-03-03 at 17 01 46 Screenshot 2023-03-03 at 17 07 39

A picture of a cute animal (not mandatory, but encouraged)

photo-1542736637-74169a802172

danez avatar Oct 07 '22 14:10 danez

@danez any updates on this one? Would love having autocompletion for the toml 😂

lukasholzer avatar Feb 02 '23 10:02 lukasholzer

~This pull request adds or modifies JavaScript (.js, .cjs, .mjs) files. Consider converting them to TypeScript.~ Thank you for converting JavaScript files to TypeScript 🎉"

github-actions[bot] avatar Mar 30 '23 12:03 github-actions[bot]

and the functions field on the build settings

The docs though say it should be this:

[functions]
  directory = "my_functions"

maybe [build] -> functions is the old way of doing it?

danez avatar Apr 14 '23 13:04 danez

and the functions field on the build settings

The docs though say it should be this:

[functions]
  directory = "my_functions"

maybe [build] -> functions is the old way of doing it?

mhm maybe @eduardoboucas can put some light on that?

lukasholzer avatar Apr 14 '23 13:04 lukasholzer

and the functions field on the build settings

The docs though say it should be this:

[functions]
  directory = "my_functions"

maybe [build] -> functions is the old way of doing it?

Looks like it was an older version of the config: https://github.com/netlify/build/blob/f1d8ebc03b95d1e614ce64ad4083c3f7eb420c7b/packages/config/src/functions_config.js#L12

I added it as deprecated.

danez avatar Apr 14 '23 15:04 danez

I solved all the review comments. I had to rebase because of conflicts, but all new changes are in separate new commits. starting with chore: add test for cache

danez avatar Apr 14 '23 15:04 danez

The config for edge functions is currently incorrect in the schema:

  • excludePattern, excludePath and pattern are missing from the schema
  • path is currently only allowed to be a string, but it can also be an array of strings

danez avatar Jul 14 '23 13:07 danez