Skip to content

Commit

Permalink
style(optional artifact): catch the cause for misleading warning
Browse files Browse the repository at this point in the history
This changes ensures the warning for optional artifacts will only be printed in valid cases.
  • Loading branch information
mostaphaRoudsari committed Feb 24, 2021
1 parent b0026ce commit d7a5c01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion queenbee/base/basemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import yaml
from pydantic import BaseModel as PydanticBaseModel
from pydantic import validator, Field, constr, Extra
from pydantic import validator, Field, constr

from .parser import parse_file
from .variable import get_ref_variable
Expand Down
4 changes: 3 additions & 1 deletion queenbee/io/inputs/dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ class DAGFolderInput(DAGGenericInput):
@validator('required', always=True)
def check_required(cls, v, values):
"""Overwrite check_required fro artifacts to allow optional artifacts."""
default = values.get('default', None)
if 'default' not in values:
return v
default = values.get('default')
name = values.get('name', None)
if default is None and v is False:
warnings.warn(
Expand Down

0 comments on commit d7a5c01

Please sign in to comment.