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

fix: support update JSON that uses comment or trailing comma #313

Merged
merged 3 commits into from
Jun 8, 2024

Conversation

nogic1008
Copy link
Owner

@nogic1008 nogic1008 commented Jun 8, 2024

ref #308

Known Issue

JsonWritableOptions.Update() removes ALL comments and trailing comma.

Source appsettings.json

{
  // Line Comment
  "SampleOption": {
      /*
        Block Comment
       */
      "LastLaunchedAt": "2020-10-01T00:00:00",
      "Interval": 1000,
      "ConnectionString": "foo",
  },
}

Expected

{
  // Line Comment
  "SampleOption": {
      "LastLaunchedAt": "2024-06-01T00:00:00",
      "Interval": 5000,
      "ConnectionString": "bar"
  },
}

Actual

{
  "SampleOption": {
      "LastLaunchedAt": "2024-06-01T00:00:00",
      "Interval": 5000,
      "ConnectionString": "bar"
  }
}

@nogic1008 nogic1008 added the bug 🐛 Something isn't working label Jun 8, 2024
@nogic1008 nogic1008 added this to the vNext milestone Jun 8, 2024
@nogic1008 nogic1008 self-assigned this Jun 8, 2024
Copy link

codecov bot commented Jun 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.00%. Comparing base (0ef0db7) to head (c012f35).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #313      +/-   ##
==========================================
+ Coverage   98.94%   99.00%   +0.05%     
==========================================
  Files           2        2              
  Lines          95      100       +5     
  Branches        8        8              
==========================================
+ Hits           94       99       +5     
  Partials        1        1              
Flag Coverage Δ
Linux 98.90% <100.00%> (+0.06%) ⬆️
Windows 99.00% <100.00%> (+0.05%) ⬆️
macOS 98.90% <100.00%> (+0.06%) ⬆️
net48 98.94% <100.00%> (+0.05%) ⬆️
net6.0 98.90% <100.00%> (+0.06%) ⬆️
net8.0 98.90% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nogic1008 nogic1008 merged commit 84884f2 into main Jun 8, 2024
13 checks passed
@nogic1008 nogic1008 deleted the hotfix/commented-json branch June 8, 2024 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant