autorest

Microsoft.OpenApi.Models.OpenApiDocument.SerializeAsV2 Invalid URI: The format of the URI could not be determined

一个人想着一个人 提交于 2020-03-25 18:23:11
问题 I am upgrading my api from .netcore2.1 to 3.1 The api uses SwagerUI and Autorest to generate the client. From this question about Autorest I found out that I need to use app.UseSwagger(c => { c.SerializeAsV2 = true; }); However the UI gives Fetch error Internal Server Error v1/swagger.json The json is { "StatusCode": 500, "ErrorMessage": "Internal server error: Invalid URI: The format of the URI could not be determined. nStack: at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind

How to update AutoRest in visual studio 2017

我怕爱的太早我们不能终老 提交于 2020-01-14 08:50:31
问题 Context I would like to use AutoRest generated client for a webapi service by using "Add"/"REST API Client..." in visual studio 2017. However, it gives the following error: [Info] AutoRest Core 0.16.0.0 ... [Fatal]Error generating client model: Collection format "multi" is not supported (in parameter 'xxx'). The older version of AutoRest (e.g. 0.16.0) does not support "multi" collection format. So I installed the latest version AutoRest 0.17.3. using Nuget. But when I use "Add"/"REST API

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification calling Autorest generated code

亡梦爱人 提交于 2020-01-06 17:58:05
问题 I have a unit test, calling a service that makes use of Autorest generated code to call my Api. I want my unit test to display the error that my Api is throwing, but there seems to be an error in the service's error handling. I am using the following command to generate code to consume my api. autorest --input-file=https://mywebsite.com.au:4433/myapi/api-docs/v1/swagger.json --output-folder=generated --csharp --namespace=MyConnector The generated "client code" contains /// <param name=

How can I use Windows Authentication with Microsoft.Rest.ServiceClient

北战南征 提交于 2020-01-03 18:31:32
问题 I have a Microsoft.Rest.ServiceClient generated with autorest . And I want to access a REST API secured with Windows Authentication and Basic Authentication. The goal is to use Windows Authentication. I tried it as follows: var handler = new HttpClientHandler { UseDefaultCredentials = true, }; this.InitializeHttpClient(handler); This does not work, I get: System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The remote server returned

Adding Iso8601TimeSpanConverter to JsonConverter list throws ArrayTypeMismatch exception

本小妞迷上赌 提交于 2020-01-02 08:38:09
问题 I'm using AutoRest to auto generate a c# class for a REST API from a Swagger definition file. The problem is that when the client class initialize methos is executed, it throws an ArrayTypeMismatch exception in the following code: SerializationSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling =

Should I try to take BadRequest(ModelState) returned from my API, and deserialize to *what* with JSON.NET?

假如想象 提交于 2019-12-24 20:25:20
问题 TL;DR; "I like how my generated AutoRest client deserializes my main entities when dealing with the 200 scenarios.. but, MUST I manually parse the 400 scenarios?", said the lazy programmer DETAILS: So, I have an API, (Web API 2), and I do all the standard stuff.. using POCO's that implement IValidatable in addition to property-level validation using System.Data.DataAnnotations my Web API returns 400 errors like this (just an example): if (!ModelState.IsValid) { return BadRequest(ModelState);

Can I use an Autorest client in blazor

拥有回忆 提交于 2019-12-11 01:38:17
问题 I am getting a System.PlatformNotSupportedException from the mono platform when trying to run my blazor app on webassembly. I autogenerated a web api client using Autorest. Everything is compiling fine but when I load the code in the browser I get the error below in the browser console. Using a preview build of VS2017. module.printErr @ MonoPlatform.ts:192 WASM: [System.PlatformNotSupportedException] Operation is not supported on this platform. WASM: at System.Net.WebProxy.CreateDefaultProxy

How do I get JWT working in Autorest generated SDK? (ASP.NET Core 2.0)

三世轮回 提交于 2019-12-07 15:38:03
问题 I want to be able to login to my identity database with user name and password and retreive a JWT. Then I want to use the JWT to access data securely from my API. I found out that the SDK code generated by VS2017 uses an old version of autorest, so I have switched to using Azure Autorest The api and the SDK are both ASP.NET Core 2.0 To generate the SDK I use AutoRest -mynamespace mytrack.Client -CodeGenerator CSharp -Modeler Swagger -Input swagger.json -PackageName mytrack.client

Adding Iso8601TimeSpanConverter to JsonConverter list throws ArrayTypeMismatch exception

给你一囗甜甜゛ 提交于 2019-12-05 19:48:55
I'm using AutoRest to auto generate a c# class for a REST API from a Swagger definition file. The problem is that when the client class initialize methos is executed, it throws an ArrayTypeMismatch exception in the following code: SerializationSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new