-
Notifications
You must be signed in to change notification settings - Fork 832
Set up cortex config json schema generator #6959
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
Set up cortex config json schema generator #6959
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds JSON schema generation functionality to the existing documentation generator tool, allowing the Cortex configuration to be exported as a JSON schema in addition to the existing markdown documentation.
- Adds a new
JSONSchemaWriter
that converts parsed configuration blocks into JSON schema format - Extends the main doc-generator with command-line flags for JSON schema generation (
-json-schema
and-output
) - Integrates JSON schema generation into the build process via Makefile
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
tools/doc-generator/main.go | Adds JSON schema generation mode with CLI flags and routing logic |
tools/doc-generator/json_schema_writer.go | Implements complete JSON schema generation functionality with type mapping and structure handling |
Makefile | Adds JSON schema generation to the documentation build target |
733d155
to
647fe9f
Compare
Do we need a CI to verify the consistency of the JSON file when new fields are added or removed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. This looks promising!
CI should be covered since the Makefile was updated to generate the schema. |
Signed-off-by: Charlie Le <[email protected]>
Signed-off-by: Charlie Le <[email protected]>
Signed-off-by: Charlie Le <[email protected]>
647fe9f
to
011d192
Compare
Signed-off-by: Charlie Le <[email protected]>
What this PR does:
Adds a JSON schema for our cortex configuration so that we could get validation and auto completion in editors that support the yaml-language-server. This will make it easier to understand our configuration since the description of what each field is about will also appear as a popover in the ide when the field is hovered over by the cursor.
Changes to the schema are automated just like how the docs are generated, making it easy to maintain.
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]