-
-
Notifications
You must be signed in to change notification settings - Fork 6
csvsharp #412
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
csvsharp #412
Conversation
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.
Pull Request Overview
This PR adds a new RSCG example for the "Csvcsharp" CSV serialization library, incrementing the total count from 234 to 235 examples. The addition includes comprehensive documentation, example code, and integration into the existing documentation system.
- Updates count references from 234 to 235 throughout the documentation site
- Adds complete example project and documentation for CsvCsharp serializer
- Integrates the new example into categorization and navigation systems
Reviewed Changes
Copilot reviewed 25 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| RSCG.json | Adds CsvCsharp entry to the main RSCG database |
| HomepageFeatures/index.js | Updates example count from 234 to 235 |
| indexRSCG.md | Updates count and adds CsvCsharp to chronological list |
| about.md | Updates total example count reference |
| RSCG-Examples/index.md | Updates count and adds CsvCsharp to Serializer category |
| RSCG-Examples/Csvcsharp.md | Complete documentation page for CsvCsharp |
| Categories/_PrimitiveSerializer.mdx | Adds CsvCsharp to serializer category listing |
| Categories/Serializer.md | Updates serializer count and adds CsvCsharp |
| CsvCsharp/* | Complete example project structure and configuration |
| README.md | Updates count and adds CsvCsharp entry |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| { | ||
| "Name": "Csvcsharp", | ||
| "Link": "https://ignatandrei.github.io/RSCG_Examples/v2/docs/CsvCsharp", | ||
| "NuGet": "https://www.nuget.org/packages/Csvcsharp/", |
Copilot
AI
Oct 4, 2025
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.
The NuGet URL points to 'Csvcsharp' but the actual package name is 'CsvCSharp'. This will result in a 404 error when users try to access the package.
| "NuGet": "https://www.nuget.org/packages/Csvcsharp/", | |
| "NuGet": "https://www.nuget.org/packages/CsvCSharp/", |
| "generator":{ | ||
| "name":"Csvcsharp", | ||
| "nuget":[ | ||
| "https://www.nuget.org/packages/Csvcsharp/" |
Copilot
AI
Oct 4, 2025
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.
The NuGet URL uses 'Csvcsharp' but should be 'CsvCSharp' to match the actual package name. This will cause the link to fail.
| "https://www.nuget.org/packages/Csvcsharp/" | |
| "https://www.nuget.org/packages/CsvCSharp/" |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughIncrements counts/dates to 235/2025-10-05, adds a new “Csvcsharp” Serializer example across data, documentation, site, and book outputs, introduces a full demo project (solution, csproj, Person/Program), tour/video scripts, and updates TOC settings in a Docusaurus example. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App as Program.cs
participant Lib as CsvSerializer
participant Console as Console
App->>Lib: SerializeToString<Person>([person])
Lib-->>App: CSV string
App->>Console: WriteLine(csv)
App->>Lib: Serialize<Person>([person])
Lib-->>App: Serialized bytes/rows
App->>Lib: Deserialize<Person>(data)
Lib-->>App: IEnumerable<Person>
App->>Console: WriteLine(firstPerson.Name, Age)
note over App,Lib: Demonstration flow only (no error handling)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 7
♻️ Duplicate comments (1)
v2/rscg_examples_site/static/exports/RSCG.json (1)
1880-1880: Fix the NuGet package name in URL.The URL points to "Csvcsharp" but the actual NuGet package name is "CsvCSharp" (with capital 'C' and 'S'). This will result in a 404 error.
- "NuGet": "https://www.nuget.org/packages/Csvcsharp/", + "NuGet": "https://www.nuget.org/packages/CsvCSharp/",
🧹 Nitpick comments (1)
v2/rscg_examples_site/docs/indexRSCG.md (1)
23-23: Optional: Remove spaces in link text for cleaner markdown.Markdownlint flags spaces inside the link text. While this doesn't break functionality, removing them improves consistency.
-|235| [Csvcsharp by Yusuke Nakada ](/docs/Csvcsharp)|2025-10-05 => 05 October 2025 | [Serializer](/docs/Categories/Serializer) | +|235| [Csvcsharp by Yusuke Nakada](/docs/Csvcsharp)|2025-10-05 => 05 October 2025 | [Serializer](/docs/Categories/Serializer) |
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
v2/Generator/all.csvis excluded by!**/*.csvv2/rscg_examples_site/static/exports/RSCG.xlsxis excluded by!**/*.xlsxv2/rscg_examples_site/static/sources/Csvcsharp.zipis excluded by!**/*.zip
📒 Files selected for processing (24)
README.md(2 hunks)later.md(1 hunks)v2/Generator/DocusaurusExample.txt(1 hunks)v2/RSCGExamplesData/GeneratorDataRec.json(1 hunks)v2/book/examples/Csvcsharp.html(1 hunks)v2/book/list.html(2 hunks)v2/book/pandocHTML.yaml(1 hunks)v2/rscg_examples/CsvCsharp/description.json(1 hunks)v2/rscg_examples/CsvCsharp/nuget.txt(1 hunks)v2/rscg_examples/CsvCsharp/readme.txt(1 hunks)v2/rscg_examples/CsvCsharp/src/.tours/Csvcsharp.tour(1 hunks)v2/rscg_examples/CsvCsharp/src/Serializer.sln(1 hunks)v2/rscg_examples/CsvCsharp/src/Serializer/Person.cs(1 hunks)v2/rscg_examples/CsvCsharp/src/Serializer/Program.cs(1 hunks)v2/rscg_examples/CsvCsharp/src/Serializer/Serializer.csproj(1 hunks)v2/rscg_examples/CsvCsharp/video.json(1 hunks)v2/rscg_examples_site/docs/Categories/Serializer.md(1 hunks)v2/rscg_examples_site/docs/Categories/_PrimitiveSerializer.mdx(1 hunks)v2/rscg_examples_site/docs/RSCG-Examples/Csvcsharp.md(1 hunks)v2/rscg_examples_site/docs/RSCG-Examples/index.md(4 hunks)v2/rscg_examples_site/docs/about.md(1 hunks)v2/rscg_examples_site/docs/indexRSCG.md(2 hunks)v2/rscg_examples_site/src/components/HomepageFeatures/index.js(1 hunks)v2/rscg_examples_site/static/exports/RSCG.json(1 hunks)
🧰 Additional context used
🪛 Biome (2.1.2)
v2/rscg_examples/CsvCsharp/video.json
[error] 35-36: Property key must be double quoted
(parse)
[error] 36-36: unexpected character =
(parse)
[error] 36-36: expected , but instead found " "
Remove " "
(parse)
[error] 36-36: expected : but instead found }
Remove }
(parse)
[error] 37-38: Expected an array, an object, or a literal but instead found ']'.
Expected an array, an object, or a literal here.
(parse)
🪛 markdownlint-cli2 (0.18.1)
v2/rscg_examples_site/docs/RSCG-Examples/Csvcsharp.md
35-35: Bare URL used
(MD034, no-bare-urls)
43-43: Bare URL used
(MD034, no-bare-urls)
v2/rscg_examples_site/docs/indexRSCG.md
23-23: Spaces inside link text
(MD039, no-space-in-links)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: call-workflow-passing-data / build (24.3.0)
🔇 Additional comments (7)
v2/rscg_examples_site/docs/Categories/_PrimitiveSerializer.mdx (1)
3-21: LGTM with naming caveat.The Serializer category update correctly reflects 10 items with Csvcsharp as the first entry. However, ensure the casing "Csvcsharp" matches other files (see comments on GeneratorDataRec.json and list.html).
v2/rscg_examples_site/docs/RSCG-Examples/index.md (2)
3-4: LGTM!The count update to 235 is correct and consistent with the addition of the Csvcsharp example.
1262-1311: LGTM!The Serializer section is correctly updated to show 10 examples with the new Csvcsharp entry properly integrated.
v2/rscg_examples_site/docs/indexRSCG.md (1)
10-12: LGTM!The count update to 235 and the description accurately reflect the new addition of the Csvcsharp example.
v2/rscg_examples/CsvCsharp/src/.tours/Csvcsharp.tour (1)
1-13: LGTM!The Person class is correctly structured for CSV serialization with appropriate attributes and property definitions. The use of
partialclass allows the source generator to extend it, and initializingNametostring.Emptyprevents null reference issues.README.md (2)
7-7: Verify future date in README.The README shows the update date as "2025-10-05" (October 5), but the PR was created on "2025-10-04" (October 4). This date is in the future relative to the PR creation.
Is this intentional? If you're preparing this PR for a scheduled release on October 5, this is fine. Otherwise, consider using the current date:
-## Latest Update : 2025-10-05 => 05 October 2025 +## Latest Update : 2025-10-04 => 04 October 2025And:
-Generated on : 2025-10-05 => 05 October 2025 +Generated on : 2025-10-04 => 04 October 2025Also applies to: 31-31
29-50: New Csvcsharp entry looks good.The new entry follows the established format and includes all required information (author, description, NuGet package, documentation link, and source repository). The categorization under "Serializer" is appropriate.
| <tr> | ||
| <td>235</td> | ||
| <td><a href="examples/Csvcsharp.html">Csvcsharp</a></td> | ||
| </tr> |
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.
Naming inconsistency: "Csvcsharp" vs "CsvCsharp".
This uses "Csvcsharp" but v2/RSCGExamplesData/GeneratorDataRec.json uses "CsvCsharp" (line 1420). Ensure consistent casing across all files to prevent broken references.
🤖 Prompt for AI Agents
In v2/book/list.html around lines 965 to 968 the entry uses "Csvcsharp" which
mismatches the canonical "CsvCsharp" in
v2/RSCGExamplesData/GeneratorDataRec.json; update the anchor text to "CsvCsharp"
and the href to the correctly-cased file name (examples/CsvCsharp.html) so the
link and label match the JSON; verify other occurrences in this file use the
same casing.
| [CsvObject] | ||
| public partial class Person | ||
| { | ||
| [Column(0)] | ||
| public string Name \{ get; set; } | ||
|
|
||
| [Column(1)] | ||
| public int Age \{ get; set; } | ||
| } | ||
| ``` | ||
|
|
||
| All public fields/properties of a type marked with `[CsvObject]` must have either the `[Column]` or `[IgnoreMember]` attribute. (An analyzer will output a compile error if it does not find either attribute on public members.) | ||
|
|
||
| The `[Column]` attribute can specify a column index as an `int` or a header name as a `string`. | ||
|
|
||
| To serialize this type to CSV or deserialize it from CSV, use `CsvSerializer`. | ||
|
|
||
| ```cs | ||
| var array = new Person[] | ||
| { | ||
| new() \{ Name = "Alice", Age = 18 }, | ||
| new() \{ Name = "Bob", Age = 23 }, | ||
| new() \{ Name = "Carol", Age = 31 }, | ||
| } | ||
|
|
||
| // Person[] -> CSV (UTF-8) | ||
| byte[] csv = CsvSerializer.Serialize(array); | ||
|
|
||
| // Person[] -> CSV (UTF-16) | ||
| string csvText = CsvSerializer.SerializeToString(array); | ||
|
|
||
| // CSV (UTF-8) -> Person[] | ||
| array = CsvSerializer.Deserialize<Person>(csv); | ||
|
|
||
| // CSV (UTF-16) -> Person[] | ||
| array = CsvSerializer.Deserialize<Person>(csvText); | ||
| ``` | ||
|
|
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.
Fix escaped braces in the code samples
Every fenced C# snippet here escapes braces as \{/\}, so the published page renders those slashes. Anyone copying the samples gets invalid C# because of the stray backslashes. Please drop those escapes (and any similar ones later in the file) so the code remains compile-ready.
- public string Name \{ get; set; }
+ public string Name { get; set; }Likewise clean up the other snippets in this document.
Also applies to: 141-179
🤖 Prompt for AI Agents
In v2/rscg_examples_site/docs/RSCG-Examples/Csvcsharp.md around lines 93-130
(and similarly lines 141-179), the fenced C# code blocks contain escaped braces
like "\{" and "\}" which render the backslashes and break copy/paste into valid
C#; remove the backslashes so the braces are plain "{" and "}" in all code
snippets in these ranges (and scan remainder of the file for any other escaped
braces) to restore valid, compile-ready examples.
| ,{ | ||
| "file": "Serializer/obj/GX/VYaml.SourceGenerator/VYaml.SourceGenerator.VYamlIncrementalSourceGenerator/SerializerDemo.Person.YamlFormatter.g.cs", | ||
| "description": "Generated File 2 from 2 : SerializerDemo.Person.YamlFormatter.g.cs ", | ||
| "line": 1 | ||
| } |
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.
Inconsistent generator reference in Csvcsharp tour.
Step 4 references VYaml.SourceGenerator and generates a YamlFormatter.g.cs file, but this tour is specifically for the Csvcsharp (CSV) source generator. This appears to be a copy-paste error from another tour (possibly the VYaml example).
Remove this step or correct it to reference only CSV-related generated files:
- ,{
- "file": "Serializer/obj/GX/VYaml.SourceGenerator/VYaml.SourceGenerator.VYamlIncrementalSourceGenerator/SerializerDemo.Person.YamlFormatter.g.cs",
- "description": "Generated File 2 from 2 : SerializerDemo.Person.YamlFormatter.g.cs ",
- "line": 1
- }
- 📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ,{ | |
| "file": "Serializer/obj/GX/VYaml.SourceGenerator/VYaml.SourceGenerator.VYamlIncrementalSourceGenerator/SerializerDemo.Person.YamlFormatter.g.cs", | |
| "description": "Generated File 2 from 2 : SerializerDemo.Person.YamlFormatter.g.cs ", | |
| "line": 1 | |
| } |
🤖 Prompt for AI Agents
In v2/rscg_examples/CsvCsharp/src/.tours/Csvcsharp.tour around lines 26 to 30,
the tour step incorrectly references VYaml.SourceGenerator and a generated
YamlFormatter.g.cs file (likely a copy-paste error); update this step to either
remove it or replace it with the correct CSV source-generator output (e.g., the
CSV generator's generated file(s) and correct file path/description), ensuring
all generator names and generated filenames in the step match the Csvcsharp/CSV
example.
| ,{ | ||
| "file": "Serializer/obj/GX/Csv.SourceGenerator/Csv.SourceGenerator.CsvSerializerGenerator/SerializerDemo.Person.CsvSerializer.g.cs", | ||
| "description": "Generated File 1 from 2 : SerializerDemo.Person.CsvSerializer.g.cs ", | ||
| "line": 1 | ||
| } |
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.
🧩 Analysis chain
Verify generated file paths exist in repository.
The tour references generated files under Serializer/obj/GX/ which are typically not committed to source control. CodeTour users may encounter broken references when following this tour.
Verify whether these generated files are committed to the repository or if the tour should reference different files:
🏁 Script executed:
#!/bin/bash
# Check if generated files exist in the repository
fd -t f "\.g\.cs$" Serializer/obj/GX/ 2>/dev/null || echo "Generated files not found in obj directory"
# Check if obj directory is gitignored
if [ -f .gitignore ]; then
grep -n "obj/" .gitignore || echo "obj/ directory not found in .gitignore"
fiLength of output: 81
Fix CodeTour to use valid paths and ignore generated artifacts
- The tour entry at lines 32–36 points to
Serializer/obj/GX/...CsvSerializer.g.cs, which isn’t committed; update the tour to reference the source serializer file or include the generated file. - Add
obj/to.gitignoreto exclude build artifacts.
🤖 Prompt for AI Agents
In v2/rscg_examples/CsvCsharp/src/.tours/Csvcsharp.tour around lines 32–36 the
tour references a non-committed generated path
"Serializer/obj/GX/...Csv.SourceGenerator.CsvSerializerGenerator/SerializerDemo.Person.CsvSerializer.g.cs";
change that entry to point to the committed source serializer (e.g. the original
serializer source file under Serializer/ or the generated file path that exists
in the repo) so the tour links resolve, and separately update the repo
.gitignore to add "obj/" (or "Serializer/obj/") to ignore build artifacts;
ensure the tour entry path exactly matches the file location in the repository
after this change.
| var p2 = CsvSerializer.Deserialize<Person>(p1); | ||
|
|
||
| Console.WriteLine(p2.First().Name); | ||
| Console.WriteLine(p2.First().Age); No newline at end of file |
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.
Add null-safety check before accessing First().
If CsvSerializer.Deserialize<Person>(p1) returns an empty collection, First() will throw InvalidOperationException. Consider using FirstOrDefault() with a null check or ensure the collection is non-empty.
var p2 = CsvSerializer.Deserialize<Person>(p1);
-
-Console.WriteLine(p2.First().Name);
-Console.WriteLine(p2.First().Age);
+var first = p2.FirstOrDefault();
+if (first != null)
+{
+ Console.WriteLine(first.Name);
+ Console.WriteLine(first.Age);
+}🤖 Prompt for AI Agents
In v2/rscg_examples/CsvCsharp/src/Serializer/Program.cs around lines 8 to 11,
the code calls p2.First() without checking for an empty collection which can
throw InvalidOperationException; change to use FirstOrDefault() (or check
p2.Any()) and add a null check before accessing Name and Age, e.g. assign var
person = p2.FirstOrDefault(); if (person == null) handle the empty case (log or
exit) else write person.Name and person.Age to the console.
| {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/Csvcsharp#download-example-net--c-", | ||
| SpeakTest=" "}, | ||
| {"typeStep":"waitseconds","arg":"30"}, |
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.
Fix JSON syntax errors.
The JSON is malformed with multiple syntax errors:
- Line 35: Missing comma after the closing brace
- Line 36: Property key
SpeakTestmust be double-quoted - Line 36: Should use
:instead of=
This will cause parsing failures when the file is read.
-{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/Csvcsharp#download-example-net--c-",
-SpeakTest=" "},
+{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/Csvcsharp#download-example-net--c-",
+"SpeakTest":" "},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/Csvcsharp#download-example-net--c-", | |
| SpeakTest=" "}, | |
| {"typeStep":"waitseconds","arg":"30"}, | |
| {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/Csvcsharp#download-example-net--c-", | |
| "SpeakTest":" "}, | |
| {"typeStep":"waitseconds","arg":"30"}, |
🧰 Tools
🪛 Biome (2.1.2)
[error] 35-36: Property key must be double quoted
(parse)
[error] 36-36: unexpected character =
(parse)
[error] 36-36: expected , but instead found " "
Remove " "
(parse)
[error] 36-36: expected : but instead found }
Remove }
(parse)
🤖 Prompt for AI Agents
v2/rscg_examples/CsvCsharp/video.json around lines 35-37: the JSON is
malformed—add a comma after the closing brace of the first object, change the
property key SpeakTest to be double-quoted, and replace the `=` with `:` so the
property reads "SpeakTest": " " (ensure the value is a valid JSON string);
verify objects in the array are properly comma-separated and the overall JSON
remains valid.
| { | ||
| "ID":"CsvCsharp", | ||
| "Category":16, | ||
| "dtStart": "2025-10-05T00:00:00", | ||
| "show": true | ||
| } |
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.
Naming inconsistency: "CsvCsharp" vs "Csvcsharp".
The ID here is "CsvCsharp", but other files in this PR use "Csvcsharp" (e.g., v2/book/list.html line 967, v2/rscg_examples_site/static/exports/RSCG.json line 1878). This inconsistency may cause lookup failures or broken links.
Apply consistent casing throughout. If the correct name is "CsvCsharp", update the other files accordingly.
🤖 Prompt for AI Agents
In v2/RSCGExamplesData/GeneratorDataRec.json around lines 1419-1424, the ID is
"CsvCsharp" which conflicts with other files that use "Csvcsharp"; update the ID
to match the canonical casing used elsewhere (or, if canonical is "CsvCsharp",
update all other occurrences to match) so all references are consistent; search
the repo for "CsvCsharp" and "Csvcsharp", pick the correct canonical value, then
change this entry and any mismatched files (e.g., v2/book/list.html and
v2/rscg_examples_site/static/exports/RSCG.json) to the same exact casing to
avoid lookup/link failures.
Summary by CodeRabbit