ricardozanini commented on code in PR #2749:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2749#discussion_r1852373791


##########
packages/kn-plugin-workflow/pkg/specs/openapi_minifier.go:
##########
@@ -194,6 +182,66 @@ func (m *OpenApiMinifier) minifySpecsFile(specFileName 
string, operations sets.S
        return minifiedFile, nil
 }
 
+func (m *OpenApiMinifier) removeUnusedNodes(data []byte, specFileName string, 
operations sets.Set[string]) (*openapi3.T, error) {
+       doc, err := openapi3.NewLoader().LoadFromData(data)
+
+       collector, err := newCollector(specFileName)
+       if err != nil {
+               return nil, err
+       }
+
+       keep, err := collector.collect(operations)
+       if err != nil {
+               return nil, err
+       }
+
+       if err != nil {
+               return nil, fmt.Errorf("❌ ERROR: failed to load OpenAPI 
document: %w", err)
+       }
+       if doc.Paths == nil {
+               return nil, fmt.Errorf("OpenAPI document %s has no paths", 
specFileName)

Review Comment:
   Do we want to return an error here? Maybe just log silently to not spur the 
user's console with an error. If this is handled by the caller, just ignore my 
comment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to