19 Answer(s)
-
0
Hi @kalidarscope
I couldn't see the code block in the screenshot. Could you share a new screenshot with a higher resolution ? Please also share how this problem happens.
-
0
-
0
any update on this issue?
-
0
Hi @kalidarscope,
What is your project version? I checked the project's latest version and did not encounter such an error.
-
0
project version 13.2.0
-
0
Hi @kalidarscope,
I can reproduce this in my project. Could you share your project with us? [email protected]
-
0
Hi m.aliozkaya, This is product we cant share and can we schedule call?
-
0
Hi kalidarscope
By default, we don't use the
Duration
class inservice-proxies.ts
. You can remove it from here, or it seems that you have a class with the same name in a different module or inservice-proxies.ts
. You could consider renaming it to avoid the conflict. -
0
Yes, we removed it from service-proxies.ts, but it gets automatically regenerated when we run refresh.bat.
-
0
Hi kalidarscope
Can you share with us the details of the Duration class created in other service-proxies.ts, not the Duration class imported by 'luxon'? Thank you.
-
0
Below class was generated in service-proxies.ts
export class Duration implements IDuration { negative!: boolean; years!: number; months!: number; days!: number; hours!: number; minutes!: number; seconds!: number;
constructor(data?: IDuration) { if (data) { for (var property in data) { if (data.hasOwnProperty(property)) (<any>this)[property] = (<any>data)[property]; } } } init(_data?: any) { if (_data) { this.negative = _data["negative"]; this.years = _data["years"]; this.months = _data["months"]; this.days = _data["days"]; this.hours = _data["hours"]; this.minutes = _data["minutes"]; this.seconds = _data["seconds"]; } } static fromJS(data: any): Duration { data = typeof data === 'object' ? data : {}; let result = new Duration(); result.init(data); return result; } toJSON(data?: any) { data = typeof data === 'object' ? data : {}; data["negative"] = this.negative; data["years"] = this.years; data["months"] = this.months; data["days"] = this.days; data["hours"] = this.hours; data["minutes"] = this.minutes; data["seconds"] = this.seconds; return data; }
}
export interface IDuration { negative: boolean; years: number; months: number; days: number; hours: number; minutes: number; seconds: number; }
How is the above Duration class generated? Because of this class, the import import { DateTime, Duration } from "luxon"; is causing an error.
-
0
Hi @kalidarscope
There must be a class named
Duration
defined on the server side. Could you search your project and see if it exists ? -
0
Yes, I searched my project, but that class does not exist.
-
0
Can you use it in your code ? It might be coming from a library you are using.
-
0
I did not use any of my code, so from which library is this class coming?
-
0
Hi,
You can try the solution below;
- First define a document filter like this
public class MyCustomDocFilter : IDocumentFilter { public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) { swaggerDoc.Components.Schemas.Remove("Duration"); } }
- Then, use this in your
Startup.cs
as shown below;
private void ConfigureSwagger(IServiceCollection services) { services.AddSwaggerGen(options => { ...... options.DocumentFilter<MyCustomDocFilter>(); ..... }); }
-
0
-
0
any update on this?
-
0
Hi @kalidarscope
Could you send an email to [email protected] about this ? We will help you.
Thanks,