Skip to content

Phase 3: .NET XSD example standalone (in-language schema resolver)#16

Merged
karlkauc merged 1 commit into
mainfrom
feat/dotnet-shared-resolver
May 16, 2026
Merged

Phase 3: .NET XSD example standalone (in-language schema resolver)#16
karlkauc merged 1 commit into
mainfrom
feat/dotnet-shared-resolver

Conversation

@karlkauc

Copy link
Copy Markdown
Contributor

Why

Phase 3 of 4. The .NET XSD validation example needed the bash tools/fetch-schema.sh to materialise the schema. This makes it resolve the official XSD itself — same convention already shipped for Java (Phase 1) and Python (Phase 2).

What changed

  • XSD_Validation/dotnet/SchemaResolver.cs (new): identical 3-step convention — $FUNDSXML_SCHEMA_DIR (offline/corporate escape hatch) → .schema-cache/ → download from the official GitHub release (HttpClient auto-follows the 302; pulls the xmldsig-core-schema.xsd sibling when imported). Kept as a second file in the same project (self-contained example), consistent with the Phase 1 Java inline decision. The plan's shared Funds.Common project was dropped: only XsdValidate needs schema resolution (Schematron uses a jar, SignVerify uses keys), so a shared project referenced by non-users would be noise.
  • XsdValidate.cs uses SchemaResolver.Resolve(); removed the run tools/fetch-schema.sh failure path.
  • CI: new .NET - XSD validation (in-language schema resolve) step (cache-hit / $FUNDSXML_SCHEMA_DIR / negative fixture), mirroring the Java & Python steps.
  • SchematronValidate.cs: SchXslt-jar discovery made standalone ($FUNDSXML_SCHXSLT_JAR or the Maven local repo), mirroring the Python reference variant.

Pre-existing latent bugs fixed (found while building these projects)

  • XML comments in XsdValidate.csproj, SchematronValidate.csproj, SignVerify.csproj all contained -- → invalid XML (MSB4025); those projects could not be built at all before this PR.
  • The Schematron reference variant referenced a non-existent SaxonHE 12.5.0 NuGet id. Saxon-HE-for-.NET 12 ships as fragmented SaxonHE12Net* packages whose id/version/TFM pairing is environment-specific; that path is now clearly marked an unverified reference (the Java Schematron example is the verified, fully standalone path — and the .NET Schematron also needs the SchXslt jar, which has no NuGet distribution). Not in CI.

Verification

dotnet run --project XSD_Validation/dotnet verified locally: cold download, cache-hit, $FUNDSXML_SCHEMA_DIR override, negative fixture exits 1. All .csproj are now well-formed XML.

Phase 4 (CLI sh+.ps1 pair, delete fetch-schema.sh + remaining .sh, full CI rewrite incl. windows-latest leg) follows as a separate PR off fresh main.

🤖 Generated with Claude Code

Mirror Phase 1/2: the .NET XSD validation example resolves the official
schema itself instead of needing a prior tools/fetch-schema.sh.

- New XSD_Validation/dotnet/SchemaResolver.cs: same 3-step convention as
  the Java/Python resolvers — $FUNDSXML_SCHEMA_DIR (offline/corporate
  escape hatch) -> .schema-cache/ -> download from the official GitHub
  release (HttpClient auto-follows the 302; pulls the xmldsig sibling when
  imported). Kept as a 2nd file in the SAME project (self-contained
  example), consistent with the Phase 1 Java inline decision; the plan's
  shared Funds.Common project was dropped — only XsdValidate needs schema
  resolution (Schematron uses a jar, SignVerify uses keys), so a shared
  project referenced by non-users would be noise.
- XsdValidate.cs uses SchemaResolver.Resolve(); dropped the
  "run tools/fetch-schema.sh" error path.
- CI: new ".NET - XSD validation (in-language schema resolve)" step
  (cache-hit / $FUNDSXML_SCHEMA_DIR / negative fixture), mirroring the
  Java and Python steps.
- SchematronValidate.cs: SchXslt jar discovery made standalone
  ($FUNDSXML_SCHXSLT_JAR or the Maven local repo), mirroring the Python
  reference variant; comments corrected.

Fixed pre-existing latent bugs found while building these projects: the
XML comments in XsdValidate.csproj, SchematronValidate.csproj and
SignVerify.csproj all contained `--` (invalid XML -> MSB4025; those
projects could not be built at all). Also corrected the non-existent
`SaxonHE 12.5.0` PackageReference in the Schematron reference variant
(Saxon-HE-for-.NET 12 ships as SaxonHE12Net* packages; that path stays a
clearly-marked unverified reference — Java is the verified Schematron path).

Verified locally with `dotnet run`: cold download, cache-hit,
$FUNDSXML_SCHEMA_DIR override, negative fixture (exit 1). All .csproj are
now well-formed XML.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@karlkauc karlkauc merged commit 923600b into main May 16, 2026
2 checks passed
@karlkauc karlkauc deleted the feat/dotnet-shared-resolver branch May 16, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant