-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add json-schemas for Configuration json files #2532
Conversation
7805fe4
to
cfb9edb
Compare
This seems to to be up-to date with current changes. It looks like it will break the special characters which's logic I have modified in my Refractor |
$firstLevelJsonList = [System.Collections.ArrayList]::new() | ||
$jsonAsObject.PSObject.Properties.Name | ForEach-Object {$null = $firstLevelJsonList.Add($_)} | ||
# Note: | ||
# Avoid using HTML Entity Codes, for example '”' (stands for "Right Double Quotation Mark"), | ||
# Use **HTML decimal/hex codes instead**, as using HTML Entity Codes will result in XML parse Error when running the compiled script. | ||
for ($i = 0; $i -lt $firstLevelJsonList.Count; $i += 1) { | ||
$firstLevelName = $firstLevelJsonList[$i] | ||
if ($jsonAsObject.$firstLevelName.content -ne $null) { | ||
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('&','&').replace('“','“').replace('”','”').replace("'",''').replace('<','<').replace('>','>').replace('—','—') | ||
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('''',"'") # resolves the Double Apostrophe caused by the first replace function in the main loop | ||
} | ||
if ($jsonAsObject.$firstLevelName.description -ne $null) { | ||
$jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('&','&').replace('“','“').replace('”','”').replace("'",''').replace('<','<').replace('>','>').replace('—','—') | ||
$jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('''',"'") # resolves the Double Apostrophe caused by the first replace function in the main loop | ||
} | ||
} |
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.
@psyirius @ChrisTitusTech This code for handling special characters is not needed anymore, as we're dynamically generating the UI, therefore skipping the XAML Reader in the process, so I recommend removing it plus any comments related to it.
Lol, I was having fun with this implementation, but really the pester and unit tests in github actions it seems like overkill. I'm going to close it. |
}, | ||
"type": "object", | ||
"patternProperties": { | ||
"^[a-zA-Z_][a-zA-Z0-9_]*$": { |
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.
@psyirius @ChrisTitusTech By selecting every theme entry, it'll make the tests always fail as now you don't need every single theming option in all theming entries, meaning the rule of having every theming option required should be set to the default theme.
more info can be found in this PR
Title
Add json-schemas for Configuration json files
Type of Change
Description
Add json-schemas for Configuration json files
Impact
Will help with editing config json with intelligence and keeping a documentation of the expected json format.
Future Plans
Validate it using some validators
Checklist