Skip to content

Get string representation of validation results the way print_results() displays #192

@jondricek

Description

@jondricek

It would be great to be able to get the results of the stix2validator.print_results() function as a string representation. Take the base example currently in the Readme:

from stix2validator import validate_file, print_results

results = validate_file("stix_file.json")
print_results(results)

It would be nice to do e.g. foo = print_results(results) or something similar to get that as a string to work with.

Alternately maybe the results variable (a stix2validator.validators.FileValidationResults object) could have a __repr__ function built into it that provides the same output? If it went that direction it could probably make use of the FileValidationResults.as_dict() function here. Maybe?

Any thoughts on best way to implement this before I go off and make something up that works for me and do a pull request?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions