Conversation
When UseOriginalNames=true, XML element and attribute names are used as-is for generated property and constructor parameter names, instead of being normalized to PascalCase/camelCase. Addresses #1432 (dsyme endorsed 2022-03-28). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
✅ Pull request created: #1629 |
|
✅ Commit pushed: |
…names-42eda4f9851807b6
|
/repo-assist Update this PR to add this same UseOriginalNames parameter to CsvProvider and JsonProvider if it makes sense for those. |
- CsvProvider: UseOriginalNames=true preserves column header names verbatim instead of capitalizing the first letter - JsonProvider: UseOriginalNames=true preserves JSON property names verbatim instead of normalizing to PascalCase Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
✅ Commit pushed: |
|
🤖 This is an automated update from Repo Assist. Done! I've extended Changes
|
|
/repo-assist Add tests for all three type providers |
…ider Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Commit pushed:
|
|
🤖 Repo Assist here. Done! I've added 6 tests covering
All 6 tests pass ✅ and
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Commit pushed:
|
…names-42eda4f9851807b6
… list syntax After PR #1629 (UseOriginalNames) was merged into main, the DtdProcessing branch had a merge conflict residue in XmlProvider.fs: 1. Both dtdProcessing and useOriginalNames were assigned from args.[11] - dtdProcessing should be args.[11] (DtdProcessing param, index 11) - useOriginalNames should be args.[12] (UseOriginalNames param, index 12) 2. The static parameters list had two closing brackets causing a syntax error that Fantomas could not parse. 3. The helpText had a duplicate triple-quote after the DtdProcessing param doc. Build verified (0 errors), Fantomas clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
#1632) (#1635) * Add DtdProcessing static parameter to XmlProvider Allow users to control DTD handling via XmlProvider<..., DtdProcessing="Ignore"> to support XML files with DTD declarations (Nmap scan output, XHTML, etc.). - Default is "Prohibit" (preserves existing security posture — throws on DTD) - "Ignore" silently skips DTD processing (safe for most real-world cases) - "Parse" enables full DTD entity expansion (use with caution) XmlElement.Create/CreateList now have dtdProcessing overloads; the no-arg overloads delegate to "Prohibit" for backward compatibility. Design-time sample parsing also respects the new parameter. Addresses #1632. Closes #1634. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Change DtdProcessing default to Ignore (opt-out instead of opt-in) Users who want strict DTD prohibition can opt-out via DtdProcessing="Prohibit". Update snapshot files and test defaults to reflect new default. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix build: add missing 'open System.Xml' and fix CreateList to use XmlReader - Add 'open System.Xml' so DtdProcessing, XmlReaderSettings and XmlReader are resolved (fixes FS0039 build errors on Windows and Linux CI). - Fix CreateList to parse via XmlReader.Create with the XmlReaderSettings, so the DtdProcessing setting is actually respected (previously the xmlReaderSettings variable was created but then ignored by XDocument.Parse). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: trigger CI checks * Fix: update remaining signature snapshots for DtdProcessing parameter The 9 snapshot files that use network-loaded XML samples (tomasp.net RSS feed) and XSD schema files (IncludeFromWeb.xsd) were not updated in the previous snapshot regeneration run. Update them to include the new DtdProcessing argument in all XmlElement.Create calls. All 486 DesignTime tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: trigger CI checks * Fix merge conflict residue in XmlProvider.fs: correct arg indices and list syntax After PR #1629 (UseOriginalNames) was merged into main, the DtdProcessing branch had a merge conflict residue in XmlProvider.fs: 1. Both dtdProcessing and useOriginalNames were assigned from args.[11] - dtdProcessing should be args.[11] (DtdProcessing param, index 11) - useOriginalNames should be args.[12] (UseOriginalNames param, index 12) 2. The static parameters list had two closing brackets causing a syntax error that Fantomas could not parse. 3. The helpText had a duplicate triple-quote after the DtdProcessing param doc. Build verified (0 errors), Fantomas clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: trigger CI checks * fix: WorldBank API 400 Bad Request from empty date= parameter The WorldBank v2 API started returning 400 Bad Request when the 'date' query parameter is present but empty (date=). Remove the empty date parameter from GetDataAsync so the API returns all available years by default (omitting 'date' entirely has the same meaning as passing an empty one, but the API now rejects the latter). Also update WorldBankProvider test exception handlers to mark tests as Inconclusive on 400 errors, providing belt-and-suspenders resilience against future API changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: trigger CI checks --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Repo Assist <repo-assist@github.com> Co-authored-by: Don Syme <dsyme@users.noreply.github.com>
🤖 This is an automated draft PR from Repo Assist, an AI assistant.
Summary
Adds a new
UseOriginalNamesstatic parameter toXmlProvider. WhenUseOriginalNames=true, XML element and attribute names are used verbatim for generated property and constructor parameter names, instead of being normalized to PascalCase/camelCase.Addresses #1432 (endorsed by @dsyme in 2022-03-28).
Root Cause
XmlGenerator.fsalways appliesNameUtils.nicePascalNameto element/attribute names when generating property names, andNameUtils.niceCamelNamefor constructor parameters. There was no way to opt out of this normalization.Fix
UseOriginalNames: boolfield toXmlGenerationContextXmlGenerationContext.Createto acceptuseOriginalNames: booland store itmakeUniquegenerators inXmlGenerator.fsto use identity instead ofnicePascalNamewhenUseOriginalNames = trueniceCamelNameconstructor parameter generation similarlyUseOriginalNamesstatic parameter toXmlProvider.fs(index 11, defaultfalse)Example
Trade-offs
NameUtils.uniqueGeneratorhandles name-clash deduplication with the new identity transform)NameUtils.pluralizeis still applied to collection element names (this preserves grammatical sensibility for array properties)UseOriginalNamesflagTest Status
FSharp.Data.Testspassfantomasformatting applied and build re-verified