Open varganatt opened 1 week ago
NSwag.AspNetCore 14.0.8 Repo for reproduction: https://github.com/varganatt/NSwagRepro/blob/master/NSwagRepro.csproj Settings: nswag.json
14.0.8
When you have a type that contains nested data, and generate both TypeScript classes and interfaces, the interfaces reference nested class data.
Interfaces should never reference generated classes.
I have an endpoint that returns nested data (NestedData.cs):
public class NestedData { public InnerDetails Details => new(); public class InnerDetails { public int SomeValue { get; set; } } }
From the generated TypeScript code:
export class NestedData implements INestedData { // Implementation } export interface INestedData { details?: InnerDetails; // <--- THE PROBLEM } export class InnerDetails implements IInnerDetails { // Implementation } export interface IInnerDetails { someValue?: number; }
INestedData.details should be specified as the type IInnerDetails, not InnerDetails.
INestedData.details
IInnerDetails
InnerDetails
NSwag.AspNetCore
14.0.8
Repo for reproduction: https://github.com/varganatt/NSwagRepro/blob/master/NSwagRepro.csproj Settings: nswag.jsonWhen you have a type that contains nested data, and generate both TypeScript classes and interfaces, the interfaces reference nested class data.
Interfaces should never reference generated classes.
I have an endpoint that returns nested data (NestedData.cs):
From the generated TypeScript code:
INestedData.details
should be specified as the typeIInnerDetails
, notInnerDetails
.