Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-8287

The operator crashes when creating an ActiveDoc with an empty value {}

XMLWordPrintable

    • False
    • None
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Hide
      • Open https://editor.swagger.io/. By default the Swagger editor displays the Swagger Petstore example v2.
      • Edit -> convert to Openapi 3
      • Note that the Swagger Petstore 3.0.1 spec under the response object there has the "content { }" field.
      • Convert the spec to Json and save it.
      • Create an ActiveDoc in 3scale using ActiveDoc CRD
      Show
      Open https://editor.swagger.io/ . By default the Swagger editor displays the Swagger Petstore example v2. Edit -> convert to Openapi 3 Note that the Swagger Petstore 3.0.1 spec under the response object there has the "content { }" field. Convert the spec to Json and save it. Create an ActiveDoc in 3scale using ActiveDoc CRD

      Current behaviour:
      When using Active Docs CRD to create a spec with OAS 3.0.X that contains the empty field content { } under the response object the operator crashes although the spec is created in the admin portal.

      The operator logs shows the following:

      E0310 12:34:26.431989       1 runtime.go:76] Observed a panic: cannot handle unexported field at {*openapi3.Swagger}.Components.Schemas["ApiResponse"].Value.compiledPattern:
        "github.com/getkin/kin-openapi/openapi3".Schema
      consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported
      goroutine 589 [running]:
      k8s.io/apimachinery/pkg/util/runtime.logPanic(0x178baa0, 0xc002668c20)
        /remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery@v0.18.6/pkg/util/runtime/runtime.go:74 +0xa3
      

      Desired behaviour:
      Avoid the operator to crash when the empty value is present and display a warning or error.

      Additional notes:

      • The ActiveDocOpenAPIRefSpec points out that the supported OpenAPI version is 3.0.2, however it works for 3.0.0 & 3.0.1 versions as well without the empty field content { }.
      • The empty field content { } is added when converting the spec from v2 to openapi 3 with the Swagger editor. The same file used in another editor does not use the field content { }.
      • The content field does not seem a difference between OAS versions 3.0.0, 3.0.1 & 3.0.2 and the specification states that should be a string.

              Unassigned Unassigned
              rhn-support-avilatus Anna Vila Tusell
              Martin Kudlej Martin Kudlej
              Eguzki Astiz Lezaun Eguzki Astiz Lezaun
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: