balderdashy / balderdashy/sails

sails action2 actions inputs validation message show in ejs file

Open
#6,906 3 comments 0 reactions 0 assignees View on GitHub
helpful info or workaround
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**Node version**: 12.13.1
**Sails version** _(sails)_: 1.2.3
**ORM hook version** _(sails-hook-orm)_: 2.1.1


code:
inputs: {
policy_type: {
type: 'string',
required: true
},

policy_number: {
type: 'string',
required: true
},
verifier_id: {
type: 'number',
required: true
},

Error message object
{
"code": "E_MISSING_OR_INVALID_PARAMS",
"problems": [
"Invalid \"verifier_id\":\n · Expecting a number, but got a string."
],
"message": "The server could not fulfill this request (`POST /policy/store`) due to 1 missing or invalid parameter. **The following additional tip will not be shown in production**: Tip: Check your client-side code to make sure that the request data it sends matches the expectations of the corresponding parameters in your server-side route/action. Also check that your client-side code sends data for every required parameter. Finally, for programmatically-parseable details about each validation error, `.problems`. "
}

Problem:
I want validation message should pass in view without displaying directly like above

Contributor guide

Open the contributing guide

Research direction

Reproduce POST /policy/store using the action2 inputs shown, especially a string value for verifier_id, and inspect how the validation response reaches the EJS view. The issue does not name a file or test; done should mean the validation message is passed to the view without being displayed directly as the raw response.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.