gravitee-io / issues

Gravitee.io - API Platform - Issues
65 stars 26 forks source link

No flow in Design API #9242

Closed exalate-issue-sync[bot] closed 1 year ago

exalate-issue-sync[bot] commented 1 year ago

Describe the bug :

There’s a bug with the MockPolicy only, or something that’s not compatible with it.

When importing the swagger for the api, the policies are missing in api created by stoplight.

To Reproduce :

Steps to reproduce the behaviour:

  1. Import api :

[MDMAPI.yaml^!/images/icons/link_attachment_7.gif!^| /rest/api/3/attachment/content/13047 "MDMAPI.yaml attached to APIM-2732"]

2. Check “Apply Mock policy“

3. Seer error banner

In the APIM API console we can sea a NPE in “MockOAIOperationVisitor

java.lang.NullPointerException: Cannot invoke \"io.swagger.v3.oas.models.Components.getSchemas()\" because the return value of \"io.swagger.v3.oas.models.OpenAPI.getComponents()\" is null
 io.gravitee.policy.mock.swagger.MockOAIOperationVisitor.getResponseFromSimpleRef(MockOAIOperationVisitor.java:176)
 io.gravitee.policy.mock.swagger.MockOAIOperationVisitor.getSchemaValue(MockOAIOperationVisitor.java:246)
 io.gravitee.policy.mock.swagger.MockOAIOperationVisitor.lambda$getResponseProperties$0(MockOAIOperationVisitor.java:184)
 java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Unknown Source)
 java.base/java.util.stream.ReduceOps$3ReducingSink.accept(Unknown Source)
 java.base/java.util.Iterator.forEachRemaining(Unknown Source)
 java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
 java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
 java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
 java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
 java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
 java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
 io.gravitee.policy.mock.swagger.MockOAIOperationVisitor.getResponseProperties(MockOAIOperationVisitor.java:184)
 io.gravitee.policy.mock.swagger.MockOAIOperationVisitor.processResponseSchema(MockOAIOperationVisitor.java:140)
 io.gravitee.policy.mock.swagger.MockOAIOperationVisitor.visit(MockOAIOperationVisitor.java:93)
 io.gravitee.policy.mock.swagger.MockOAIOperationVisitor.visit(MockOAIOperationVisitor.java:46)

Check some parseOptions like setFlattenComposedSchemas note tested.

Expected behaviour :

No error OR understandable error

Current behavior :

Not having the policies after import

Useful information :

We have a workaround for this already in place.

tested in 3.20.6

exalate-issue-sync[bot] commented 1 year ago

This issue has been fixed in versions 3.20.20, 4.0.9, 3.19.25, 4.1.0