Skip to content

Error with data field in input JSON #204

@jmrenshaw

Description

@jmrenshaw

When using the JSON model format as input to create a report I am getting an error "expecting a list of pytm.Data, item number 0 is a <class 'str'>" (line 213 in the code snippet).
https://github.com/izar/pytm/blob/679ea0df19b7b92e7d8359891d53f7ed794d54a3/pytm/pytm.py#L194-L218
My input JSON for data and flows looks like this:
"flows": [
{
"name": "Actor 1 to Actor 2",
"source": "Actor 1",
"sink": "Actor 2",
"order": 1,
"data": [
"Data"
]
},{
"name": "Actor 2 to Actor 3",
"source": "Actor 2",
"sink": "Actor 3",
"description": "Another data flow",
"data": [
]
}
],
"data": [
{
"name": "Data",
"format": "Text",
"isPII": true
}
]

Which I believe matches the JSON format when using the JSON output of the CLI tool. Below is the function which leads to calling varData when it creates the Dataflow object. It seems like the varData function doesn't deal with a list of data name strings. input.json in the tests folder doesn't have a data field in it. Since data objects are not in either the boundaries, elements or flows section of the JSON should they be dealt with using their own function e.g. decode_data?
https://github.com/izar/pytm/blob/679ea0df19b7b92e7d8359891d53f7ed794d54a3/pytm/json.py#L92-L107

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