Skip to content

Commit

Permalink
fix: test_generate_sample_model - OscalVersion
Browse files Browse the repository at this point in the history
Signed-off-by: Lou DeGenaro <[email protected]>
  • Loading branch information
degenaro committed Apr 19, 2024
1 parent 11539f5 commit 6641d7b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion trestle/core/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from trestle.common.str_utils import AliasMode
from trestle.core.base_model import OscalBaseModel
from trestle.oscal import OSCAL_VERSION
from trestle.oscal.common import Base64, Base64Datatype, Methods, ObservationTypeValidValues, TaskValidValues
from trestle.oscal.common import Base64, Base64Datatype, Methods, ObservationTypeValidValues, OscalVersion, TaskValidValues
from trestle.oscal.ssp import DateDatatype

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -203,6 +203,9 @@ def generate_sample_model(
# the only type of collection possible after OSCAL 1.0.0 is list
if safe_is_sub(model, OscalBaseModel):
for field in model.__fields__: # type: ignore
if model_type in [OscalVersion]:
model_dict[field] = OSCAL_VERSION
break
if field == 'include_all':
if include_optional:
model_dict[field] = {}
Expand Down

0 comments on commit 6641d7b

Please sign in to comment.