Chaffelson / nipyapi

A convenient Python wrapper for Apache NiFi
Other
243 stars 76 forks source link

Unable to export ProcessGroups due to wrong (de)serialisation #354

Open michaelarnauts opened 3 weeks ago

michaelarnauts commented 3 weeks ago

Description

I'm trying to export a ProcessGroup to JSON with the API, using the nipyapi.nifi.apis.ProcessGroupsApi().export_process_group(pg.id) API.

The current output is a Python string representation of a JSON, but this is useless, since it's not a valid JSON, and it can't be loaded with json.loads().

Actual JSON:

{"flowContents":{"identifier":"a9a4cae3-72e5-33c8-b6be-7879e79e5ded","instanceIdentifier":"2f968272-0190-1000-9f4a-82702...

Returned JSON:

{'flowContents': {'identifier': 'a9a4cae3-72e5-33c8-b6be-7879e79e5ded', 'instance...

This is because the output format of the exportProcessGroup action is defined as a string. When I change this to object in the swagger definition and regenerate the models, it works as expected, and I get back a dict that I can convert back to a real json string to write to a file.

I notice some other API's are also defined with output as string that should probably be object (exportTemplate, exportFlowVersion)

What I Did

See above

Urgency

We can't use the export_process_group API.