Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Machine-readable config description #17892

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e41a90d
Add basic JSON Schema for Synapse’s configuration
V02460 Oct 21, 2024
a547145
Add descriptions and examples
V02460 Oct 22, 2024
048b619
Add worker section
V02460 Oct 31, 2024
5a299f1
Initial script
V02460 Oct 23, 2024
85ac15d
Improve defaults
V02460 Oct 31, 2024
6de8466
Add section headers
V02460 Oct 31, 2024
5688f0f
Generate documentation from schema
V02460 Oct 31, 2024
fb6a876
Add newsfragment
V02460 Oct 31, 2024
2dddfdf
Merge branch 'develop' into schema
V02460 Nov 5, 2024
9b57816
Fix link to config documentation
V02460 Nov 5, 2024
fecddae
Tweak script so it actually runs (perhaps specific to Python 3.10)
reivilibre Nov 13, 2024
6906711
Add errors for missing descriptions
reivilibre Nov 13, 2024
186f43b
Remove 'smart quotes'; use plain ASCII quotes
reivilibre Nov 13, 2024
6de86f2
Add special type name overrides for bytes, duration and size
reivilibre Nov 13, 2024
b2672d7
Fix word `avatar` being lost in transcription of schema
reivilibre Nov 13, 2024
1705d7e
Fix some typos and duplicated example/default blocks
reivilibre Nov 13, 2024
7dc3053
Remove duplicate default
reivilibre Nov 13, 2024
4c98384
Fix type of `account_threepid_delegates`
reivilibre Nov 13, 2024
cb15ce6
Add 'Reloading cache factors' section back
reivilibre Nov 13, 2024
2c4902a
Re-add description of room complexity
reivilibre Nov 13, 2024
c7fbf7b
Fix default config of `ip_range_blacklist`
reivilibre Nov 13, 2024
d6eec62
Fix default of `media_store_path`
reivilibre Nov 13, 2024
84a2491
Move schema
V02460 Nov 25, 2024
9704afb
Format JSON schema
V02460 Nov 25, 2024
122a3b3
Fix typos
V02460 Nov 26, 2024
18f9ac8
Add synapse-config.schema.yaml
V02460 Nov 25, 2024
f451e23
Add missing descriptions
V02460 Nov 26, 2024
e157a0a
Add meta schema
V02460 Nov 26, 2024
9fd0a48
Merge branch 'develop' into schema
V02460 Nov 26, 2024
2d817dc
Print usage on too many arguments
V02460 Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/17892.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Generate config documentation from JSON Schema file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed this PR in a weekly meeting to make sure that this is something we want to do. People are onboard with the benefits 👍

We just have to make sure this implementation is something we want to use and we won't be kicking ourselves months down the line that it's difficult to express constraints, validation, or formatting.

2 changes: 1 addition & 1 deletion docs/usage/administration/admin_faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ line to `/etc/default/matrix-synapse`:

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2

*Note*: You may need to set `PYTHONMALLOC=malloc` to ensure that `jemalloc` can accurately calculate memory usage. By default, Python uses its internal small-object allocator, which may interfere with jemalloc's ability to track memory consumption correctly. This could prevent the [cache_autotuning](../configuration/config_documentation.md#caches-and-associated-values) feature from functioning as expected, as the Python allocator may not reach the memory threshold set by `max_cache_memory_usage`, thus not triggering the cache eviction process.
*Note*: You may need to set `PYTHONMALLOC=malloc` to ensure that `jemalloc` can accurately calculate memory usage. By default, Python uses its internal small-object allocator, which may interfere with jemalloc's ability to track memory consumption correctly. This could prevent the [cache_autotuning](../configuration/config_documentation.md#caches) feature from functioning as expected, as the Python allocator may not reach the memory threshold set by `max_cache_memory_usage`, thus not triggering the cache eviction process.

This made a significant difference on Python 2.7 - it's unclear how
much of an improvement it provides on Python 3.x.
Expand Down
4,139 changes: 1,842 additions & 2,297 deletions docs/usage/configuration/config_documentation.md

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions schema/meta.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schema.element.io/v1/meta.schema.json",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
"https://json-schema.org/draft/2020-12/vocab/validation": true,
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
"https://json-schema.org/draft/2020-12/vocab/content": true,
"https://schema.element.io/v1/vocab/documentation": true
},
"$ref": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"io.element.type_name": {
"type": "string",
"description": "Human-readable type of a schema that is displayed instead of the standard JSON Schema types like `object` or `integer`. In case the JSON Schema type contains `null`, this information should be presented alongside the human-readable type name.",
"examples": ["duration", "byte size"]
},
"io.element.post_description": {
"type": "string",
"description": "Additional description of a schema, better suited to be placed less prominently in the generated documentation, e.g., at the end of a section after listings of items and properties.",
"examples": [
"### Advanced uses\n\nThe spent coffee grounds can be added to compost for improving soil and growing plants."
]
}
}
}
3,251 changes: 3,251 additions & 0 deletions schema/synapse-config.schema.json

Large diffs are not rendered by default.

Loading