Make JSON Schema the configuration source of truth#1330
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac4a3ec183
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| The complete, generated reference for every configuration option, its type, default value, and description is available on the [official SQLPage configuration reference](https://sql-page.com/configuration.sql). | ||
| The checked-in [JSON Schema](./sqlpage/sqlpage.schema.json) is the source of truth for that reference and for SQLPage's in-memory configuration structure. |
There was a problem hiding this comment.
Preserve the non-option configuration guides
For users following existing repository links into configuration.md, this replacement removes the guides for OIDC setup, custom components, configuration/web-root directories, connection initialization and cleanup scripts, migrations, and custom routes. The linked official reference is only a generated option table, so it cannot replace those sections; for example, existing links from README.md and CHANGELOG.md now lead to a page that no longer contains the referenced operational guidance. Keep the non-option sections in this file or move them to stable linked destinations.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Summary
- Restored the missing OpenID Connect setup documentation, including application address configuration and identity-provider examples. configuration.mdL36-L88
- Restored operational guides for custom components and configuration/web-root directories. configuration.mdL98-L145
- Restored connection initialization and cleanup scripts, migrations, and custom URL route documentation. configuration.mdL147-L226
- Committed the changes in commit
d28a960(docs: restore configuration guides) and created the pull request “Restore operational configuration guides.”
Testing
- ✅
python3 - <<'PY' ... PY— verified all requested restored section headings are present. - ✅
git diff --check— completed without whitespace errors.
Motivation
AppConfigwith a single machine-readable source so editor validation, runtime parsing, and documentation stay consistent.Description
sqlpage/sqlpage.schema.jsonthat declares types, defaults, descriptions andx-rust-*metadata for code generation.AppConfigRust struct at build time from the JSON Schema viabuild.rsand include it withinclude!(concat!(env!("OUT_DIR"), "/app_config.rs"));instead of the handwritten struct insrc/app_config.rs.scripts/generate_configuration_reference.pyto produceexamples/official-site/configuration.sqlfrom the schema andscripts/check_configuration_examples.pyto validate that every example JSON references the live schema, and convert existing example YAML files to schema-linked JSON with"$schema"set./configuration.sql) and add a unit testexample_json_configuration_deserializesto ensure the checked-in examplesqlpage/sqlpage.jsondeserializes intoAppConfig.Testing
cargo fmt --all -- --checkandcargo clippy --all-targets --all-features -- -D warnings, which succeeded.cargo test, which completed with all unit and integration tests passing.scripts/generate_configuration_reference.py --checkandscripts/check_configuration_examples.py, and usednpx ajv-cli validate --strict=false --spec=draft2020 -s sqlpage/sqlpage.schema.json -d 'sqlpage/sqlpage.json' -d 'examples/**/sqlpage.json', all of which succeeded (AJV emitted format warnings only).cargo check --all-featuresto verify build-time code generation integration, which succeeded.Codex Task