Skip to content

docs: Add docs generation to schema build command #284

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

Merged
merged 4 commits into from
Apr 30, 2025

Conversation

brendan-kellam
Copy link
Contributor

@brendan-kellam brendan-kellam commented Apr 29, 2025

This PR modifies packages/schemas/tools/generate.ts to write the resolved schema to a mdx, which can be used as a reusable snippet in Mintlify. This makes it s.t., our docs & schemas will always be in sync.

Summary by CodeRabbit

  • Documentation
    • Replaced inline JSON schema blocks with imported schema components across connection docs (GitHub, GitLab, Gitea, Gerrit, Bitbucket) and search contexts for improved clarity and maintainability.
    • Added import statements and references to external schema components and files for streamlined schema presentation.
  • New Features
    • Added detailed JSON schemas defining configurations for repository mirroring, Sourcebot settings, and multiple code host connections, enhancing validation and user guidance.
    • Introduced new schemas for search contexts and shared token/revision formats to standardize configuration inputs.
  • Chores
    • Split schema outputs into separate source and documentation directories for better organization.
    • Fixed typos and added schema metadata to improve schema descriptions and standards compliance.

@brendan-kellam brendan-kellam requested a review from msukkari April 29, 2025 19:02
Copy link

coderabbitai bot commented Apr 29, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This change refactors the documentation for various code host connections and configuration files by replacing large, inline JSON schema blocks with imported schema components. It introduces new JSON Schema files for each connection type (GitHub, GitLab, Gitea, Gerrit, Bitbucket) and for search contexts, storing them in dedicated snippet files. The documentation now imports and renders these schema components instead of embedding raw JSON. Additionally, the schema generation tooling is updated to output schema files to both source and documentation directories, and the main Sourcebot configuration schema references these external definitions. TypeScript interfaces and JSON schema files are also added for search contexts.

Changes

File(s) Change Summary
docs/docs/connections/bitbucket-cloud.mdx, docs/docs/connections/bitbucket-data-center.mdx, docs/docs/connections/gerrit.mdx, docs/docs/connections/gitea.mdx, docs/docs/connections/github.mdx, docs/docs/connections/gitlab.mdx, docs/self-hosting/more/declarative-config.mdx, docs/self-hosting/more/search-contexts.mdx Replaced inline JSON schema blocks with imported schema components; updated imports accordingly.
docs/snippets/schemas/v1/index.schema.mdx Added new JSON schema for repository mirroring configurations (GitHub/GitLab).
docs/snippets/schemas/v2/index.schema.mdx Added new JSON schema for Sourcebot configuration supporting multiple code hosts.
docs/snippets/schemas/v3/bitbucket.schema.mdx, docs/snippets/schemas/v3/connection.schema.mdx, docs/snippets/schemas/v3/gerrit.schema.mdx, docs/snippets/schemas/v3/gitea.schema.mdx, docs/snippets/schemas/v3/github.schema.mdx, docs/snippets/schemas/v3/gitlab.schema.mdx, docs/snippets/schemas/v3/index.schema.mdx, docs/snippets/schemas/v3/searchContext.schema.mdx, docs/snippets/schemas/v3/shared.schema.mdx Added new JSON schema files for each connection type, shared components, and search contexts.
packages/schemas/src/v3/index.schema.ts Added $schema and title properties to the SearchContext schema definition; fixed typo in Settings description.
packages/schemas/src/v3/searchContext.schema.ts Added new exported constant defining the JSON schema for SearchContext.
packages/schemas/src/v3/searchContext.type.ts Added new TypeScript interface for SearchContext.
packages/schemas/tools/generate.ts Refactored schema generation: outputs now go to both source and docs directories; updated banner comment handling.
schemas/v3/index.json Changed SearchContext definition from inline to external $ref to ./searchContext.json; fixed typo in Settings description.
schemas/v3/searchContext.json Added new JSON schema file for SearchContext.

Sequence Diagram(s)

sequenceDiagram
    participant Docs as Documentation (.mdx)
    participant Snippet as Schema Component (.mdx)
    participant Schema as JSON Schema File

    Docs->>Snippet: Import schema component (e.g., <GitHubSchema />)
    Snippet->>Schema: Render schema from external JSON schema file
    Docs->>User: Display rendered schema in documentation
Loading

Possibly related PRs

  • docs: Add docs generation to schema build command #284: Modifies Bitbucket Cloud, Bitbucket Data Center, Gerrit, Gitea, GitHub, GitLab, and search contexts documentation by replacing inline JSON schema definitions with imported JSX/MDX schema components, aligning with this PR’s documentation refactoring approach.
  • Add Bitbucket support #275: Adds Bitbucket support including new Bitbucket connection schemas and related code, which complements this PR’s addition of Bitbucket schema definitions and documentation updates.

Poem

🐇
Out with the old, the schemas inline,
In with the snippets—how tidy, how fine!
Now docs import and render with glee,
Each code host’s config clear as can be.
With schemas modular, docs shine bright—
The rabbit hops on, schema future in sight!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 80e7409 and 2a2881f.

📒 Files selected for processing (26)
  • docs/docs/connections/bitbucket-cloud.mdx (2 hunks)
  • docs/docs/connections/bitbucket-data-center.mdx (2 hunks)
  • docs/docs/connections/gerrit.mdx (2 hunks)
  • docs/docs/connections/gitea.mdx (2 hunks)
  • docs/docs/connections/github.mdx (2 hunks)
  • docs/docs/connections/gitlab.mdx (2 hunks)
  • docs/self-hosting/more/declarative-config.mdx (2 hunks)
  • docs/self-hosting/more/search-contexts.mdx (2 hunks)
  • docs/snippets/schemas/v1/index.schema.mdx (1 hunks)
  • docs/snippets/schemas/v2/index.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/bitbucket.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/connection.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/gerrit.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/gitea.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/github.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/gitlab.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/index.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/searchContext.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/shared.schema.mdx (1 hunks)
  • packages/schemas/src/v3/index.schema.ts (2 hunks)
  • packages/schemas/src/v3/index.type.ts (1 hunks)
  • packages/schemas/src/v3/searchContext.schema.ts (1 hunks)
  • packages/schemas/src/v3/searchContext.type.ts (1 hunks)
  • packages/schemas/tools/generate.ts (1 hunks)
  • schemas/v3/index.json (2 hunks)
  • schemas/v3/searchContext.json (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@brendan-kellam brendan-kellam changed the title [EE] Add docs generation to schema build command docs: Add docs generation to schema build command Apr 29, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🧹 Nitpick comments (38)
docs/snippets/schemas/v3/shared.schema.mdx (1)

1-1: Grammar: fix header comment
The header reads "THIS IS A AUTO-GENERATED FILE." For grammatical correctness, consider changing it to "THIS IS AN AUTO-GENERATED FILE."

docs/snippets/schemas/v3/bitbucket.schema.mdx (3)

1-1: Grammar: fix header comment
As with other snippets, update "THIS IS A AUTO-GENERATED FILE." to "THIS IS AN AUTO-GENERATED FILE."


16-51: Token definition duplication
The token property redefines the same structure from shared.schema.mdx. Consider referencing the shared Token definition via $ref to avoid schema duplication and keep the snippets DRY.


54-60: Use standard JSON Schema URI format
The property uses "format": "url" with a custom regex. Draft-07 specifies "format": "uri". You may simplify by switching to:

- "format": "url",
- "pattern": "^https?://[^\\s/$.?#].[^\\s]*$"
+ "format": "uri"

This leverages built-in URI validation and removes the need for a custom pattern.

docs/docs/connections/bitbucket-data-center.mdx (1)

8-8: Add missing semicolon to MDX import.
For consistency with the existing imports, terminate the import BitbucketSchema statement with a semicolon:

-import BitbucketSchema from '/snippets/schemas/v3/bitbucket.schema.mdx'
+import BitbucketSchema from '/snippets/schemas/v3/bitbucket.schema.mdx';
docs/self-hosting/more/declarative-config.mdx (1)

6-6: Add missing semicolon to MDX import.
Please add a semicolon at the end of the import for consistency:

-import ConfigSchema from '/snippets/schemas/v3/index.schema.mdx'
+import ConfigSchema from '/snippets/schemas/v3/index.schema.mdx';
docs/docs/connections/bitbucket-cloud.mdx (1)

8-8: Add missing semicolon to MDX import.
Align this import with the surrounding statements by adding a semicolon:

-import BitbucketSchema from '/snippets/schemas/v3/bitbucket.schema.mdx'
+import BitbucketSchema from '/snippets/schemas/v3/bitbucket.schema.mdx';
docs/docs/connections/gerrit.mdx (1)

65-65: Remove placeholder JSX comment.

The comment {/* asdf */} appears to be a placeholder that should be removed before merging.

-{/* asdf */}
docs/snippets/schemas/v3/gerrit.schema.mdx (1)

1-1: Nit: Grammar in auto-generated file header
The comment reads "THIS IS A AUTO-GENERATED FILE". Consider updating to "THIS IS AN AUTO-GENERATED FILE" in your codegen template for grammatical correctness.

packages/schemas/src/v3/searchContext.schema.ts (1)

1-1: Nit: Grammar in auto-generated file header
The comment reads "THIS IS A AUTO-GENERATED FILE". Consider updating to "THIS IS AN AUTO-GENERATED FILE" in your codegen template.

docs/snippets/schemas/v3/gitea.schema.mdx (1)

12-47: Add example for env token variant
The token schema only shows an example for the secret variant. Consider adding an example for the env variant, e.g.:

{
  "env": "GITEA_TOKEN_ENV_VAR"
}

This will improve clarity for users choosing the environment-variable approach.

docs/snippets/schemas/v3/gitlab.schema.mdx (6)

6-11: Consistent capitalization for title
The title is "GitlabConnectionConfig", but the official product name is "GitLab". Consider updating to "GitLabConnectionConfig" for consistency across schemas.


12-47: Enhance token examples by including env variant
The token schema correctly supports both secret and env object formats, but the examples array only shows the secret case. Adding an example for the env variant (e.g., {"env": "GITLAB_TOKEN"}) would better illustrate usage.


59-63: Clarify all property behavior
Since url defaults to "https://gitlab.com", the all option will be ignored by default. Consider revising either the default value for url or the description of all to avoid surprising users who expect it to work out-of-the-box.


64-115: Add default values for array properties
Properties such as users, groups, projects, and topics currently have no "default". To document the fallback behavior and align with other schemas, add "default": [] to these array properties.


116-157: Provide defaults for exclude.topics
Inside the exclude object, projects has "default": [] but topics does not. Adding "default": [] to exclude.topics will ensure consistent behavior when the field is omitted.


158-198: Consider default for revisions
The revisions object governs indexing of branches and tags. Defining a "default": {} would clarify what happens when no explicit revisions are provided.

docs/snippets/schemas/v3/github.schema.mdx (3)

6-11: Use proper product capitalization
The title is "GithubConnectionConfig", but the official product name is "GitHub". Consider updating to "GitHubConnectionConfig" for consistency.


12-19: Include env example for token
The examples array under token only demonstrates the secret variant. To fully illustrate the schema’s capabilities, add an example for the env variant, e.g.:

{"env": "GITHUB_TOKEN"}

48-57: Verify URL pattern strictness
The current regex for url allows most valid URLs but may permit some edge cases. Consider tightening the pattern or documenting its limitations to prevent unexpected host strings.

docs/snippets/schemas/v1/index.schema.mdx (3)

4-8: Add top-level title or description
This schema defines repository mirroring configs but lacks a "title" or "description" at the root. Including one (e.g., "title": "ZoektMirrorConfig") would enhance clarity in generated docs.


29-37: Add title to connection definitions
Inside definitions.GitHubConfig and definitions.GitLabConfig, consider adding a "title" (and optional "description") to improve schema introspection and generated documentation.


121-129: Enforce non-empty Configs array
If at least one mirror config is required, add "minItems": 1 to the Configs array to prevent empty configurations.

docs/snippets/schemas/v2/index.schema.mdx (1)

9-24: Enhance Token definition with secret reference
The Token schema supports a literal string or an object with "env". To align with v3 and facilitate secret management, consider adding a variant:

{
  "type": "object",
  "properties": {
    "secret": {
      "type": "string",
      "description": "Name of the secret containing the token."
    }
  },
  "required": ["secret"],
  "additionalProperties": false
}
docs/snippets/schemas/v3/index.schema.mdx (3)

12-67: Add default values to Settings properties
Unlike v2, these settings lack "default" keywords. Adding defaults (e.g., 2097152 for maxFileSize, 3600000 for reindexIntervalMs, etc.) will ensure consistent auto-population in tooling.


12-67: Use integer type for discrete values
All settings representing bytes or time intervals are typed as "number". Switching to "integer" would better reflect their discrete nature and align with other schemas.


70-110: Remove redundant $schema inside SearchContext
Embedding a full $schema declaration in the SearchContext definition is unnecessary in this snippet. Removing it will reduce clutter and potential confusion.

docs/snippets/schemas/v3/connection.schema.mdx (11)

1-2: Use an HTML comment and correct the article in the auto-generated notice.
MDX supports HTML comments natively; switching improves readability. Also, grammatically use “an auto-generated”:

- {/* THIS IS A AUTO-GENERATED FILE. DO NOT MODIFY MANUALLY! */}
+ <!-- THIS IS AN AUTO-GENERATED FILE. DO NOT MODIFY MANUALLY! -->

3-6: Add a unique $id for better schema references.
Defining an $id in the root makes it easier to reference programmatically and avoids brittle fragment pointers:

 {
   "$schema": "http://json-schema.org/draft-07/schema#",
+  "$id": "https://sourcebot.dev/docs/snippets/schemas/v3/connection.schema.json",
   "title": "ConnectionConfig",
   "oneOf": [

7-218: Remove redundant $schema declarations in subschemas.
The "$schema" keyword only applies at the document root; nested occurrences are ignored and clutter the file:

-    {
-      "$schema": "http://json-schema.org/draft-07/schema#",
       "type": "object",
       "title": "GithubConnectionConfig",
       ...
    },

16-50: Extract token into a shared Token definition.
Inlined token schemas and JSON pointers to oneOf[0] are brittle. Define a Token in shared.schema.mdx and reference it instead:

-      "token": {
-        "description": "A Personal Access Token (PAT).",
-        "anyOf": [ ... ]
-      },
+      "token": {
+        "$ref": "shared.schema.mdx#/definitions/Token"
+      },

61-62: Prefer built-in URI format over custom regex.
Draft-07 supports "format": "uri", which is clearer and more maintainable than a hand-rolled pattern:

-        "url": {
-          "type": "string",
-          "format": "url",
-          "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$"
+        "url": {
+          "type": "string",
+          "format": "uri"

220-356: Avoid JSON pointers to array indices for reuse.
Referencing #/oneOf/0/properties/token ties the schema to its current ordering. Use shared definitions instead:

-        "token": {
-          "$ref": "#/oneOf/0/properties/token",
+        "token": {
+          "$ref": "shared.schema.mdx#/definitions/Token",
           ...
         }

292-305: Add a default for GitLab topics to align with GitHub.
Specifying "default": [] makes clear that absence equates to “no filter”:

         "topics": {
           "type": "array",
           "items": { "type": "string" },
           "minItems": 1,
+          "default": [],
           "description": "List of project topics ..."
         },

357-451: Standardize default for Gitea exclude.repos.
Unlike GitHub, Gitea’s exclude.repos lacks a default. Adding "default": [] ensures consistent behavior:

             "repos": {
               "type": "array",
               "items": { "type": "string" },
+              "default": [],
               "description": "List of individual repositories to exclude..."
             },

443-445: Reuse shared GitRevisions instead of an array-index pointer.
Referencing the GitHub revisions schema by index is fragile. Use a direct $ref to shared.schema.mdx#/definitions/GitRevisions:

-      "revisions": {
-        "$ref": "#/oneOf/0/properties/revisions"
-      }
+      "revisions": {
+        "$ref": "shared.schema.mdx#/definitions/GitRevisions"
+      }

452-508: Consider default empty arrays for Gerrit projects.
Adding "default": [] to optional lists like projects and exclude.projects improves self-documentation:

         "projects": {
           "type": "array",
+          "default": [],
           "items": { "type": "string" },
           ...
         },

509-620: Add defaults for Bitbucket filter arrays.
Properties such as workspaces, projects, and repos should default to [] so absence clearly means “no filter”:

         "workspaces": {
           "type": "array",
+          "default": [],
           "items": { "type": "string" },
           ...
         },
         "projects": {
           "type": "array",
+          "default": [],
           "items": { "type": "string" },
           ...
         },
         "repos": {
           "type": "array",
+          "default": [],
           "items": { "type": "string" },
           ...
         },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1507364 and 7a3a6bd.

📒 Files selected for processing (25)
  • docs/docs/connections/bitbucket-cloud.mdx (2 hunks)
  • docs/docs/connections/bitbucket-data-center.mdx (2 hunks)
  • docs/docs/connections/gerrit.mdx (2 hunks)
  • docs/docs/connections/gitea.mdx (2 hunks)
  • docs/docs/connections/github.mdx (2 hunks)
  • docs/docs/connections/gitlab.mdx (2 hunks)
  • docs/self-hosting/more/declarative-config.mdx (2 hunks)
  • docs/self-hosting/more/search-contexts.mdx (2 hunks)
  • docs/snippets/schemas/v1/index.schema.mdx (1 hunks)
  • docs/snippets/schemas/v2/index.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/bitbucket.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/connection.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/gerrit.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/gitea.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/github.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/gitlab.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/index.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/searchContext.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/shared.schema.mdx (1 hunks)
  • packages/schemas/src/v3/index.schema.ts (1 hunks)
  • packages/schemas/src/v3/searchContext.schema.ts (1 hunks)
  • packages/schemas/src/v3/searchContext.type.ts (1 hunks)
  • packages/schemas/tools/generate.ts (1 hunks)
  • schemas/v3/index.json (1 hunks)
  • schemas/v3/searchContext.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (27)
docs/snippets/schemas/v3/shared.schema.mdx (2)

5-6: Schema declaration and root type are correct
The $schema reference and "type": "object" declaration align with draft-07 JSON Schema.


7-35: Token definition looks solid
The anyOf structure correctly enforces either secret or env, and additionalProperties: false prevents extra fields.

docs/docs/connections/gitlab.mdx (2)

6-6: Importing GitLab schema snippet
The import path aligns with other MDX docs and will pull in the shared snippet correctly.


182-182: Rendering the <GitLabSchema /> component
Replacing the inline JSON block with the component ensures consistency and reusability.

docs/docs/connections/gitea.mdx (2)

6-6: Importing Gitea schema snippet
The snippet import matches the established pattern for MDX-based schema components.


148-148: Rendering the <GiteaSchema /> component
Delegating schema display to the imported component improves maintainability.

docs/docs/connections/github.mdx (2)

6-6: Importing GitHub schema snippet
The import path is correct and mirrors the other connection docs.


177-177: Rendering the <GitHubSchema /> component
Embedding the <GitHubSchema /> component replaces the old inline block as intended.

packages/schemas/src/v3/index.schema.ts (1)

69-73: Approve SearchContext schema enrichment.
Adding the explicit "$schema" and "title" properties to the SearchContext definition increases clarity and aligns with JSON Schema Draft-07 conventions.

docs/docs/connections/bitbucket-data-center.mdx (1)

81-81: Schema snippet insertion is correct.
Replacing the raw JSON reference with <BitbucketSchema /> improves maintainability and ensures documentation stays in sync with the schema definition.

docs/self-hosting/more/declarative-config.mdx (1)

39-39: Modular schema snippet integration looks good.
The <ConfigSchema /> component cleanly replaces the inline JSON block and keeps the documentation aligned with the source schema.

schemas/v3/index.json (1)

69-70: Reference external searchContext.json.
By replacing the inline SearchContext definition with a $ref to ./searchContext.json, the schema is now modular and reusable across code and docs.

docs/docs/connections/bitbucket-cloud.mdx (1)

102-102: Schema snippet rendering is correct.
Embedding <BitbucketSchema /> in the reference accordion streamlines the documentation and ensures consistency.

docs/docs/connections/gerrit.mdx (1)

6-7: LGTM! Good modularization of schema documentation.

The import and usage of the GerritSchema component from a reusable snippet improves maintainability by centralizing schema definitions.

Also applies to: 70-70

docs/self-hosting/more/search-contexts.mdx (1)

6-7: LGTM! Well-structured schema reference implementation.

The import and usage of SearchContextSchema component is implemented correctly, including the helpful link to the raw schema file. This modular approach will make it easier to keep documentation and schemas in sync.

Also applies to: 113-117

packages/schemas/tools/generate.ts (1)

8-8: LGTM! Excellent refactoring to support dual output formats.

The updated generate script now correctly outputs schemas to both source files and documentation snippets with appropriate formatting for each. This supports the PR objective of keeping documentation and schemas automatically synchronized.

Key improvements:

  • Separate paths for source and documentation outputs
  • Proper MDX formatting for documentation snippets
  • Consistent banner comments in both outputs
  • Directory creation with recursive option for nested paths

Also applies to: 13-14, 21-26, 30-46, 50-50, 57-57

schemas/v3/searchContext.json (1)

1-42: LGTM! Well-structured schema with clear documentation.

The SearchContext schema is well-defined with:

  • Clear property descriptions explaining expected formats
  • Helpful examples demonstrating proper usage
  • Appropriate required field designation
  • Prevention of additional properties to maintain schema integrity

This schema will provide good documentation and validation for search context configurations.

docs/snippets/schemas/v3/gerrit.schema.mdx (1)

3-59: Schema structure looks valid
The GerritConnectionConfig JSON schema correctly defines the object shape, required properties, strict typing, pattern validation, and examples.

packages/schemas/src/v3/searchContext.schema.ts (1)

2-44: Valid JSON Schema definition
The searchContextSchema correctly defines the JSON Schema with the required include property, clear descriptions, examples, and additionalProperties: false. Using as const ensures precise TypeScript typings.

packages/schemas/src/v3/searchContext.type.ts (1)

6-19: Interface matches schema definition
The SearchContext interface accurately mirrors the JSON Schema's required and optional properties, with comprehensive JSDoc comments for each field.

docs/snippets/schemas/v3/searchContext.schema.mdx (1)

2-44: Valid JSON Schema snippet for SearchContext
This MDX file correctly defines the SearchContext schema: required include, optional exclude and description, examples are provided, and additionalProperties is set to false.

docs/snippets/schemas/v3/gitea.schema.mdx (1)

3-162: Schema structure looks correct
The GiteaConnectionConfig schema accurately defines all properties—including type, token, url, sync filters, and revisions—along with proper patterns, defaults, and strict validation.

docs/snippets/schemas/v3/gitlab.schema.mdx (1)

1-2: Auto-generated file notice is clear
The header clearly indicates this file is auto-generated and should not be modified manually.

docs/snippets/schemas/v3/github.schema.mdx (1)

1-2: Auto-generated file notice is clear
The header properly marks this as an auto-generated file. No manual edits are required.

docs/snippets/schemas/v1/index.schema.mdx (2)

1-2: Auto-generated file notice is clear
The header correctly indicates this file is auto-generated and should not be manually edited.


83-84: Verify required fields in GitLabConfig
Currently only "Type" is required for GitLabConfig. Evaluate whether properties like GitLabURL or CredentialPath should also be mandatory to avoid incomplete configurations.

I can assist by searching existing v1 config examples if needed.

docs/snippets/schemas/v3/connection.schema.mdx (1)

621-623: The closing braces and code fence correctly terminate the JSON block; no further action required.

@brendan-kellam brendan-kellam force-pushed the bkellam/schema-docs-sync branch from 80e7409 to bb03c97 Compare April 30, 2025 22:39
@brendan-kellam brendan-kellam merged commit 0119510 into main Apr 30, 2025
4 checks passed
@brendan-kellam brendan-kellam deleted the bkellam/schema-docs-sync branch April 30, 2025 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant