Skip to content

OpenApi 9.0.9 - Incorrect reference types for classes with more than one collection properties of the same reference type #2496

@vukispasic

Description

@vukispasic

I have checked this with the latest 9.0.400 release of ASP.NET Core. The original issue is not yet fixed. The collection references are not even pointing to a type anymore. This is what the generated open api document looks like now.

CC: @RachitMalik12 @captainsafia @MaggieKimani1

{
  ...
  "components": {
    "schemas": {
     ...
     "LegalEntity": {
       "required": [
         "balances",
         "assets",
         "equities",
         "deletedAccounts"
       ],
       "type": "object",
       "properties": {
         "balances": {
           "type": "array",
           "items": {
             "$ref": "#/components/schemas/Account"
           }
         },
         "assets": {
           "type": "array",
           "items": { }
         },
         "equities": {
           "type": "array",
           "items": { }
         },
         "deletedAccounts": {
           "type": "array",
           "items": {
             "type": "integer",
             "format": "int32"
           }
         }
       }
     },
    }
  }
}

The sample repo is also now updated.

Originally posted by @asankaf in #2254

I stumble up on identical issue with our data model, and I am experiencing same issue as @asankaf reported. Starting from 9.0.4 there is no error in top of Swagger UI displayed anymore, but schema is still not generated correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions