Skip to content

Extend automatic form generation endpoint with sanity checks#73

Merged
bzimonjaSDPR merged 14 commits into
devfrom
ADO-3075
Aug 6, 2025
Merged

Extend automatic form generation endpoint with sanity checks#73
bzimonjaSDPR merged 14 commits into
devfrom
ADO-3075

Conversation

@danilomeireles
Copy link
Copy Markdown
Collaborator

@danilomeireles danilomeireles commented Jul 31, 2025

What changes did you make?

Added three new validation checks to the generateNewTemplate function to ensure data integrity and prevent mismatched form generation:

Template ID validation: Verify that the requested template_id matches the template stored in ICM metadata
Tool validation: Ensure the ICM metadata indicates "formfoundry" as the designated tool (case-insensitive)
Area validation: Validate that the request area parameter matches the ICM category when an area is specified (case-insensitive, optional)

Why did you make these changes?

These validations prevent potential issues:

  • Ensures forms are only generated for the correct template ID, preventing cross-template data corruption
  • Confirms that the attachment is designated for FormFoundry processing, preventing form generation by other tools
  • Validates that form requests are processed in the correct business area/category context
  • Provides clear feedback to clients when requests contain invalid or mismatched data

What alternatives did you consider?

No other alternatives were considered as this endpoint is the right place for these validations.

Checklist

  • I have assigned at least one reviewer
  • My code meets the style guide
  • My code has adequate test coverage (if applicable)

@danilomeireles danilomeireles changed the title Ado 3075 Extend automatic form generation endpoint with sanity checks Aug 1, 2025
@danilomeireles danilomeireles marked this pull request as ready for review August 1, 2025 21:43
Comment thread generateHandler.js Outdated
Copy link
Copy Markdown
Collaborator

@bzimonjaSDPR bzimonjaSDPR left a comment

Choose a reason for hiding this comment

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

Please check into dev first. We don't use main.

@danilomeireles danilomeireles changed the base branch from main to dev August 6, 2025 00:17
@bzimonjaSDPR bzimonjaSDPR merged commit 7c369ec into dev Aug 6, 2025
3 checks passed
@bzimonjaSDPR bzimonjaSDPR deleted the ADO-3075 branch August 6, 2025 00:20
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.

4 participants