Skip to content

Conversation

@jwilkinson87
Copy link
Contributor

This pull request introduces a new mechanism for handling arbitrary JSON:API resource types in form submission versions. It adds a central registry for mapping resource types to Kotlin classes, enables automatic hydration of resources from raw envelopes, and provides comprehensive test coverage for these features.

Resource type registration and mapping

  • Added a new ResourceTypeRegistry singleton to centrally register mappings from JSON:API resource types (e.g., "images", "operations") to Kotlin classes. This registry is initialized automatically in the Api class and in test setups. [1] [2] [3]

Resource hydration and lookup

  • Extended the FormSubmissionVersion model to support storing raw resource envelopes and added methods to:
    • Convert raw resources to typed envelopes.
    • Find envelopes or data by resource ID.
    • Hydrate attributes into the correct class based on registered type.
    • Provide a backwards-compatible raw map lookup.
    • Use a shared Jackson mapper configured to ignore unknown properties. [1] [2]

Testing and validation

  • Added a new test FormSubmissionVersionResourcesTest to validate that resources in a submission version can be auto-hydrated to their respective classes (e.g., Image, Operation) using the registry and envelope logic.
  • Provided a representative JSON fixture containing multiple resource types for thorough test coverage.

@github-actions
Copy link

There is a problem with the Gemini CLI PR review. Please check the action logs for details.

Copy link
Member

@andrew-waters andrew-waters left a comment

Choose a reason for hiding this comment

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

Sick of hydrating things in app?

@jwilkinson87
Copy link
Contributor Author

Sick of hydrating things in app?

Just a bit! 😄

@jwilkinson87 jwilkinson87 merged commit 5b34de4 into main Oct 21, 2025
2 of 3 checks passed
@jwilkinson87 jwilkinson87 deleted the feat/support-form-version-resources branch October 21, 2025 08:41
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.

3 participants