Swagger-codegen: ModelObject in generated typescipt code

Created on 7 Oct 2020  路  3Comments  路  Source: swagger-api/swagger-codegen

Using swagger-codegen 3.0.22 all my models containing an object property are now generated as a "ModelObject" referenced by

import { ModelObject } from './modelObject';

that doesn't even exist. I've seen some old issues regrading this, but it should have been fixed already?

IEnumValue:
  type: object
  properties:
    id:
      nullable: true
    name:
      type: string
      nullable: true
    description:
      type: string
      nullable: true
    isDefault:
      type: boolean
  additionalProperties: false
import { ModelObject } from './modelObject';

export interface IEnumValue { 
    id?: ModelObject;
    name?: string;
    description?: string;
    isDefault?: boolean;
}

All 3 comments

Hi Swagger Team,

I have same issue on my project in .Net Core 3.1 back end and Angular 9 front end.
Yesterday, I migrated the all Swagger libraries from 5.5.1 version to 5.6.1 and the issue appears.

project.csproj ->
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="5.6.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="5.6.1" />

So, I upgraded to last version (5.6.3) but the issue still persists.

Here is what I found by comparing the generated Swagger.json file:

For 5.5.1 -> Property "parameters", in C# with 'object' type

"parameters": { "type": "object", "additionalProperties": false, "nullable": true },

Same property 'parameters' with Swagger.json but on 5.6.3 version

"parameters": { "nullable": true },

_properties 'type' and 'additionalProperties' are not generated._

I also use swagger codegen for typescript 3.0.22.

Hope this comparaison help you.
Tks for help!

Hi Swagger Team,

Any news about issue ?

Tks for your help!

Guess one of us needs to check code and implement it - rock paper scissors?

Was this page helpful?
0 / 5 - 0 ratings