fortify-ps / FortifyPowerQueryConnectors

Power Query (Power BI) Connectors for Fortify
MIT License
0 stars 3 forks source link

Issue - FortifyPowerQueryConnectors - Cyclically defined type can not be created Details: through Power BI #4

Closed maamirkhan192 closed 11 months ago

maamirkhan192 commented 1 year ago

Hi All

when i parameter values under 3 fields from "listprojectversion" and add on Projectversion.name, Project.name and InstanceId in listIssueDetails I get below error

Expression.Error: Cyclically defined type can not be created Details: type=object required=[List] properties=[Record] description=Issue analysis trace node DTO.

Please note Same thing I check swagger it's working fine. but through Power BI I am getting above error

Any one can help me on this issue.

maamirkhan192 commented 12 months ago

@wtfacoconut Any update on the above issue

MikeTheSnowman commented 12 months ago

@wtfacoconut Any update on the above issue

Hey @maamirkhan192 , apologies for the delay reply. Work towards the end of the year and some sudden changes in my personal life are eating up huge amounts of time at the moment.

First, I was able to replicate the same issues as you. I'm not sure why, but powerbi is not properly generating the query parameter.

Not quite sure how to address this, but this is not the only issue where I won't be able to directly fix the issue as I'm currently relying on powerbi to auto generate the query parameter fields from SSC's swagger file.

I had been in the process of creating a new and improved powerbi connector to address these and other issues, but I won't have an update until after Christmas.

I'm currently in the process of changing homes, hence the delay.

maamirkhan192 commented 11 months ago

@wtfacoconut how to resolved the issue its bit urgent

when i parameter values under 3 fields from "listprojectversion" and add on Projectversion.name, Project.name and InstanceId in listIssueDetails I get below error

Expression.Error: Cyclically defined type can not be created Details: type=object required=[List] properties=[Record] description=Issue analysis trace node DTO.

Not working in Power BI Screenshot 2023-11-21 012110

Its working fine in Swagger UI Screenshot 2023-11-21 012637

MikeTheSnowman commented 11 months ago

Hey @maamirkhan192. Just a quick update. I'm still investigating, but I think I know what the issue is now. The issue is that the SSC swagger spec json file has a cyclical reference with the tracenode attribute.

Just for insight, here's the cyclical referency in the the spec.json file that Fortify SSC is returning to the Power BI connector:

image

Now, the question as to how this issue can be fixed, there are a few ways:

  1. The Fortify SSC engineers will need to update the spec.json to not have that cyclical reference
    • Pro: This will be a long term fix.
    • Con: This won't address the issue immediately for your version of Fortify SSC (only potentially the next version) and we could be waiting a while.
  2. I could embedd a modified copy of the spec.json file in the power query connector that removes the cyclic reference
    • Pro: This could result in addressing the issue faster
    • Con: The power query connector could become version locked to a specific version of SSC. Right now, the connector pulls the spec.json file from a user's desired Fortify SSC server (which can be any version) in order to auto generate all the quert functions and parameters.

For now, I'll try to do a quick test with embedding a modified copy of the spec.json file in the connector. I'll let you know how the test goes by tomorrow.

MikeTheSnowman commented 11 months ago

@maamirkhan192 . I've created a new release v0.4.1 (link to release) to address your issue. Please see my instructions/screenshots below:

Provide parameters as you did in Swagger: image

Then click on "table": image

Delete all colums with "error": image

Delete the "traceNodes" column: image

If you see an error, just ignore it: image

Quick test table to show the data that came from that query: image

maamirkhan192 commented 11 months ago

Hi @wtfacoconut thanks and can you please share the file FortifyConnector.mez so that I can replace that .

How you generate the .mez file

MikeTheSnowman commented 11 months ago

@maamirkhan192 , please see the link I provided to you and my previous comment. I've already generated the MEZ file for you in the release.

maamirkhan192 commented 11 months ago

@wtfacoconut how to parameterized this I have a lot project name , Project version and IntanceId in power bi et Source = FortifyConnector.FortifySSC(), listIssueDetail1 = Source{[Name="listIssueDetail"]}[Data],

"Invoked FunctionlistIssueDetail1" = listIssueDetail1("ASCENT", "ASCENT-TPCP-1.0", "ad5ee2ee-cde3-2a1b-8810-a09c6168dc9f"),

data = #"Invoked FunctionlistIssueDetail1"[data]

in data

MikeTheSnowman commented 11 months ago

@maamirkhan192 , can you maybe elaborate a bit more on what you're trying to accomplish for your Power BI report?

maamirkhan192 commented 11 months ago

@wtfacoconut

As there are multiple Project and and Project version and Instance DI so I want to extract the data at once for the multiple project's. I don't want to extract the table one by one every time

Screenshot 2023-11-21 200756

MikeTheSnowman commented 11 months ago

@maamirkhan192 , I'm not a Power BI expert, but here's what I came up with. I've also included an example report for you to take a look at. Example SSC Report with App and AppVersion Names Parameterized.zip

Example table output from a query that uses parameters. I'll show you what happens when I update the parameters. After updating the parameters, the table output will change. image

There are technically three parameters. We modify the ApplicationName and ApplicationVersionName parameters which then effect the projectVersionId that gets populated into the ApplicationVersionId parameter. image

Notice the ApplicationVersionId parameter and ApplicationVersionIssues query break when I change the value in ApplicationName. This is because we still need to update the ApplicationVersionName parameter. image

Modifying the ApplicationVersionName parameter to a name that actually exists within the Application in SSC results in the correct ApplicationVersionId being found and auto-populated into the parameter.

image image

The data now correctly populates in the query. In the Advanced Editor we can see the parameter. image image

Finally, you can see the table in the report updates with new info after we've sucessfully updated the parameters. image

maamirkhan192 commented 11 months ago

@wtfacoconut I am bit confused on your example. it will be good if you used listIssueDetail for Projectversion.name, Project.name and InstanceId in listIssueDetails

284470775-b917e4c6-c182-4d3c-956c-c1f05d3e3385

MikeTheSnowman commented 11 months ago

@maamirkhan192 , the query that you're running with listIssueDetails will only provide you information for a single issue/vulnerability from an Application Version.

I assume that you want information for more than one issue right?

MikeTheSnowman commented 11 months ago

@maamirkhan192 , it looks like the original technical problem that you raised in this issue has been resolved.

Can I ask that you please create a new issue for your issue about parameters?

I'd like to close this issue as the conversation now is no longer about the original problem.

MikeTheSnowman commented 11 months ago

@maamirkhan192 , I'm closing this issue now as I believe that we've addressed the original problem that you raised.