Skip to content

Openapi big model hierarchy defect #3437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 15, 2025

Conversation

mhodovaniuk
Copy link
Contributor

@mhodovaniuk mhodovaniuk commented Mar 28, 2025

This PR aim to fix #3361 by making sure that Schema.Transform are not ignored.

This also fixes an issue where a reference was used instead of component details. See the components are generated for model with abstract big model field test. Before these changes, the result lacked ConcreteBigModel details.
Open API spec that generated without this change:

{
   "openapi":"3.1.0",
   "info":{
      "title":"",
      "version":""
   },
   "paths":{
      "/api/v1/endpoint":{
         "get":{
            "responses":{
               "200":{
                  "content":{
                     "application/json":{
                        "schema":{
                           "$ref":"#/components/schemas/WithGenericPayload"
                        }
                     }
                  }
               }
            }
         }
      }
   },
   "components":{
      "schemas":{
         "AbstractBigModel":{
            "oneOf":[
               {
                  "$ref":"#/components/schemas/ConcreteBigModel"
               }
            ],
            "discriminator":{
               "propertyName":"type",
               "mapping":{
                  "ConcreteBigModel":"#/components/schemas/ConcreteBigModel"
               }
            }
         },
         "ConcreteBigModel":{
            "$ref":"#/components/schemas/ConcreteBigModel"
         },
         "WithGenericPayload":{
            "type":"object",
            "properties":{
               "a":{
                  "$ref":"#/components/schemas/AbstractBigModel"
               }
            },
            "required":[
               "a"
            ]
         }
      }
   }
}

@987Nabil 987Nabil merged commit 9d06cd9 into zio:main Apr 15, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenAPI generator fails when trying to generate schema for abstract classes with more than 22 fields in the hierarchy
2 participants