SwaggerProvider icon indicating copy to clipboard operation
SwaggerProvider copied to clipboard

OpenAPI "data and type mismatch found"

Open Thorium opened this issue 4 years ago • 6 comments

I'm trying to read this schema: https://developer.experian.com/system/files/2020-12/credit-profile-product-apis-v-openapi3.2.0.45.yaml

I'm getting a lot of "Data and type mismatch found" errors. And indeed, it seems that the types vary: permissiblePurpose/type seems to be sometimes 08 and sometimes '08' and sometimes just ''.

Is the schema totally un-usable wtih OpenApiProvider, or is it still possible to use it by forcing the types manually (with some static parameter maybe?), so that the type is "either string or int" or "force to string"?

FSharp.Data is usually creating IntOrString and then I have to manually deal with both cases, but at least the type-provider is still usable.

I don't care the solution details, I do care a workaround to get this ~10k lines of type-definitions into use easily.

Thorium avatar May 12 '21 15:05 Thorium

OpenApiProvider is build on top of Microsoft.OpenApi.Readers we use "official" parser and report back error if parser is not happy about schema https://github.com/fsprojects/SwaggerProvider/blob/net5/src/SwaggerProvider.DesignTime/Provider.OpenApiClient.fs#L64-L69

There is no auto-recovery option for now. You may try to comment lines where we fail in case of errors in schema or even add static parameter to not fail in this case. But I think that everything may just go wrong if we ignore schema errors.

sergey-tihon avatar May 13 '21 07:05 sergey-tihon

Thanks for the response, I'll ask the question from their project.

Thorium avatar May 13 '21 12:05 Thorium

They were fast, they fixed that, and the fix is already merged to their "vnext" branch.

Edit: the fix was just to comment that rule out.

Thorium avatar May 17 '21 08:05 Thorium

Let me know when they release on NuGet and I'll release updated provider

sergey-tihon avatar May 17 '21 15:05 sergey-tihon

A 1.3.0-preview has been released and is available here https://www.nuget.org/packages/Microsoft.OpenApi.Readers/

purkhusid avatar Jun 04 '21 16:06 purkhusid

I've updated all dependencies and released v1.0.0-beta4 with Microsoft.OpenApi.Readers v1.3.0-preview

sergey-tihon avatar Jun 12 '21 09:06 sergey-tihon