OpenAPI.NET icon indicating copy to clipboard operation
OpenAPI.NET copied to clipboard

how to create OpenApiDocument read from WSDL with XML Reader?

Open Samanoova opened this issue 2 years ago • 1 comments

Hi,

I am using OpenApiStreamReader to read a swagger JSON and it's working fine

` string ServiceJson = swaggerLink;

        using (var httpClientHandler = new HttpClientHandler())
        {
            httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
            using (var client = new HttpClient(httpClientHandler))
            {
                client.BaseAddress = new Uri(ServiceJson);
                // Make your request...
                var stream = await client.GetStreamAsync(ServiceJson);
                // Read V3 as YAML
                OpenApiDocument openApiDocument = new OpenApiStreamReader().Read(stream, out var diagnostic);}}`

but when I try to read XML from the WSDL link it throws error tell that XML is not supported is there any way to do the same thing with XML?

Samanoova avatar Sep 21 '22 09:09 Samanoova

Hi @Samanoova, as per the error thrown, currently we don't support reading XML documents let alone WSDL. We only support Open API documents in either JSON or Yaml formats. However, we have a Commandline tool - Hidi (Executable file), that helps transform/convert CSDL/XML documents into either JSON/Yaml. Maybe try using that first? Hidi Documentation

MaggieKimani1 avatar Nov 22 '22 08:11 MaggieKimani1