Skip to content

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CharlieTLe
Copy link
Member

@CharlieTLe CharlieTLe commented Aug 10, 2025

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

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Copy link

@Copilot Copilot AI left a 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

Signed-off-by: Charlie Le <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant