Skip to content
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

Use a different schema for each branding #15856

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,15 @@ void CascadiaSettings::WriteSettingsToDisk()
}
}

#ifndef NDEBUG
static [[maybe_unused]] std::string _getDevPathToSchema()
{
std::filesystem::path filePath{ __FILE__ };
auto schemaPath = filePath.parent_path().parent_path().parent_path().parent_path() / "doc" / "cascadia" / "profiles.schema.json";
return "file:///" + schemaPath.generic_string();
}
#endif

// Method Description:
// - Create a new serialized JsonObject from an instance of this class
// Arguments:
Expand All @@ -1238,7 +1247,17 @@ Json::Value CascadiaSettings::ToJson() const
// top-level json object
auto json{ _globals->ToJson() };
json["$help"] = "https://aka.ms/terminal-documentation";
json["$schema"] = "https://aka.ms/terminal-profiles-schema";
json["$schema"] =
#if defined(WT_BRANDING_RELEASE)
"https://aka.ms/terminal-profiles-schema"
#elif defined(WT_BRANDING_PREVIEW)
"https://aka.ms/terminal-profiles-schema-preview"
#elif !defined(NDEBUG) // DEBUG mode
_getDevPathToSchema() // magic schema path that refers to the local source directory
#else // All other brandings
"https://raw.githubusercontent.com/microsoft/terminal/main/doc/cascadia/profiles.schema.json"
#endif
;

// "profiles" will always be serialized as an object
Json::Value profiles{ Json::ValueType::objectValue };
Expand Down
Loading