site-config: Make symbols not required in syntaxHighlighting (#57276)

* site-config: Make symbols not required in syntaxHighlighting

* add nil checks
This commit is contained in:
Auguste Rame 2023-10-16 19:53:19 -04:00 committed by GitHub
parent a3dbd371eb
commit 325e120317
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View File

@ -27,7 +27,7 @@ func init() {
// Validation only: Do NOT set any values in the configuration in this function.
conf.ContributeValidator(func(c conftypes.SiteConfigQuerier) (problems conf.Problems) {
configuration := c.SiteConfig().SyntaxHighlighting
if configuration == nil {
if configuration == nil || configuration.Symbols == nil {
return nil
}

View File

@ -104,7 +104,7 @@ func CreateEngineMap(siteConfig schema.SiteConfiguration) map[string]ParserType
// Set any relevant overrides
configuration := siteConfig.SyntaxHighlighting
if configuration != nil {
if configuration != nil && configuration.Symbols != nil {
for lang, engine := range configuration.Symbols.Engine {
lang = languages.NormalizeLanguage(lang)

View File

@ -11,7 +11,7 @@ Sourcegraph uses the following JSON Schemas:
# Modifying a schema
1. Edit the `*.schema.json` file in this directory.
1. Run `bazel run :write_generated_schema`.
1. Run `bazel run //schema:write_generated_schema`.
1. Commit the changes to both files.
1. Run `sg start` to automatically update TypeScript schema files.

View File

@ -2978,7 +2978,7 @@ type SyntaxHighlighting struct {
Engine SyntaxHighlightingEngine `json:"engine"`
Languages SyntaxHighlightingLanguage `json:"languages"`
// Symbols description: Configure symbol generation
Symbols SymbolConfiguration `json:"symbols"`
Symbols *SymbolConfiguration `json:"symbols,omitempty"`
}
type SyntaxHighlightingEngine struct {
// Default description: The default syntax highlighting engine to use

View File

@ -877,7 +877,7 @@
"title": "SyntaxHighlighting",
"description": "Syntax highlighting configuration",
"type": "object",
"required": ["engine", "languages", "symbols"],
"required": ["engine", "languages"],
"properties": {
"engine": {
"title": "SyntaxHighlightingEngine",