-
Notifications
You must be signed in to change notification settings - Fork 60
Description
Reproduction Steps
Run the following script:
#r "nuget: SwaggerProvider, 2.3.2"
open SwaggerProvider
let [<Literal>] Schema = "https://raw.githubusercontent.com/immich-app/immich/refs/heads/main/open-api/immich-openapi-specs.json"
type Immich = OpenApiClientProvider<Schema>
let client = Immich.Client()The following error is returned:
Duplicate in method table is:
Type index: 8
Method name: .ctor
Method arity (num generic params): 0
Error: input.fsx (4,15)-(4,44) typecheck error The type provider 'SwaggerProvider.OpenApiClientTypeProvider' reported an error: Error in pass2 for type Immich, error: Error in pass2 for type ActivityCreateDto_Type, error: duplicate entry '.ctor' in method table
input.fsx (4,15)-(4,44)
Further investigation
If I edit the OpenAPI spec to remove the offending ActivityCreateDto (along with any paths and other DTOs that reference it) it then fails on ActivityResponseDto. Removing ActivityResponseDto causes it to fail on AddUsersDto and so on and so forth.
Where ActivityCreateDto complained about the "Type" property, others complained about the "Error", "Role", or "Order" properties. The common thread I have seen across them is that they all use the allOf data model referencing a single item.
Similar issues
Issue #263 also reports parse errors, though they are significantly different. There are two things suggested there:
- That it is an issue with the spec. I have already reported this as in issue with Immich, but they believe that their spec is correct and it is the type provider that is incorrect.
- That it is an issue with the parser that will be fixed by WIP: Microsoft.OpenApi v2.x (OpenAPI v3.1 Support) and .NET 10 #269 upgrading to the latest Microsoft.OpenApi version. I have tried using v3.0.0-beta01 but that did not address the issue.
Issues #135 and #184 also complain about constructors, but they are complaining about missing constructors, not duplicated ones. I could not find any issues referencing a duplicate constructor.
Issue #243 also complains of problems parsing allOf constraints, so this may well be related.