Skip to content

Resolver error ... allOf must be an array #3487

@sundriver

Description

@sundriver

HI Everyone,
I am trying to embed the following swagger doc into my web application.
The file renders correctly on editor.swagger.io but when i deploy on my local setup, I get:

Here is the error screenshot

Resolver error at paths./user.post.responses.201.schema.allOf
allOf must be an array
Resolver error at definitions.UserUpdateRequest.allOf
allOf must be an array
Resolver error at definitions.UserDetailResponse.allOf
allOf must be an array

I appreciate your comments,
Ali

  • swagger-ui version 3.1.1
  • a swagger file reproducing the issue
{
  "swagger": "2.0",
  "info": {
    "title": "Test title",
    "description": "Test descripiton",
    "version": "1.0.0",
    "contact": {
      "name": "No Contact Name provided",
      "url": "http://www.test.com",
      "email": "test@test.com"
    }
  },
  "host": "localhost:3000",
  "schemes": [
    "http"
  ],
  "basePath": "/api/v1.0",
  "produces": [
    "application/json"
  ],
  "paths": {
    "/user": {
      "post": {
        "operationId": "createUser",
        "summary": "Create a new User",
        "description": "This call will create a new User and returns it back to the callee.\n",
        "tags": [
          "User"
        ],
        "parameters": [
          {
            "in": "body",
            "name": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UserCreateRequest"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "The new User, in detailed view.",
            "schema": {
              "$ref": "#/definitions/UserDetailResponse"
            }
          },
          "422": {
            "$ref": "#/responses/ErrorResponse422"
          }
        }
      }
    }
  },
  "parameters": {
    "userId": {
      "name": "userId",
      "in": "path",
      "description": "User id",
      "required": true,
      "type": "string"
    }   
  },
  "definitions": {
    "AppSummaryResponse": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Id of entity"
        },
        "url": {
          "type": "string",
          "description": "URL pointing to this entity for getting detailed view"
        },
        "deleted_at": {
          "type": "string",
          "description": "When this entry was marked to be deleted"
        }
      }
    },
    "AppCreateRequest": {
      "type": "object",
      "properties": {}
    },
    "AppDetailResponse": {
      "type": "object",
      "properties": {
        "created_by": {
          "type": "string",
          "description": "The user who created the entry"
        },
        "created_at": {
          "type": "string",
          "description": "The timestamp when this entry was created"
        },
        "updated_by": {
          "type": "string",
          "description": "The user who most recently updated the entry"
        },
        "updated_at": {
          "type": "string",
          "description": "When was the entry was most recently updated"
        },
        "deleted_by": {
          "type": "string",
          "description": "The user who deleted the entry"
        }
      }
    },
    "UserCommonFields": {
      "type": "object",
      "properties": {}
    },
    "UserCreateRequest": {
      "allOf": [
        {
          "$ref": "#/definitions/AppCreateRequest"
        },
        {
          "$ref": "#/definitions/UserCommonFields"
        },
        {
          "type": "object",
          "required": [
            "name",
            "email",
            "password"
          ],
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": {
              "type": "string",
              "maxLength": 1024
            },
            "external_uri": {
              "type": "string",
              "format": "url"
            },
            "email": {
              "type": "string",
              "format": "email"
            },
            "password": {
              "type": "string",
              "minLength": 8,
              "maxLength": 20
            }
          }
        }
      ]
    },
     "AppUpdateRequest": {
      "type": "object"
    },
      "UserSummaryResponse": {
      "allOf": [
        {
          "$ref": "#/definitions/AppSummaryResponse"
        },
        {
          "$ref": "#/definitions/UserCommonFields"
        },
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            }
          }
        }
      ]
    },
    "UserUpdateRequest": {
      "allOf": [
        {
          "$ref": "#/definitions/AppUpdateRequest"
        },
        {
          "$ref": "#/definitions/UserCommonFields"
        },
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": {
              "type": "string",
              "maxLength": 1024
            },
            "external_uri": {
              "type": "string",
              "format": "url"
            },
            "email": {
              "type": "string",
              "format": "email"
            },
            "password": {
              "type": "string",
              "minLength": 8,
              "maxLength": 20
            }
          }
        }
      ]
    },
    "UserDetailResponse": {
      "allOf": [
        {
          "$ref": "#/definitions/AppDetailResponse"
        },
        {
          "$ref": "#/definitions/UserSummaryResponse"
        },
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "description": {
              "type": "string"
            },
            "external_uri": {
              "type": "string"
            },
            "email": {
              "type": "string"
            }
          }
        }
      ]
    },
    "Error": {
      "type": "object",
      "properties": {
        "error_code": {
          "type": "string"
        },
        "resource_name": {
          "type": "string"
        }
      }
    },
    "ErrorMessage": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        },
        "errors": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Error"
          }
        }
      }
    },
    "SingleErrorMessage": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  },
  "responses": {
    "ErrorResponse400": {
      "description": "Bad request, problems parsing JSON",
      "schema": {
        "$ref": "#/definitions/SingleErrorMessage"
      }
    },
    "ErrorResponse401": {
      "description": "Request failed because user is not authenticated",
      "schema": {
        "$ref": "#/definitions/SingleErrorMessage"
      }
    },
    "ErrorResponse403": {
      "description": "Request failed because user does not have authorization to access a specific resource",
      "schema": {
        "$ref": "#/definitions/SingleErrorMessage"
      }
    },
    "ErrorResponse422": {
      "description": "Your request was understood, but contained invalid parameters",
      "schema": {
        "$ref": "#/definitions/ErrorMessage"
      }
    },
    "CreateResponse": {
      "description": "Entry created successfully",
      "headers": {
        "location": {
          "type": "string",
          "description": "Link to newly created entry."
        }
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions