Skip to content
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

An error occurred when parsing the doc comment - cannot parse petstore? seems odd #231

Open
jkone27 opened this issue Nov 2, 2023 · 2 comments

Comments

@jkone27
Copy link
Contributor

jkone27 commented Nov 2, 2023

image

just testing on official pestore version 2 and 3 of openapi seems not able to parse?

#r "nuget:Testcontainers"
#r "nuget:SwaggerProvider"
open DotNet.Testcontainers.Builders
open DotNet.Testcontainers.Containers
open SwaggerProvider
open System

type PetStoreTypes = OpenApiClientProvider<"https://petstore.swagger.io/v2/swagger.json">

let container = 
        new ContainerBuilder()
        |> fun x -> x.WithImage("openapitools/openapi-petstore")
        |> fun x -> x.WithPortBinding(8080, true)
        |> fun x -> x.WithWaitStrategy(
                Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(
                        fun r -> r.ForPort(8080)
                )
        )
        |> fun x -> x.Build()


let _ = container.StartAsync().ConfigureAwait(false).GetAwaiter().GetResult()
@jkone27
Copy link
Contributor Author

jkone27 commented Nov 3, 2023

maybe having an integration test run always against latest open API specs could help to avoid regressions...
https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml

@sergey-tihon
Copy link
Member

Your sample uses OpenApiClientProvider that is designed for OpenApi schemas (V3), but not all V2 ones.

When you find such a case you have two options:

  1. Try SwaggerClientProvider
  2. Find the same schema in V3 format (or convert)

Can you try https://petstore3.swagger.io/api/v3/openapi.json ?

maybe having an integration test run always against latest open API specs could help to avoid regressions...

I did it in the past and it is annoying, when you try to merge PR, update dependencies or fix a bug, but CI is broken because of some issue in the external schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants