-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schema error handling on OpenApiProvider #160
Comments
Generally I am OK with this change...Just not sure about most useful format. |
I'm not sure about the format either, that's why this is a question, not PR :-)
|
Agree with
It should not be an issue. We can add it to root level XML comment also good idea. So it may look like type OpenApiReaderError = {Messag:string, Position:string}
type ProvidedType
/// <summary>OpenApi Reader Errors:
/// - External reference cannot be loaded (postition)</summary>
member x. SchemaReaderErrors() =
[{Message="External reference cannot be loaded"; Position="position"}]
This experience is also possible, but I believe that there should be an easily copy error message or position to google it, report an issues, find exact position in schema and fix, etc. In number of error is large you may want to process them somehow PetStore.SchemaReaderErrors
|> List.filter (fun x -> not <| x.Message.Contain("$ref"))
|> List.sortBy (fun x -> x.Position)
|> List.iter (printfn "%A") |
If there are any errors in schema, the OpenApiProvider just gives up:
SwaggerProvider/src/SwaggerProvider.DesignTime/Provider.OpenApiClient.fs
Line 74 in 4f76f3c
...which is maybe good behaviour if you can actually fix the schema. But in many cases you are the user, so you can't. Also you cannot easily copy the error. The parser itself will response both a-partially-read-schema and the errors.
So maybe a better way to handle the error case on partial-succeeded-schema, would be creating an "Errors"-property to the root-type and save those as a list of properties, or to xml-comment.
Just a pseudo, something like this:
The text was updated successfully, but these errors were encountered: