INNER CODE UNIT · Python

parse_args

usnistgov/OSCAL · src/utils/oscal-content-validator.py:35

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument("-s", "--oscal-schema", default=False, required=True,
                        action="store", dest="oscal_schema",
                        help="An OSCAL schema file.")
    parser.add_argument("-f", "--oscal-file", default=False, required=True,
                        action="store", dest="oscal_file",
                        help="An OSCAL data file.")
    return parser.parse_args()


def oscal_validator(oscal_schema, oscal_data):
    schema, stype = read_file(oscal_schema, _get_oscal_file_type(oscal_schema))
    data, ftype = read_file(oscal_data, _get_oscal_file_type(oscal_data))

    if ftype == 'json' or ftype == 'yaml':
        # Yaml files are validated using the json schema
        validate(data, schema)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…