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

Add json-schemas for Configuration json files #2532

Closed
wants to merge 27 commits into from
Closed

Add json-schemas for Configuration json files #2532

wants to merge 27 commits into from

Conversation

psyirius
Copy link
Contributor

@psyirius psyirius commented Aug 7, 2024

Title

Add json-schemas for Configuration json files

Type of Change

  • DX Enhancement
  • QOL

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

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no errors/warnings/merge conflicts.

@psyirius psyirius marked this pull request as ready for review August 7, 2024 16:05
@psyirius psyirius changed the title Add json-schemas for Configuration json files (WIP) Add json-schemas for Configuration json files Aug 7, 2024
@ChrisTitusTech ChrisTitusTech force-pushed the main branch 2 times, most recently from 7805fe4 to cfb9edb Compare August 26, 2024 22:01
@MyDrift-user
Copy link
Contributor

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

Comment on lines +81 to +96
$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('&','&#38;').replace('“','&#8220;').replace('”','&#8221;').replace("'",'&#39;').replace('<','&#60;').replace('>','&#62;').replace('—','&#8212;')
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('&#39;&#39;',"&#39;") # 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('&','&#38;').replace('“','&#8220;').replace('”','&#8221;').replace("'",'&#39;').replace('<','&#60;').replace('>','&#62;').replace('—','&#8212;')
$jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('&#39;&#39;',"&#39;") # resolves the Double Apostrophe caused by the first replace function in the main loop
}
}
Copy link
Contributor

@og-mrk og-mrk Aug 28, 2024

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.

@ChrisTitusTech
Copy link
Owner

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_]*$": {
Copy link
Contributor

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

@psyirius psyirius deleted the config-schema branch August 30, 2024 05:04
@ChrisTitusTech ChrisTitusTech added the skip-changelog Skip Change Logs label Sep 10, 2024
@MyDrift-user MyDrift-user mentioned this pull request Oct 26, 2024
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Skip Change Logs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants