How to validate software design?
Date : March 29 2020, 07:55 AM
may help you . It's definitely sad when other programmers care little about good software design. The only things I can suggest to do are: Follow some of the excellent developers around the world on their blogs to gain insights into their ideas Continue to encourage those around you to become interested in good design If there is no one local to validate your designs you can make friends with other developers online and ask them the validate ideas for you Participate in open source software and use that as a source of validation for your ideas Ask questions on stackoverflow.com about your ideas Keep programming and learn from your experiences Don't stay at your current company too long. Moving companies is a great way to keep yourself from getting comfortable and complacent Get involved in a local user group filled with like minded developers
|
How to use aurelia-validate with a object properties to validate?
Date : March 29 2020, 07:55 AM
will help you The validation works in all kinds of situations, but using the @ensure decorator can only be used to declare your rules on simple properties (like you found out). Hence... import {Validation} from 'aurelia-validation';
import {ItemService} from './service';
export class EditItem {
static inject() {
return [Validation, ItemService];
}
constructor(validation, service) {
this.validation = validation.on(this)
.ensure('item.url')
.isNotEmpty()
.hasMinLength(10)
.matches(/^https?:\/\/.{3,}$/) //looks like a url
.matches(/^\S*$/)
.ensure('item.name')
.isNotEmpty()
.hasLengthBetween(3,10);
this.service = service;
this.item = null;
}
activate(params){
return this.service.getItem(params.id).then(res => {
console.log(res);
this.item = res.content; //populate with object from api call
});
}
update() {
this.validation.validate().then(
() => {
var data = {
name: this.item.name,
url: this.item.url
};
this.service.updateItem(data).then(res => {
this.message = "Thank you!";
})
}
);
}
|
hapi js api design joi validate error
Date : March 29 2020, 07:55 AM
it should still fix some issue If you want to have a key like "techSpecMeta.make" it needs to be in quotes. payload: {
vehRegNumber: Joi.string().required(),
'techSpecMeta.make': Joi.string().required()
}
|
Best practice to validate properties based on other properties
Tag : chash , By : kdietz
Date : March 29 2020, 07:55 AM
This might help you Restructure? By the looks of your posted code snippets, I presume that MyForm will never have a populated Custom1 and Custom2 property in the same request. So, instead of having a parent model that holds both payload kinds, I would encourage you to directly use the model that represents the payload being validated. Then you won't run into this nasty pattern of checking the kind wherever necessary.
|
I want to validate password using react with ant design
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Use validator rule: const validatePassword = (rule, value, callback) => {
if (value && value !== "Secret") {
callback("Error!");
} else {
callback();
}
};
<FormItem>
{getFieldDecorator("password", {
rules: [
{ required: true, message: "Please input your Password!" },
{ validator: validatePassword }
]
})(
<Input
type="password"
placeholder="Password"
/>
)}
</FormItem>
|