Skip to content

Validate proposal against schema in submission endpoint#604

Open
valentin0h wants to merge 11 commits intodevfrom
validate-proposal--against-schema
Open

Validate proposal against schema in submission endpoint#604
valentin0h wants to merge 11 commits intodevfrom
validate-proposal--against-schema

Conversation

@valentin0h
Copy link
Collaborator

@valentin0h valentin0h commented Feb 14, 2026

Validate proposal data against the template schema when submitting, including fields stored in TipTap collaboration documents. Assembles field values from Yjs document fragments and validates them server-side on submission

Frontend validations will be handled separately.

@vercel
Copy link
Contributor

vercel bot commented Feb 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview Feb 16, 2026 1:42am

Request Review

submitProposal now fetches field values from the TipTap collaboration
document instead of validating against the cached proposalData DB column.
This fixes validation rejecting proposals with custom template fields
that only exist in the Yjs doc.

- assembleProposalData: maps fragment text to the shape AJV expects
- getProposalFragmentNames: returns all template fields, not just text
- submitProposal: fetches fragments when collaborationDocId exists,
  falls back to proposalData for legacy proposals
- Tests seed fragments via mockCollab.setDocFragments()
- Add XFormat, ProposalPropertySchema, ProposalTemplateSchema to shared types
- Remove duplicate type definitions from frontend compileProposalSchema
- Remove unsafe casts in assembleProposalData and submitProposal
- Widen resolveProposalTemplate param to accept DecisionInstanceData directly
…emplate to ProposalTemplateSchema

Replace manual JSON.parse + money field handling with normalizeBudget,
refactor if/else chain to switch/case, and propagate ProposalTemplateSchema
through resolveProposalTemplate and its callers to eliminate type casts.
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