Skip to content

fix(concerto-core): serialize Map DateTime values without throwing TypeNotFoundException (#1546) - #1548

Open
tushaar-05 wants to merge 1 commit into
accordproject:mainfrom
tushaar-05:fix-1546-map-datetime-serialization
Open

tushaar-05 wants to merge 1 commit into
accordproject:mainfrom
tushaar-05:fix-1546-map-datetime-serialization

Conversation

@tushaar-05

Copy link
Copy Markdown
Contributor

Closes #1546

Summary

When serializing a Concerto resource that contains a map whose value type is DateTime (or a scalar extending DateTime), Serializer.toJSON() crashed with TypeNotFoundException: Namespace is not defined for type "DateTime". Additionally, map values containing null triggered an uncaught type lookup failure.

This PR fixes map serialization in JSONGenerator so that Dayjs instances are serialized to ISO-8601 formatted date-time strings respecting utcOffset, null values are preserved, and type resolution via modelManager.getType() is only performed for actual declared concept/asset models.

Changes

  • Updated JSONGenerator.visitMapDeclaration to:
    • Format dayjs DateTime values to ISO-8601 strings respecting utcOffset.
    • Guard null values so they do not trigger class declaration lookups.
    • Skip model declaration resolution for primitive and scalar value types.
  • Refactored JSONGenerator.formatDateTime helper reused by both visitMapDeclaration and convertToJSON.
  • Added unit tests in packages/concerto-core/test/serializer/maptype/serializer.js covering:
    • Map with dayjs DateTime values (Map<String, DateTime>).
    • Map with dayjs DateTime scalar values (Scalar extends DateTime).
    • Map with null value.
    • Map with dayjs DateTime values respecting custom utcOffset.

Flags

  • None.

Screenshots

Screenshot 2026-10-07 at 1 37 48 AM

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

Copilot AI balanced review requested due to automatic review settings October 6, 2026 21:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@tushaar-05

Copy link
Copy Markdown
Contributor Author

Hi @mttrbrts,

Could you please review this PR when convenient?

This fixes a TypeNotFoundException when serializing a Map with DateTime primitive or scalar values by ensuring primitive and scalar types bypass model declaration lookups in visitMapDeclaration, and formats them using the serializer's configured utcOffset.

Unit tests covering Map<String, DateTime>, scalar DateTime maps, null values, and UTC offsets have been added. All 1,304 core tests, linter, and license checks pass cleanly with DCO sign-off.

Thanks for your time!

@tushaar-05
tushaar-05 requested a balanced review from Copilot October 6, 2026 21:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…peNotFoundException (accordproject#1546)

Closes accordproject#1546

Signed-off-by: Tushar Singh <tusharsingh222555@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open with no activity. Remove the stale label or comment to keep it active. Only items with maintainer engagement are auto-closed.

@github-actions github-actions Bot added the Stale label Nov 21, 2026
@tushaar-05
tushaar-05 requested a balanced review from Copilot November 21, 2026 13:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions github-actions Bot removed the Stale label Nov 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(concerto-core): JSONGenerator crashes with TypeNotFoundException when serializing Map with DateTime values

2 participants