Skip to content

feat: #458 Support enums as strings in APIs with JsonStringEnumConverter - transparent client-side conversion#589

Closed
ascott18 with Copilot wants to merge 6 commits into
mainfrom
copilot/fix-458
Closed

feat: #458 Support enums as strings in APIs with JsonStringEnumConverter - transparent client-side conversion#589
ascott18 with Copilot wants to merge 6 commits into
mainfrom
copilot/fix-458

Conversation

Copilot AI commented Aug 10, 2025

Copy link
Copy Markdown
Contributor
  • Inspect current branch state and recent commits
  • Rebase branch onto main
  • Update TS enum generation to string-based enums for JsonStringEnumConverter enums
  • Update related docs/changelog for client enum representation
  • Run targeted tests for affected areas
  • Run full required validation sequence and final review/security checks
  • Reply to review comment with commit hash

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits August 10, 2025 15:42
Co-authored-by: ascott18 <5017521+ascott18@users.noreply.github.com>
…port

Co-authored-by: ascott18 <5017521+ascott18@users.noreply.github.com>
Copilot AI changed the title [WIP] Support enums as strings in APIs feat: #458 Support enums as strings in APIs with JsonStringEnumConverter Aug 10, 2025
Copilot AI requested a review from ascott18 August 10, 2025 15:48
@ascott18

Copy link
Copy Markdown
Collaborator

@copilot No, you missed the point. This ONLY affects the format of the enums over the wire. Turn them back into numbers on the client when parsing the results, and turn them back into strings when mapping them to DTOs

…e enums numeric with transparent conversion

Co-authored-by: ascott18 <5017521+ascott18@users.noreply.github.com>

Copilot AI commented Aug 10, 2025

Copy link
Copy Markdown
Contributor Author

@copilot No, you missed the point. This ONLY affects the format of the enums over the wire. Turn them back into numbers on the client when parsing the results, and turn them back into strings when map...

You're absolutely right. I've corrected the approach in commit 33446a7.

The implementation now:

  • Keeps TypeScript enums numeric (e.g., FirstValue = 1 not "FirstValue")
  • Keeps property types as enum types (e.g., StringSerializedEnum | null not string | null)
  • Adds transparent conversion in serialization layer:
    • parseValue() converts incoming string values to numbers for client use
    • MapToDtoVisitor converts outgoing number values to strings for the server
  • Uses serializeAsString metadata flag to detect which enums need conversion

This maintains the numeric enum behavior client-side while transparently handling string serialization over the wire, exactly as you described. All 568 coalesce-vue tests pass.

Copilot AI changed the title feat: #458 Support enums as strings in APIs with JsonStringEnumConverter feat: #458 Support enums as strings in APIs with JsonStringEnumConverter - transparent client-side conversion Aug 10, 2025
@ascott18

Copy link
Copy Markdown
Collaborator

@copilot you didn't update the docs OR the changelog like you are instructed to do in your instructions file

Co-authored-by: ascott18 <5017521+ascott18@users.noreply.github.com>

Copilot AI commented Aug 11, 2025

Copy link
Copy Markdown
Contributor Author

@copilot you didn't update the docs OR the changelog like you are instructed to do in your instructions file

I've now updated both the documentation and changelog as instructed. Added a changelog entry in the Features section and comprehensive documentation for enum string serialization in the properties guide. Commit c2d1282.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • axios-http.com
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • csrc.nist.gov
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • date-fns.org
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • developer.mozilla.org
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • docs.github.com
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • docs.microsoft.com
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • en.wikipedia.org
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • http://dotnet.microsoft.com:80/robots.txt
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (http block)
  • http://github.com:80/robots.txt
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (http block)
  • http://nodejs.org:80/robots.txt
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (http block)
  • img.shields.io
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • intellitect.github.io
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • learn.microsoft.com
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • marketplace.visualstudio.com
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • router.vuejs.org
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • v3-migration.vuejs.org
  • vitejs.dev
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • vuejs.org
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • vuetifyjs.com
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • www.hangfire.io
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • www.kalzumeus.com
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • www.nuget.org
  • www.twilio.com
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)
  • www.typescriptlang.org
    • Triggering command: /home/REDACTED/work/Coalesce/Coalesce/node_modules/linkcheck-bin/vendor/linkcheck/linkcheck localhost:8087/Coalesce -e --skip-file ./.vitepress/linkcheck-skip-file.txt (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@ascott18 ascott18 closed this Sep 3, 2025
@ascott18 ascott18 reopened this Apr 21, 2026
@ascott18

Copy link
Copy Markdown
Collaborator

@copilot rebase on main. Then adjust the implementation to have the enums generated in the TS models as string-based enums instead of number-based enums.

Copilot AI commented Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

@copilot rebase on main. Then adjust the implementation to have the enums generated in the TS models as string-based enums instead of number-based enums.

Done in 9126d0a. The branch is rebased on main, and enums marked with JsonStringEnumConverter are now generated in TypeScript models as string-valued enums (instead of numeric). I also updated runtime enum parsing/mapping and related tests/docs/changelog to match this behavior.

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.

2 participants