SwaggerProvider icon indicating copy to clipboard operation
SwaggerProvider copied to clipboard

The type provider 'SwaggerProvider.OpenApiClientTypeProvider' reported an error: Schema parse errors: Invalid Reference identifier 'JWT'

Open hotyes opened this issue 7 months ago • 5 comments

I encountered an error while using for this document https://plisio.net/swagger/api

The type provider 'SwaggerProvider.OpenApiClientTypeProvider' reported an error: Schema parse errors:
Invalid Reference identifier 'JWT'. @F# Compiler[3033](https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-messages/fs3033)
type OpenApiClientProvider
An error occurred when parsing the doc comment, please check that your doc comment is valid.

More info can be found in the LSP output

[Open the documentation](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)

Anyone have any idea for the solution ?

hotyes avatar May 08 '25 17:05 hotyes

I would expect this to come from the external library (Microsoft.OpenApi) schema parsing. There is now PR to update that library, but if it won't work after that, then it's probably an issue for them (or for the schema owner).

Thorium avatar May 10 '25 15:05 Thorium

hmm, updated to the latest version (v2.3.0) doesn't work, anyway thanks

hotyes avatar May 11 '25 00:05 hotyes

i also believe that it is the schema issue

schema defines 2 security schemas

Image

but "/payment-button/new/{hash}" uses undefined JWT schema

Image

more here https://swagger.io/docs/specification/v3_0/authentication/

sergey-tihon avatar May 11 '25 06:05 sergey-tihon

It seems schemas are "best effort" of creator and rarely without mistakes.

On schema errors I recommend:

  1. save the schema to your file system and fix the issue locally.
  2. report the issue or send PR to schema owner.

It's a good practice to use local file anyway, because the schema owner may just take their schema file off from the internet, e.g. if they fear misuse or hacking.

Thorium avatar May 11 '25 07:05 Thorium

greats idea, thank you guys!

hotyes avatar May 12 '25 05:05 hotyes