Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feat required config#48

Open
ycjcl868 wants to merge 4 commits intonode-modules:master from
ycjcl868:feat-required-config
Open

Feat required config #48
ycjcl868 wants to merge 4 commits intonode-modules:master from
ycjcl868:feat-required-config

Conversation

@ycjcl868
Copy link

@ycjcl868 ycjcl868 commented Aug 8, 2018

No description provided.

Copy link

codecov bot commented Aug 8, 2018
edited
Loading

Codecov Report

Merging #48 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@
## master #48 +/- ##
=====================================
 Coverage 100% 100% 
=====================================
 Files 1 1 
 Lines 162 164 +2 
 Branches 56 57 +1 
=====================================
+ Hits 162 164 +2
Impacted Files Coverage Δ
index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 157712a...b8d4fa6. Read the comment docs.

Copy link
Author

ycjcl868 commented Aug 8, 2018
edited
Loading

The condition is when having a create and edit common interface , I may code like this:

const schema = {
 userId: {
 type: 'int'
 },
 title: {
 required: false,
 type: 'string',
 },
 brief: {
 required: false,
 type: 'string',
 },
 content: {
 required: false,
 type: 'string',
 },
 xxx1: {
 required: false,
 type: 'string',
 },
 ...
 }
ctx.validate(schema, myParams);

index.js Outdated
this.validateRoot = true;
}
this.defaultRequired = opts.defaultRequired !== undefined ?
opts.defaultRequired :
Copy link
Member

@dead-horse dead-horse Aug 8, 2018

Choose a reason for hiding this comment

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

this.defaultRequired = opts.defaultRequired !== false;

Copy link
Author

@ycjcl868 ycjcl868 Aug 8, 2018
edited
Loading

Choose a reason for hiding this comment

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

thx for cr ! ~

index.js Outdated
if (rule.required !== false) {
var required = rule.required !== undefined ?
rule.required :
this.defaultRequired;
Copy link
Member

@dead-horse dead-horse Aug 8, 2018

Choose a reason for hiding this comment

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

放一行吧,这样缩进有点奇怪

Copy link
Author

@ycjcl868 ycjcl868 Aug 8, 2018
edited
Loading

Choose a reason for hiding this comment

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

嗯嗯,已修改。 839d425

docs: options.defaultRequired
Copy link
Member

fengmk2 commented Sep 19, 2018

rebase ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@dead-horse dead-horse dead-horse left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /