Orange-OpenSource / angular-swagger-ui

An angularJS implementation of Swagger UI
http://orange-opensource.github.io/angular-swagger-ui/
MIT License
135 stars 74 forks source link

Works with any version lower than 0.5.0, but stops working from 0.5.0 #91

Closed alexfrize closed 6 years ago

alexfrize commented 6 years ago

We have an existing AngularJS project. It uses angular-swagger-ui 0.3.2.

When I upgraded angular-swagger-ui to the latest version (0.5.5), it stopped working. I made a research, tried to change only one main file 'swagger-ui.min.js', tried different versions. It perfectly works with any version lower than 0.5.0, but starting from 0.5.0 it stops working.

Unfortunately, I can't provide any additional information, because it doesn't show any errors. Nothing. White screen only.

Maybe someone had similar issue? Any ideas, what to check?

Thank you.

mathieuales commented 6 years ago

Hi! Please make sure you have the minimum required version of angularJS (1.5.0) Please provide sample code so i can see the way you use it Regards

alexfrize commented 6 years ago

Thank you for quick response.

Upgrade Angular to 1.5 or higher didn't help.

But it looks like we found a problem. At least, part of it.

We don't use angular-swagger-ui directly to show the data. But we provide the data returned from swaggerUiCtrl.swaggerContent to our component which renders our UI. In angular-swagger-ui v.0.5. the swaggerUiCtrl.swaggerContent data has been changed, that's why we didn't see anything.

We changed resources to ui.resources in our iteration and it helped.

Now we're trying to figure out, how to display API model correctly, something has been changed as well.

alexfrize commented 6 years ago

Old data is different from new.

New one has only:

"default": {
  "description": "Unexpected error",
  "schema": {
    "$ref": "#/definitions/Error"
  }
}

while old one has:

"default": {
      "description": "Unexpected error",
      "schema": {
        "$ref": "#/definitions/Error",
        "json": "{\n \"code\": 0,\n \"message\": \"string\",\n \"error\": \"string\"\n}",
        "model": {},
        "definition": {
          "properties": {
            "code": {
              "type": "integer",
              "format": "int32",
              "hasAdditionalProperties": true
            },
            "message": {
              "type": "string"
            },
            "error": {
              "type": "string"
            }
          },
          "name": "Error",
          "isRootDefinition": true,
          "propertyReferences": {
            "Error": {
              "properties": {
                "code": {
                  "type": "integer",
                  "format": "int32",
                  "hasAdditionalProperties": true
                },
                "message": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
Data also has "responseClass" and inside it has a key "propertyReferences".
The old "propertyReferences" has data:
    "propertyReferences": {
          "ProductAgreementFamily": {
            "properties": {
              "familyId": {
                "type": "string",
                "description": "familyId of that agreement.",
                "required": true,
                "hasAdditionalProperties": true
              },
              "familyName": {
                "type": "string",
                "description": "FamilyName of that agreement Family id.",
                "required": false,
                "hasAdditionalProperties": true
              }
            }
          }
        },
        "reference": "ProductAgreementFamily"
      }
  but the new one doesn't have it, it's an empty object:

"propertyReferences": {}

  This is the data, that we get from each operation to display model/schema.

  Maybe, you have any ideas, what have been changes in the model in v0.5?
  Thanks.
mathieuales commented 6 years ago

Old component was modifying data passed as argument, it was dirty so it has been cleaned. Please give a full example of how you use it (swagger spec, spec version, html and js)

alexfrize commented 6 years ago

We decided to try different approach.

Thank you for your help! Really appreciate it and your quick responses. Thank you!