У меня проблема с созданным RestApiClient для CSharp. Проблема была обнаружена в Visual Studio AutoRest, поэтому я загружаю AutoRest CLI, но генерирую тот же неправильный тип возврата метода.
AutoRest code generation utility [cli version: 3.0.6187; node: v12.14.1, max-memory: 8192 gb]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Showing All Installed Extensions
Type Extension Name Version
core @autorest/core 3.0.6274
core @microsoft.azure/autorest-core 2.0.4417
extension @microsoft.azure/autorest.csharp 2.3.84
extension @microsoft.azure/autorest.modeler 2.3.55
Это Swagger. json, сгенерированный Swashbucke 5.6.0 из WebApi
{
"swagger": "2.0",
"info": {
"version": "v1",
"title": "Server"
},
"host": "localhost:5992",
"schemes": [
"http"
],
"paths": {
"/api/User/HasUser": {
"post": {
"tags": [
"User"
],
"operationId": "User_HasUser",
"consumes": [],
"produces": [
"application/json",
"text/json",
"application/xml",
"text/xml"
],
"parameters": [
{
"name": "username",
"in": "query",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"x-nullable": false,
"type": "boolean"
}
}
}
}
}
},
"definitions": {}
}
команда с параметрами
c:\> autorest --input-file=swagger.json --output-folder=autorest --csharp --clear-output-folder
Вывод AutoRest
namespace Api
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Rest;
public static partial class UserExtensions
{
public static bool? HasUser(this IUser operations, string username) ...
}
}
Я ожидаю "bool", а не "bool?"
public static bool HasUser(this IUser operations, string username) ...