sync 4893 from autorest.csharp (#3832)
Sync up change from https://github.com/Azure/autorest.csharp/pull/4893
This commit is contained in:
Родитель
d2a165963c
Коммит
ba65f90868
|
@ -371,6 +371,8 @@ function fromSdkArrayType(
|
|||
}
|
||||
|
||||
function fromUsageFlags(usage: UsageFlags): Usage {
|
||||
if (usage & UsageFlags.JsonMergePatch) return Usage.None; // if the model is used in patch, we ignore the usage and defer to the logic of ours
|
||||
usage = usage & (UsageFlags.Input | UsageFlags.Output); // trim off other flags
|
||||
if (usage === UsageFlags.Input) return Usage.Input;
|
||||
else if (usage === UsageFlags.Output) return Usage.Output;
|
||||
else if (usage === (UsageFlags.Input | UsageFlags.Output)) return Usage.RoundTrip;
|
||||
|
|
|
@ -297,9 +297,14 @@ export function navigateModels(
|
|||
models: Map<string, InputModelType>,
|
||||
enums: Map<string, InputEnumType>
|
||||
) {
|
||||
getAllModels(context).forEach((model) =>
|
||||
model.kind === "model"
|
||||
? fromSdkModelType(model, context, models, enums)
|
||||
: fromSdkEnumType(model, context, enums)
|
||||
);
|
||||
for (const type of getAllModels(context)) {
|
||||
if (type.name === "") {
|
||||
continue;
|
||||
}
|
||||
if (type.kind === "model") {
|
||||
fromSdkModelType(type, context, models, enums);
|
||||
} else {
|
||||
fromSdkEnumType(type, context, enums);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,24 +3,25 @@
|
|||
|
||||
import { getLroMetadata } from "@azure-tools/typespec-azure-core";
|
||||
import {
|
||||
SdkContext,
|
||||
getAccess,
|
||||
isApiVersion,
|
||||
SdkContext,
|
||||
shouldGenerateConvenient,
|
||||
shouldGenerateProtocol,
|
||||
} from "@azure-tools/typespec-client-generator-core";
|
||||
import {
|
||||
getDeprecated,
|
||||
getDoc,
|
||||
getSummary,
|
||||
isErrorModel,
|
||||
Model,
|
||||
ModelProperty,
|
||||
Namespace,
|
||||
Operation,
|
||||
Type,
|
||||
getDeprecated,
|
||||
getDoc,
|
||||
getSummary,
|
||||
isErrorModel,
|
||||
} from "@typespec/compiler";
|
||||
import { HttpOperation, HttpOperationParameter, HttpOperationResponse } from "@typespec/http";
|
||||
import { getExtensions } from "@typespec/openapi";
|
||||
import { getResourceOperation } from "@typespec/rest";
|
||||
import { NetEmitterOptions } from "../options.js";
|
||||
import { BodyMediaType, typeToBodyMediaType } from "../type/body-media-type.js";
|
||||
|
@ -45,7 +46,7 @@ import { OperationLongRunning } from "../type/operation-long-running.js";
|
|||
import { OperationPaging } from "../type/operation-paging.js";
|
||||
import { OperationResponse } from "../type/operation-response.js";
|
||||
import { RequestLocation, requestLocationMap } from "../type/request-location.js";
|
||||
import { RequestMethod, parseHttpRequestMethod } from "../type/request-method.js";
|
||||
import { parseHttpRequestMethod, RequestMethod } from "../type/request-method.js";
|
||||
import { Usage } from "../type/usage.js";
|
||||
import { getExternalDocs, getOperationId, hasDecorator } from "./decorators.js";
|
||||
import { Logger } from "./logger.js";
|
||||
|
@ -82,10 +83,17 @@ export function loadOperation(
|
|||
if (typespecParameters.body?.property && !isVoidType(typespecParameters.body.type)) {
|
||||
parameters.push(loadBodyParameter(sdkContext, typespecParameters.body?.property));
|
||||
} else if (typespecParameters.body?.type && !isVoidType(typespecParameters.body.type)) {
|
||||
const effectiveBodyType = getEffectiveSchemaType(sdkContext, typespecParameters.body.type);
|
||||
if (effectiveBodyType.kind === "Model") {
|
||||
const rawBodyType = typespecParameters.body.type;
|
||||
if (rawBodyType.kind === "Model") {
|
||||
const effectiveBodyType = getEffectiveSchemaType(
|
||||
sdkContext,
|
||||
typespecParameters.body.type
|
||||
) as Model;
|
||||
const bodyParameter = loadBodyParameter(sdkContext, effectiveBodyType);
|
||||
if (effectiveBodyType.name === "") {
|
||||
if (
|
||||
effectiveBodyType.name === "" ||
|
||||
rawBodyType.sourceModels.some((m) => m.usage === "spread")
|
||||
) {
|
||||
bodyParameter.Kind = InputOperationParameterKind.Spread;
|
||||
}
|
||||
// TODO: remove this after https://github.com/Azure/typespec-azure/issues/69 is resolved
|
||||
|
@ -244,7 +252,9 @@ export function loadOperation(
|
|||
IsResourceParameter: false,
|
||||
IsContentType: isContentType,
|
||||
IsEndpoint: false,
|
||||
SkipUrlEncoding: false, //TODO: retrieve out value from extension
|
||||
SkipUrlEncoding:
|
||||
// TODO: update this when https://github.com/Azure/typespec-azure/issues/1022 is resolved
|
||||
getExtensions(program, param).get("x-ms-skip-url-encoding") === true,
|
||||
Explode: (inputType as InputArrayType).ValueType && format === "multi" ? true : false,
|
||||
Kind: kind,
|
||||
ArraySerializationDelimiter: format ? collectionFormatToDelimMap[format] : undefined,
|
||||
|
@ -332,7 +342,7 @@ export function loadOperation(
|
|||
return undefined;
|
||||
}
|
||||
|
||||
let bodyType: InputType | undefined = undefined;
|
||||
let bodyType = undefined;
|
||||
if (
|
||||
op.verb !== "delete" &&
|
||||
metadata.finalResult !== undefined &&
|
||||
|
|
|
@ -0,0 +1,362 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.ClientModel;
|
||||
using System.ClientModel.Primitives;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using UnbrandedTypeSpec;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary></summary>
|
||||
public partial class AnonymousBodyRequest : IJsonModel<AnonymousBodyRequest>
|
||||
{
|
||||
/// <summary> Keeps track of any properties unknown to the library. </summary>
|
||||
private IDictionary<string, BinaryData> _serializedAdditionalRawData;
|
||||
|
||||
internal AnonymousBodyRequest(string name, BinaryData requiredUnion, AnonymousBodyRequestRequiredLiteralString requiredLiteralString, AnonymousBodyRequestRequiredLiteralInt requiredLiteralInt, AnonymousBodyRequestRequiredLiteralFloat requiredLiteralFloat, bool requiredLiteralBool, AnonymousBodyRequestOptionalLiteralString? optionalLiteralString, AnonymousBodyRequestOptionalLiteralInt? optionalLiteralInt, AnonymousBodyRequestOptionalLiteralFloat? optionalLiteralFloat, bool? optionalLiteralBool, string requiredBadDescription, IList<int> optionalNullableList, IList<int> requiredNullableList, IDictionary<string, BinaryData> serializedAdditionalRawData)
|
||||
{
|
||||
Name = name;
|
||||
RequiredUnion = requiredUnion;
|
||||
RequiredLiteralString = requiredLiteralString;
|
||||
RequiredLiteralInt = requiredLiteralInt;
|
||||
RequiredLiteralFloat = requiredLiteralFloat;
|
||||
RequiredLiteralBool = requiredLiteralBool;
|
||||
OptionalLiteralString = optionalLiteralString;
|
||||
OptionalLiteralInt = optionalLiteralInt;
|
||||
OptionalLiteralFloat = optionalLiteralFloat;
|
||||
OptionalLiteralBool = optionalLiteralBool;
|
||||
RequiredBadDescription = requiredBadDescription;
|
||||
OptionalNullableList = optionalNullableList;
|
||||
RequiredNullableList = requiredNullableList;
|
||||
_serializedAdditionalRawData = serializedAdditionalRawData;
|
||||
}
|
||||
|
||||
internal AnonymousBodyRequest()
|
||||
{
|
||||
}
|
||||
|
||||
void IJsonModel<AnonymousBodyRequest>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
JsonModelWriteCore(writer, options);
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
|
||||
/// <param name="writer"> The JSON writer. </param>
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<AnonymousBodyRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
if (format != "J")
|
||||
{
|
||||
throw new FormatException($"The model {nameof(AnonymousBodyRequest)} does not support writing '{format}' format.");
|
||||
}
|
||||
writer.WritePropertyName("name"u8);
|
||||
writer.WriteStringValue(Name);
|
||||
writer.WritePropertyName("requiredUnion"u8);
|
||||
#if NET6_0_OR_GREATER
|
||||
writer.WriteRawValue(RequiredUnion);
|
||||
#else
|
||||
using (JsonDocument document = JsonDocument.Parse(RequiredUnion))
|
||||
{
|
||||
JsonSerializer.Serialize(writer, document.RootElement);
|
||||
}
|
||||
#endif
|
||||
writer.WritePropertyName("requiredLiteralString"u8);
|
||||
writer.WriteStringValue(RequiredLiteralString.ToString());
|
||||
writer.WritePropertyName("requiredLiteralInt"u8);
|
||||
writer.WriteNumberValue(RequiredLiteralInt.ToSerialInt32());
|
||||
writer.WritePropertyName("requiredLiteralFloat"u8);
|
||||
writer.WriteNumberValue(RequiredLiteralFloat.ToSerialSingle());
|
||||
writer.WritePropertyName("requiredLiteralBool"u8);
|
||||
writer.WriteBooleanValue(RequiredLiteralBool);
|
||||
if (Optional.IsDefined(OptionalLiteralString))
|
||||
{
|
||||
writer.WritePropertyName("optionalLiteralString"u8);
|
||||
writer.WriteStringValue(OptionalLiteralString.Value.ToString());
|
||||
}
|
||||
if (Optional.IsDefined(OptionalLiteralInt))
|
||||
{
|
||||
writer.WritePropertyName("optionalLiteralInt"u8);
|
||||
writer.WriteNumberValue(OptionalLiteralInt.Value.ToSerialInt32());
|
||||
}
|
||||
if (Optional.IsDefined(OptionalLiteralFloat))
|
||||
{
|
||||
writer.WritePropertyName("optionalLiteralFloat"u8);
|
||||
writer.WriteNumberValue(OptionalLiteralFloat.Value.ToSerialSingle());
|
||||
}
|
||||
if (Optional.IsDefined(OptionalLiteralBool))
|
||||
{
|
||||
writer.WritePropertyName("optionalLiteralBool"u8);
|
||||
writer.WriteBooleanValue(OptionalLiteralBool.Value);
|
||||
}
|
||||
writer.WritePropertyName("requiredBadDescription"u8);
|
||||
writer.WriteStringValue(RequiredBadDescription);
|
||||
if (Optional.IsCollectionDefined(OptionalNullableList))
|
||||
{
|
||||
if (OptionalNullableList != null)
|
||||
{
|
||||
writer.WritePropertyName("optionalNullableList"u8);
|
||||
writer.WriteStartArray();
|
||||
foreach (var item in OptionalNullableList)
|
||||
{
|
||||
writer.WriteNumberValue(item);
|
||||
}
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteNull("optionalNullableList"u8);
|
||||
}
|
||||
}
|
||||
if (RequiredNullableList != null && Optional.IsCollectionDefined(RequiredNullableList))
|
||||
{
|
||||
writer.WritePropertyName("requiredNullableList"u8);
|
||||
writer.WriteStartArray();
|
||||
foreach (var item in RequiredNullableList)
|
||||
{
|
||||
writer.WriteNumberValue(item);
|
||||
}
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteNull("requiredNullableList"u8);
|
||||
}
|
||||
if (options.Format != "W" && _serializedAdditionalRawData != null)
|
||||
{
|
||||
foreach (var item in _serializedAdditionalRawData)
|
||||
{
|
||||
writer.WritePropertyName(item.Key);
|
||||
#if NET6_0_OR_GREATER
|
||||
writer.WriteRawValue(item.Value);
|
||||
#else
|
||||
using (JsonDocument document = JsonDocument.Parse(item.Value))
|
||||
{
|
||||
JsonSerializer.Serialize(writer, document.RootElement);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AnonymousBodyRequest IJsonModel<AnonymousBodyRequest>.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options);
|
||||
|
||||
/// <param name="reader"> The JSON reader. </param>
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual AnonymousBodyRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<AnonymousBodyRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
if (format != "J")
|
||||
{
|
||||
throw new FormatException($"The model {nameof(AnonymousBodyRequest)} does not support reading '{format}' format.");
|
||||
}
|
||||
using JsonDocument document = JsonDocument.ParseValue(ref reader);
|
||||
return DeserializeAnonymousBodyRequest(document.RootElement, options);
|
||||
}
|
||||
|
||||
internal static AnonymousBodyRequest DeserializeAnonymousBodyRequest(JsonElement element, ModelReaderWriterOptions options)
|
||||
{
|
||||
if (element.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string name = default;
|
||||
BinaryData requiredUnion = default;
|
||||
AnonymousBodyRequestRequiredLiteralString requiredLiteralString = default;
|
||||
AnonymousBodyRequestRequiredLiteralInt requiredLiteralInt = default;
|
||||
AnonymousBodyRequestRequiredLiteralFloat requiredLiteralFloat = default;
|
||||
bool requiredLiteralBool = default;
|
||||
AnonymousBodyRequestOptionalLiteralString? optionalLiteralString = default;
|
||||
AnonymousBodyRequestOptionalLiteralInt? optionalLiteralInt = default;
|
||||
AnonymousBodyRequestOptionalLiteralFloat? optionalLiteralFloat = default;
|
||||
bool? optionalLiteralBool = default;
|
||||
string requiredBadDescription = default;
|
||||
IList<int> optionalNullableList = default;
|
||||
IList<int> requiredNullableList = default;
|
||||
IDictionary<string, BinaryData> serializedAdditionalRawData = default;
|
||||
Dictionary<string, BinaryData> rawDataDictionary = new Dictionary<string, BinaryData>();
|
||||
foreach (var prop in element.EnumerateObject())
|
||||
{
|
||||
if (prop.NameEquals("name"u8))
|
||||
{
|
||||
name = prop.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("requiredUnion"u8))
|
||||
{
|
||||
requiredUnion = BinaryData.FromString(prop.Value.GetRawText());
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("requiredLiteralString"u8))
|
||||
{
|
||||
requiredLiteralString = new AnonymousBodyRequestRequiredLiteralString(prop.Value.GetString());
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("requiredLiteralInt"u8))
|
||||
{
|
||||
requiredLiteralInt = new AnonymousBodyRequestRequiredLiteralInt(prop.Value.GetInt32());
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("requiredLiteralFloat"u8))
|
||||
{
|
||||
requiredLiteralFloat = new AnonymousBodyRequestRequiredLiteralFloat(prop.Value.GetSingle());
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("requiredLiteralBool"u8))
|
||||
{
|
||||
requiredLiteralBool = prop.Value.GetBoolean();
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("optionalLiteralString"u8))
|
||||
{
|
||||
if (prop.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
optionalLiteralString = null;
|
||||
continue;
|
||||
}
|
||||
optionalLiteralString = new AnonymousBodyRequestOptionalLiteralString(prop.Value.GetString());
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("optionalLiteralInt"u8))
|
||||
{
|
||||
if (prop.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
optionalLiteralInt = null;
|
||||
continue;
|
||||
}
|
||||
optionalLiteralInt = new AnonymousBodyRequestOptionalLiteralInt(prop.Value.GetInt32());
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("optionalLiteralFloat"u8))
|
||||
{
|
||||
if (prop.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
optionalLiteralFloat = null;
|
||||
continue;
|
||||
}
|
||||
optionalLiteralFloat = new AnonymousBodyRequestOptionalLiteralFloat(prop.Value.GetSingle());
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("optionalLiteralBool"u8))
|
||||
{
|
||||
if (prop.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
optionalLiteralBool = null;
|
||||
continue;
|
||||
}
|
||||
optionalLiteralBool = prop.Value.GetBoolean();
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("requiredBadDescription"u8))
|
||||
{
|
||||
requiredBadDescription = prop.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("optionalNullableList"u8))
|
||||
{
|
||||
if (prop.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
List<int> array = new List<int>();
|
||||
foreach (var item in prop.Value.EnumerateArray())
|
||||
{
|
||||
array.Add(item.GetInt32());
|
||||
}
|
||||
optionalNullableList = array;
|
||||
continue;
|
||||
}
|
||||
if (prop.NameEquals("requiredNullableList"u8))
|
||||
{
|
||||
if (prop.Value.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
requiredNullableList = new ChangeTrackingList<int>();
|
||||
continue;
|
||||
}
|
||||
List<int> array = new List<int>();
|
||||
foreach (var item in prop.Value.EnumerateArray())
|
||||
{
|
||||
array.Add(item.GetInt32());
|
||||
}
|
||||
requiredNullableList = array;
|
||||
continue;
|
||||
}
|
||||
if (options.Format != "W")
|
||||
{
|
||||
rawDataDictionary.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText()));
|
||||
}
|
||||
}
|
||||
serializedAdditionalRawData = rawDataDictionary;
|
||||
return new AnonymousBodyRequest(
|
||||
name,
|
||||
requiredUnion,
|
||||
requiredLiteralString,
|
||||
requiredLiteralInt,
|
||||
requiredLiteralFloat,
|
||||
requiredLiteralBool,
|
||||
optionalLiteralString,
|
||||
optionalLiteralInt,
|
||||
optionalLiteralFloat,
|
||||
optionalLiteralBool,
|
||||
requiredBadDescription,
|
||||
optionalNullableList ?? new ChangeTrackingList<int>(),
|
||||
requiredNullableList,
|
||||
serializedAdditionalRawData);
|
||||
}
|
||||
|
||||
BinaryData IPersistableModel<AnonymousBodyRequest>.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options);
|
||||
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<AnonymousBodyRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
switch (format)
|
||||
{
|
||||
case "J":
|
||||
return ModelReaderWriter.Write(this, options);
|
||||
default:
|
||||
throw new FormatException($"The model {nameof(AnonymousBodyRequest)} does not support writing '{options.Format}' format.");
|
||||
}
|
||||
}
|
||||
|
||||
AnonymousBodyRequest IPersistableModel<AnonymousBodyRequest>.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options);
|
||||
|
||||
/// <param name="data"> The data to parse. </param>
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual AnonymousBodyRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<AnonymousBodyRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
switch (format)
|
||||
{
|
||||
case "J":
|
||||
using (JsonDocument document = JsonDocument.Parse(data))
|
||||
{
|
||||
return DeserializeAnonymousBodyRequest(document.RootElement, options);
|
||||
}
|
||||
default:
|
||||
throw new FormatException($"The model {nameof(AnonymousBodyRequest)} does not support reading '{options.Format}' format.");
|
||||
}
|
||||
}
|
||||
|
||||
string IPersistableModel<AnonymousBodyRequest>.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
|
||||
|
||||
/// <param name="anonymousBodyRequest"> The <see cref="AnonymousBodyRequest"/> to serialize into <see cref="BinaryContent"/>. </param>
|
||||
public static implicit operator BinaryContent(AnonymousBodyRequest anonymousBodyRequest)
|
||||
{
|
||||
return BinaryContent.Create(anonymousBodyRequest, ModelSerializationExtensions.WireOptions);
|
||||
}
|
||||
|
||||
/// <param name="result"> The <see cref="ClientResult"/> to deserialize the <see cref="AnonymousBodyRequest"/> from. </param>
|
||||
public static explicit operator AnonymousBodyRequest(ClientResult result)
|
||||
{
|
||||
using PipelineResponse response = result.GetRawResponse();
|
||||
using JsonDocument document = JsonDocument.Parse(response.Content);
|
||||
return DeserializeAnonymousBodyRequest(document.RootElement, ModelSerializationExtensions.WireOptions);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using UnbrandedTypeSpec;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary> The AnonymousBodyRequest. </summary>
|
||||
public partial class AnonymousBodyRequest
|
||||
{
|
||||
/// <summary> Initializes a new instance of <see cref="AnonymousBodyRequest"/>. </summary>
|
||||
/// <param name="name"> name of the Thing. </param>
|
||||
/// <param name="requiredUnion"> required Union. </param>
|
||||
/// <param name="requiredBadDescription"> description with xml <|endoftext|>. </param>
|
||||
/// <param name="requiredNullableList"> required nullable collection. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="name"/>, <paramref name="requiredUnion"/> or <paramref name="requiredBadDescription"/> is null. </exception>
|
||||
public AnonymousBodyRequest(string name, BinaryData requiredUnion, string requiredBadDescription, IEnumerable<int> requiredNullableList)
|
||||
{
|
||||
Argument.AssertNotNull(name, nameof(name));
|
||||
Argument.AssertNotNull(requiredUnion, nameof(requiredUnion));
|
||||
Argument.AssertNotNull(requiredBadDescription, nameof(requiredBadDescription));
|
||||
|
||||
Name = name;
|
||||
RequiredUnion = requiredUnion;
|
||||
RequiredBadDescription = requiredBadDescription;
|
||||
OptionalNullableList = new ChangeTrackingList<int>();
|
||||
RequiredNullableList = requiredNullableList?.ToList();
|
||||
}
|
||||
|
||||
/// <summary> name of the Thing. </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// required Union
|
||||
/// <para> To assign an object to this property use <see cref="BinaryData.FromObjectAsJson{T}(T, JsonSerializerOptions?)"/>. </para>
|
||||
/// <para> To assign an already formatted json string to this property use <see cref="BinaryData.FromString(string)"/>. </para>
|
||||
/// <para>
|
||||
/// <remarks>
|
||||
/// Supported types:
|
||||
/// <list type="bullet">
|
||||
/// <item>
|
||||
/// <description> <see cref="string"/>. </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <description> <see cref="IList{T}"/> where <c>T</c> is of type <see cref="string"/>. </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <description> <see cref="int"/>. </description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Examples:
|
||||
/// <list type="bullet">
|
||||
/// <item>
|
||||
/// <term> BinaryData.FromObjectAsJson("foo"). </term>
|
||||
/// <description> Creates a payload of "foo". </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term> BinaryData.FromString("\"foo\""). </term>
|
||||
/// <description> Creates a payload of "foo". </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term> BinaryData.FromObjectAsJson(new { key = "value" }). </term>
|
||||
/// <description> Creates a payload of { "key": "value" }. </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term> BinaryData.FromString("{\"key\": \"value\"}"). </term>
|
||||
/// <description> Creates a payload of { "key": "value" }. </description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public BinaryData RequiredUnion { get; set; }
|
||||
|
||||
/// <summary> required literal string. </summary>
|
||||
public AnonymousBodyRequestRequiredLiteralString RequiredLiteralString { get; } = "accept";
|
||||
|
||||
/// <summary> required literal int. </summary>
|
||||
public AnonymousBodyRequestRequiredLiteralInt RequiredLiteralInt { get; } = 123;
|
||||
|
||||
/// <summary> required literal float. </summary>
|
||||
public AnonymousBodyRequestRequiredLiteralFloat RequiredLiteralFloat { get; } = 1.23F;
|
||||
|
||||
/// <summary> required literal bool. </summary>
|
||||
public bool RequiredLiteralBool { get; } = false;
|
||||
|
||||
/// <summary> optional literal string. </summary>
|
||||
public AnonymousBodyRequestOptionalLiteralString? OptionalLiteralString { get; set; }
|
||||
|
||||
/// <summary> optional literal int. </summary>
|
||||
public AnonymousBodyRequestOptionalLiteralInt? OptionalLiteralInt { get; set; }
|
||||
|
||||
/// <summary> optional literal float. </summary>
|
||||
public AnonymousBodyRequestOptionalLiteralFloat? OptionalLiteralFloat { get; set; }
|
||||
|
||||
/// <summary> optional literal bool. </summary>
|
||||
public bool? OptionalLiteralBool { get; set; }
|
||||
|
||||
/// <summary> description with xml <|endoftext|>. </summary>
|
||||
public string RequiredBadDescription { get; set; }
|
||||
|
||||
/// <summary> optional nullable collection. </summary>
|
||||
public IList<int> OptionalNullableList { get; set; }
|
||||
|
||||
/// <summary> required nullable collection. </summary>
|
||||
public IList<int> RequiredNullableList { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary> The AnonymousBodyRequest_optionalLiteralFloat. </summary>
|
||||
public readonly partial struct AnonymousBodyRequestOptionalLiteralFloat : IEquatable<AnonymousBodyRequestOptionalLiteralFloat>
|
||||
{
|
||||
private readonly float _value;
|
||||
/// <summary> 4.56. </summary>
|
||||
private const float _456Value = 4.56F;
|
||||
|
||||
/// <summary> Initializes a new instance of <see cref="AnonymousBodyRequestOptionalLiteralFloat"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
public AnonymousBodyRequestOptionalLiteralFloat(float value)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/// <summary> 4.56. </summary>
|
||||
public static AnonymousBodyRequestOptionalLiteralFloat _456 { get; } = new AnonymousBodyRequestOptionalLiteralFloat(_456Value);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestOptionalLiteralFloat"/> values are the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator ==(AnonymousBodyRequestOptionalLiteralFloat left, AnonymousBodyRequestOptionalLiteralFloat right) => left.Equals(right);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestOptionalLiteralFloat"/> values are not the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator !=(AnonymousBodyRequestOptionalLiteralFloat left, AnonymousBodyRequestOptionalLiteralFloat right) => !left.Equals(right);
|
||||
|
||||
/// <summary> Converts a string to a <see cref="AnonymousBodyRequestOptionalLiteralFloat"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
public static implicit operator AnonymousBodyRequestOptionalLiteralFloat(float value) => new AnonymousBodyRequestOptionalLiteralFloat(value);
|
||||
|
||||
/// <param name="obj"> The object to compare. </param>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override bool Equals(object obj) => obj is AnonymousBodyRequestOptionalLiteralFloat other && Equals(other);
|
||||
|
||||
/// <param name="other"> The instance to compare. </param>
|
||||
public bool Equals(AnonymousBodyRequestOptionalLiteralFloat other) => Equals(_value, other._value);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode() => _value.GetHashCode();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString() => _value.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
internal float ToSerialSingle() => _value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary> The AnonymousBodyRequest_optionalLiteralInt. </summary>
|
||||
public readonly partial struct AnonymousBodyRequestOptionalLiteralInt : IEquatable<AnonymousBodyRequestOptionalLiteralInt>
|
||||
{
|
||||
private readonly int _value;
|
||||
/// <summary> 456. </summary>
|
||||
private const int _456Value = 456;
|
||||
|
||||
/// <summary> Initializes a new instance of <see cref="AnonymousBodyRequestOptionalLiteralInt"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
public AnonymousBodyRequestOptionalLiteralInt(int value)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/// <summary> 456. </summary>
|
||||
public static AnonymousBodyRequestOptionalLiteralInt _456 { get; } = new AnonymousBodyRequestOptionalLiteralInt(_456Value);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestOptionalLiteralInt"/> values are the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator ==(AnonymousBodyRequestOptionalLiteralInt left, AnonymousBodyRequestOptionalLiteralInt right) => left.Equals(right);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestOptionalLiteralInt"/> values are not the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator !=(AnonymousBodyRequestOptionalLiteralInt left, AnonymousBodyRequestOptionalLiteralInt right) => !left.Equals(right);
|
||||
|
||||
/// <summary> Converts a string to a <see cref="AnonymousBodyRequestOptionalLiteralInt"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
public static implicit operator AnonymousBodyRequestOptionalLiteralInt(int value) => new AnonymousBodyRequestOptionalLiteralInt(value);
|
||||
|
||||
/// <param name="obj"> The object to compare. </param>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override bool Equals(object obj) => obj is AnonymousBodyRequestOptionalLiteralInt other && Equals(other);
|
||||
|
||||
/// <param name="other"> The instance to compare. </param>
|
||||
public bool Equals(AnonymousBodyRequestOptionalLiteralInt other) => Equals(_value, other._value);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode() => _value.GetHashCode();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString() => _value.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
internal int ToSerialInt32() => _value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using UnbrandedTypeSpec;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary> The AnonymousBodyRequest_optionalLiteralString. </summary>
|
||||
public readonly partial struct AnonymousBodyRequestOptionalLiteralString : IEquatable<AnonymousBodyRequestOptionalLiteralString>
|
||||
{
|
||||
private readonly string _value;
|
||||
/// <summary> reject. </summary>
|
||||
private const string RejectValue = "reject";
|
||||
|
||||
/// <summary> Initializes a new instance of <see cref="AnonymousBodyRequestOptionalLiteralString"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
|
||||
public AnonymousBodyRequestOptionalLiteralString(string value)
|
||||
{
|
||||
Argument.AssertNotNull(value, nameof(value));
|
||||
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/// <summary> reject. </summary>
|
||||
public static AnonymousBodyRequestOptionalLiteralString Reject { get; } = new AnonymousBodyRequestOptionalLiteralString(RejectValue);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestOptionalLiteralString"/> values are the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator ==(AnonymousBodyRequestOptionalLiteralString left, AnonymousBodyRequestOptionalLiteralString right) => left.Equals(right);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestOptionalLiteralString"/> values are not the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator !=(AnonymousBodyRequestOptionalLiteralString left, AnonymousBodyRequestOptionalLiteralString right) => !left.Equals(right);
|
||||
|
||||
/// <summary> Converts a string to a <see cref="AnonymousBodyRequestOptionalLiteralString"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
public static implicit operator AnonymousBodyRequestOptionalLiteralString(string value) => new AnonymousBodyRequestOptionalLiteralString(value);
|
||||
|
||||
/// <param name="obj"> The object to compare. </param>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override bool Equals(object obj) => obj is AnonymousBodyRequestOptionalLiteralString other && Equals(other);
|
||||
|
||||
/// <param name="other"> The instance to compare. </param>
|
||||
public bool Equals(AnonymousBodyRequestOptionalLiteralString other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString() => _value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary> The AnonymousBodyRequest_requiredLiteralFloat. </summary>
|
||||
public readonly partial struct AnonymousBodyRequestRequiredLiteralFloat : IEquatable<AnonymousBodyRequestRequiredLiteralFloat>
|
||||
{
|
||||
private readonly float _value;
|
||||
/// <summary> 1.23. </summary>
|
||||
private const float _123Value = 1.23F;
|
||||
|
||||
/// <summary> Initializes a new instance of <see cref="AnonymousBodyRequestRequiredLiteralFloat"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
public AnonymousBodyRequestRequiredLiteralFloat(float value)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/// <summary> 1.23. </summary>
|
||||
public static AnonymousBodyRequestRequiredLiteralFloat _123 { get; } = new AnonymousBodyRequestRequiredLiteralFloat(_123Value);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestRequiredLiteralFloat"/> values are the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator ==(AnonymousBodyRequestRequiredLiteralFloat left, AnonymousBodyRequestRequiredLiteralFloat right) => left.Equals(right);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestRequiredLiteralFloat"/> values are not the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator !=(AnonymousBodyRequestRequiredLiteralFloat left, AnonymousBodyRequestRequiredLiteralFloat right) => !left.Equals(right);
|
||||
|
||||
/// <summary> Converts a string to a <see cref="AnonymousBodyRequestRequiredLiteralFloat"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
public static implicit operator AnonymousBodyRequestRequiredLiteralFloat(float value) => new AnonymousBodyRequestRequiredLiteralFloat(value);
|
||||
|
||||
/// <param name="obj"> The object to compare. </param>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override bool Equals(object obj) => obj is AnonymousBodyRequestRequiredLiteralFloat other && Equals(other);
|
||||
|
||||
/// <param name="other"> The instance to compare. </param>
|
||||
public bool Equals(AnonymousBodyRequestRequiredLiteralFloat other) => Equals(_value, other._value);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode() => _value.GetHashCode();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString() => _value.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
internal float ToSerialSingle() => _value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary> The AnonymousBodyRequest_requiredLiteralInt. </summary>
|
||||
public readonly partial struct AnonymousBodyRequestRequiredLiteralInt : IEquatable<AnonymousBodyRequestRequiredLiteralInt>
|
||||
{
|
||||
private readonly int _value;
|
||||
/// <summary> 123. </summary>
|
||||
private const int _123Value = 123;
|
||||
|
||||
/// <summary> Initializes a new instance of <see cref="AnonymousBodyRequestRequiredLiteralInt"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
public AnonymousBodyRequestRequiredLiteralInt(int value)
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/// <summary> 123. </summary>
|
||||
public static AnonymousBodyRequestRequiredLiteralInt _123 { get; } = new AnonymousBodyRequestRequiredLiteralInt(_123Value);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestRequiredLiteralInt"/> values are the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator ==(AnonymousBodyRequestRequiredLiteralInt left, AnonymousBodyRequestRequiredLiteralInt right) => left.Equals(right);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestRequiredLiteralInt"/> values are not the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator !=(AnonymousBodyRequestRequiredLiteralInt left, AnonymousBodyRequestRequiredLiteralInt right) => !left.Equals(right);
|
||||
|
||||
/// <summary> Converts a string to a <see cref="AnonymousBodyRequestRequiredLiteralInt"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
public static implicit operator AnonymousBodyRequestRequiredLiteralInt(int value) => new AnonymousBodyRequestRequiredLiteralInt(value);
|
||||
|
||||
/// <param name="obj"> The object to compare. </param>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override bool Equals(object obj) => obj is AnonymousBodyRequestRequiredLiteralInt other && Equals(other);
|
||||
|
||||
/// <param name="other"> The instance to compare. </param>
|
||||
public bool Equals(AnonymousBodyRequestRequiredLiteralInt other) => Equals(_value, other._value);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode() => _value.GetHashCode();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString() => _value.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
internal int ToSerialInt32() => _value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using UnbrandedTypeSpec;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary> The AnonymousBodyRequest_requiredLiteralString. </summary>
|
||||
public readonly partial struct AnonymousBodyRequestRequiredLiteralString : IEquatable<AnonymousBodyRequestRequiredLiteralString>
|
||||
{
|
||||
private readonly string _value;
|
||||
/// <summary> accept. </summary>
|
||||
private const string AcceptValue = "accept";
|
||||
|
||||
/// <summary> Initializes a new instance of <see cref="AnonymousBodyRequestRequiredLiteralString"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
|
||||
public AnonymousBodyRequestRequiredLiteralString(string value)
|
||||
{
|
||||
Argument.AssertNotNull(value, nameof(value));
|
||||
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/// <summary> accept. </summary>
|
||||
public static AnonymousBodyRequestRequiredLiteralString Accept { get; } = new AnonymousBodyRequestRequiredLiteralString(AcceptValue);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestRequiredLiteralString"/> values are the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator ==(AnonymousBodyRequestRequiredLiteralString left, AnonymousBodyRequestRequiredLiteralString right) => left.Equals(right);
|
||||
|
||||
/// <summary> Determines if two <see cref="AnonymousBodyRequestRequiredLiteralString"/> values are not the same. </summary>
|
||||
/// <param name="left"> The left value to compare. </param>
|
||||
/// <param name="right"> The right value to compare. </param>
|
||||
public static bool operator !=(AnonymousBodyRequestRequiredLiteralString left, AnonymousBodyRequestRequiredLiteralString right) => !left.Equals(right);
|
||||
|
||||
/// <summary> Converts a string to a <see cref="AnonymousBodyRequestRequiredLiteralString"/>. </summary>
|
||||
/// <param name="value"> The value. </param>
|
||||
public static implicit operator AnonymousBodyRequestRequiredLiteralString(string value) => new AnonymousBodyRequestRequiredLiteralString(value);
|
||||
|
||||
/// <param name="obj"> The object to compare. </param>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override bool Equals(object obj) => obj is AnonymousBodyRequestRequiredLiteralString other && Equals(other);
|
||||
|
||||
/// <param name="other"> The instance to compare. </param>
|
||||
public bool Equals(AnonymousBodyRequestRequiredLiteralString other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString() => _value;
|
||||
}
|
||||
}
|
|
@ -2,21 +2,13 @@
|
|||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using UnbrandedTypeSpec;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary> this is not a friendly model but with a friendly name. </summary>
|
||||
public partial class Friend
|
||||
{
|
||||
/// <summary> Initializes a new instance of <see cref="Friend"/>. </summary>
|
||||
/// <param name="name"> name of the NotFriend. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
|
||||
public Friend(string name)
|
||||
internal Friend(string name)
|
||||
{
|
||||
Argument.AssertNotNull(name, nameof(name));
|
||||
|
||||
Name = name;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.ClientModel;
|
||||
using System.ClientModel.Primitives;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using UnbrandedTypeSpec;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary></summary>
|
||||
public partial class FriendlyModelRequest : IJsonModel<FriendlyModelRequest>
|
||||
{
|
||||
/// <summary> Keeps track of any properties unknown to the library. </summary>
|
||||
private IDictionary<string, BinaryData> _serializedAdditionalRawData;
|
||||
|
||||
internal FriendlyModelRequest(string name, IDictionary<string, BinaryData> serializedAdditionalRawData)
|
||||
{
|
||||
Name = name;
|
||||
_serializedAdditionalRawData = serializedAdditionalRawData;
|
||||
}
|
||||
|
||||
internal FriendlyModelRequest()
|
||||
{
|
||||
}
|
||||
|
||||
void IJsonModel<FriendlyModelRequest>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
JsonModelWriteCore(writer, options);
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
|
||||
/// <param name="writer"> The JSON writer. </param>
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<FriendlyModelRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
if (format != "J")
|
||||
{
|
||||
throw new FormatException($"The model {nameof(FriendlyModelRequest)} does not support writing '{format}' format.");
|
||||
}
|
||||
writer.WritePropertyName("name"u8);
|
||||
writer.WriteStringValue(Name);
|
||||
if (options.Format != "W" && _serializedAdditionalRawData != null)
|
||||
{
|
||||
foreach (var item in _serializedAdditionalRawData)
|
||||
{
|
||||
writer.WritePropertyName(item.Key);
|
||||
#if NET6_0_OR_GREATER
|
||||
writer.WriteRawValue(item.Value);
|
||||
#else
|
||||
using (JsonDocument document = JsonDocument.Parse(item.Value))
|
||||
{
|
||||
JsonSerializer.Serialize(writer, document.RootElement);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FriendlyModelRequest IJsonModel<FriendlyModelRequest>.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options);
|
||||
|
||||
/// <param name="reader"> The JSON reader. </param>
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual FriendlyModelRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<FriendlyModelRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
if (format != "J")
|
||||
{
|
||||
throw new FormatException($"The model {nameof(FriendlyModelRequest)} does not support reading '{format}' format.");
|
||||
}
|
||||
using JsonDocument document = JsonDocument.ParseValue(ref reader);
|
||||
return DeserializeFriendlyModelRequest(document.RootElement, options);
|
||||
}
|
||||
|
||||
internal static FriendlyModelRequest DeserializeFriendlyModelRequest(JsonElement element, ModelReaderWriterOptions options)
|
||||
{
|
||||
if (element.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string name = default;
|
||||
IDictionary<string, BinaryData> serializedAdditionalRawData = default;
|
||||
Dictionary<string, BinaryData> rawDataDictionary = new Dictionary<string, BinaryData>();
|
||||
foreach (var prop in element.EnumerateObject())
|
||||
{
|
||||
if (prop.NameEquals("name"u8))
|
||||
{
|
||||
name = prop.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (options.Format != "W")
|
||||
{
|
||||
rawDataDictionary.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText()));
|
||||
}
|
||||
}
|
||||
serializedAdditionalRawData = rawDataDictionary;
|
||||
return new FriendlyModelRequest(name, serializedAdditionalRawData);
|
||||
}
|
||||
|
||||
BinaryData IPersistableModel<FriendlyModelRequest>.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options);
|
||||
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<FriendlyModelRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
switch (format)
|
||||
{
|
||||
case "J":
|
||||
return ModelReaderWriter.Write(this, options);
|
||||
default:
|
||||
throw new FormatException($"The model {nameof(FriendlyModelRequest)} does not support writing '{options.Format}' format.");
|
||||
}
|
||||
}
|
||||
|
||||
FriendlyModelRequest IPersistableModel<FriendlyModelRequest>.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options);
|
||||
|
||||
/// <param name="data"> The data to parse. </param>
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual FriendlyModelRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<FriendlyModelRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
switch (format)
|
||||
{
|
||||
case "J":
|
||||
using (JsonDocument document = JsonDocument.Parse(data))
|
||||
{
|
||||
return DeserializeFriendlyModelRequest(document.RootElement, options);
|
||||
}
|
||||
default:
|
||||
throw new FormatException($"The model {nameof(FriendlyModelRequest)} does not support reading '{options.Format}' format.");
|
||||
}
|
||||
}
|
||||
|
||||
string IPersistableModel<FriendlyModelRequest>.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
|
||||
|
||||
/// <param name="friendlyModelRequest"> The <see cref="FriendlyModelRequest"/> to serialize into <see cref="BinaryContent"/>. </param>
|
||||
public static implicit operator BinaryContent(FriendlyModelRequest friendlyModelRequest)
|
||||
{
|
||||
return BinaryContent.Create(friendlyModelRequest, ModelSerializationExtensions.WireOptions);
|
||||
}
|
||||
|
||||
/// <param name="result"> The <see cref="ClientResult"/> to deserialize the <see cref="FriendlyModelRequest"/> from. </param>
|
||||
public static explicit operator FriendlyModelRequest(ClientResult result)
|
||||
{
|
||||
using PipelineResponse response = result.GetRawResponse();
|
||||
using JsonDocument document = JsonDocument.Parse(response.Content);
|
||||
return DeserializeFriendlyModelRequest(document.RootElement, ModelSerializationExtensions.WireOptions);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using UnbrandedTypeSpec;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary> The FriendlyModelRequest. </summary>
|
||||
public partial class FriendlyModelRequest
|
||||
{
|
||||
/// <summary> Initializes a new instance of <see cref="FriendlyModelRequest"/>. </summary>
|
||||
/// <param name="name"> name of the NotFriend. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
|
||||
public FriendlyModelRequest(string name)
|
||||
{
|
||||
Argument.AssertNotNull(name, nameof(name));
|
||||
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary> name of the NotFriend. </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
|
@ -2,21 +2,13 @@
|
|||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using UnbrandedTypeSpec;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary> this is a model with a projected name. </summary>
|
||||
public partial class ProjectedModel
|
||||
{
|
||||
/// <summary> Initializes a new instance of <see cref="ProjectedModel"/>. </summary>
|
||||
/// <param name="name"> name of the ModelWithProjectedName. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
|
||||
public ProjectedModel(string name)
|
||||
internal ProjectedModel(string name)
|
||||
{
|
||||
Argument.AssertNotNull(name, nameof(name));
|
||||
|
||||
Name = name;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.ClientModel;
|
||||
using System.ClientModel.Primitives;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using UnbrandedTypeSpec;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary></summary>
|
||||
public partial class ProjectedNameModelRequest : IJsonModel<ProjectedNameModelRequest>
|
||||
{
|
||||
/// <summary> Keeps track of any properties unknown to the library. </summary>
|
||||
private IDictionary<string, BinaryData> _serializedAdditionalRawData;
|
||||
|
||||
internal ProjectedNameModelRequest(string name, IDictionary<string, BinaryData> serializedAdditionalRawData)
|
||||
{
|
||||
Name = name;
|
||||
_serializedAdditionalRawData = serializedAdditionalRawData;
|
||||
}
|
||||
|
||||
internal ProjectedNameModelRequest()
|
||||
{
|
||||
}
|
||||
|
||||
void IJsonModel<ProjectedNameModelRequest>.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
JsonModelWriteCore(writer, options);
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
|
||||
/// <param name="writer"> The JSON writer. </param>
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<ProjectedNameModelRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
if (format != "J")
|
||||
{
|
||||
throw new FormatException($"The model {nameof(ProjectedNameModelRequest)} does not support writing '{format}' format.");
|
||||
}
|
||||
writer.WritePropertyName("name"u8);
|
||||
writer.WriteStringValue(Name);
|
||||
if (options.Format != "W" && _serializedAdditionalRawData != null)
|
||||
{
|
||||
foreach (var item in _serializedAdditionalRawData)
|
||||
{
|
||||
writer.WritePropertyName(item.Key);
|
||||
#if NET6_0_OR_GREATER
|
||||
writer.WriteRawValue(item.Value);
|
||||
#else
|
||||
using (JsonDocument document = JsonDocument.Parse(item.Value))
|
||||
{
|
||||
JsonSerializer.Serialize(writer, document.RootElement);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProjectedNameModelRequest IJsonModel<ProjectedNameModelRequest>.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options);
|
||||
|
||||
/// <param name="reader"> The JSON reader. </param>
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual ProjectedNameModelRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<ProjectedNameModelRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
if (format != "J")
|
||||
{
|
||||
throw new FormatException($"The model {nameof(ProjectedNameModelRequest)} does not support reading '{format}' format.");
|
||||
}
|
||||
using JsonDocument document = JsonDocument.ParseValue(ref reader);
|
||||
return DeserializeProjectedNameModelRequest(document.RootElement, options);
|
||||
}
|
||||
|
||||
internal static ProjectedNameModelRequest DeserializeProjectedNameModelRequest(JsonElement element, ModelReaderWriterOptions options)
|
||||
{
|
||||
if (element.ValueKind == JsonValueKind.Null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string name = default;
|
||||
IDictionary<string, BinaryData> serializedAdditionalRawData = default;
|
||||
Dictionary<string, BinaryData> rawDataDictionary = new Dictionary<string, BinaryData>();
|
||||
foreach (var prop in element.EnumerateObject())
|
||||
{
|
||||
if (prop.NameEquals("name"u8))
|
||||
{
|
||||
name = prop.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (options.Format != "W")
|
||||
{
|
||||
rawDataDictionary.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText()));
|
||||
}
|
||||
}
|
||||
serializedAdditionalRawData = rawDataDictionary;
|
||||
return new ProjectedNameModelRequest(name, serializedAdditionalRawData);
|
||||
}
|
||||
|
||||
BinaryData IPersistableModel<ProjectedNameModelRequest>.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options);
|
||||
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<ProjectedNameModelRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
switch (format)
|
||||
{
|
||||
case "J":
|
||||
return ModelReaderWriter.Write(this, options);
|
||||
default:
|
||||
throw new FormatException($"The model {nameof(ProjectedNameModelRequest)} does not support writing '{options.Format}' format.");
|
||||
}
|
||||
}
|
||||
|
||||
ProjectedNameModelRequest IPersistableModel<ProjectedNameModelRequest>.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options);
|
||||
|
||||
/// <param name="data"> The data to parse. </param>
|
||||
/// <param name="options"> The client options for reading and writing models. </param>
|
||||
protected virtual ProjectedNameModelRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options)
|
||||
{
|
||||
string format = options.Format == "W" ? ((IPersistableModel<ProjectedNameModelRequest>)this).GetFormatFromOptions(options) : options.Format;
|
||||
switch (format)
|
||||
{
|
||||
case "J":
|
||||
using (JsonDocument document = JsonDocument.Parse(data))
|
||||
{
|
||||
return DeserializeProjectedNameModelRequest(document.RootElement, options);
|
||||
}
|
||||
default:
|
||||
throw new FormatException($"The model {nameof(ProjectedNameModelRequest)} does not support reading '{options.Format}' format.");
|
||||
}
|
||||
}
|
||||
|
||||
string IPersistableModel<ProjectedNameModelRequest>.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
|
||||
|
||||
/// <param name="projectedNameModelRequest"> The <see cref="ProjectedNameModelRequest"/> to serialize into <see cref="BinaryContent"/>. </param>
|
||||
public static implicit operator BinaryContent(ProjectedNameModelRequest projectedNameModelRequest)
|
||||
{
|
||||
return BinaryContent.Create(projectedNameModelRequest, ModelSerializationExtensions.WireOptions);
|
||||
}
|
||||
|
||||
/// <param name="result"> The <see cref="ClientResult"/> to deserialize the <see cref="ProjectedNameModelRequest"/> from. </param>
|
||||
public static explicit operator ProjectedNameModelRequest(ClientResult result)
|
||||
{
|
||||
using PipelineResponse response = result.GetRawResponse();
|
||||
using JsonDocument document = JsonDocument.Parse(response.Content);
|
||||
return DeserializeProjectedNameModelRequest(document.RootElement, ModelSerializationExtensions.WireOptions);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// <auto-generated/>
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using UnbrandedTypeSpec;
|
||||
|
||||
namespace UnbrandedTypeSpec.Models
|
||||
{
|
||||
/// <summary> The ProjectedNameModelRequest. </summary>
|
||||
public partial class ProjectedNameModelRequest
|
||||
{
|
||||
/// <summary> Initializes a new instance of <see cref="ProjectedNameModelRequest"/>. </summary>
|
||||
/// <param name="name"> name of the ModelWithProjectedName. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
|
||||
public ProjectedNameModelRequest(string name)
|
||||
{
|
||||
Argument.AssertNotNull(name, nameof(name));
|
||||
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary> name of the ModelWithProjectedName. </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
|
@ -56,12 +56,12 @@ namespace UnbrandedTypeSpec
|
|||
throw new NotImplementedException("Method not implemented.");
|
||||
}
|
||||
|
||||
internal PipelineMessage CreateAnonymousBodyRequest(BinaryContent content, RequestOptions options)
|
||||
internal PipelineMessage CreateAnonymousBodyRequest(RequestOptions options)
|
||||
{
|
||||
throw new NotImplementedException("Method not implemented.");
|
||||
}
|
||||
|
||||
internal PipelineMessage CreateFriendlyModelRequest(BinaryContent content, RequestOptions options)
|
||||
internal PipelineMessage CreateFriendlyModelRequest(RequestOptions options)
|
||||
{
|
||||
throw new NotImplementedException("Method not implemented.");
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ namespace UnbrandedTypeSpec
|
|||
throw new NotImplementedException("Method not implemented.");
|
||||
}
|
||||
|
||||
internal PipelineMessage CreateProjectedNameModelRequest(BinaryContent content, RequestOptions options)
|
||||
internal PipelineMessage CreateProjectedNameModelRequest(RequestOptions options)
|
||||
{
|
||||
throw new NotImplementedException("Method not implemented.");
|
||||
}
|
||||
|
|
|
@ -593,13 +593,12 @@ namespace UnbrandedTypeSpec
|
|||
/// </item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="content"> The content to send as the body of the request. </param>
|
||||
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
/// <returns> The response returned from the service. </returns>
|
||||
public virtual ClientResult AnonymousBody(BinaryContent content, RequestOptions options)
|
||||
public virtual ClientResult AnonymousBody(RequestOptions options)
|
||||
{
|
||||
using PipelineMessage message = CreateAnonymousBodyRequest(content, options);
|
||||
using PipelineMessage message = CreateAnonymousBodyRequest(options);
|
||||
return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options));
|
||||
}
|
||||
|
||||
|
@ -611,38 +610,27 @@ namespace UnbrandedTypeSpec
|
|||
/// </item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="content"> The content to send as the body of the request. </param>
|
||||
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
/// <returns> The response returned from the service. </returns>
|
||||
public virtual async Task<ClientResult> AnonymousBodyAsync(BinaryContent content, RequestOptions options)
|
||||
public virtual async Task<ClientResult> AnonymousBodyAsync(RequestOptions options)
|
||||
{
|
||||
using PipelineMessage message = CreateAnonymousBodyRequest(content, options);
|
||||
using PipelineMessage message = CreateAnonymousBodyRequest(options);
|
||||
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
/// <summary> body parameter without body decorator. </summary>
|
||||
/// <param name="Thing"> A model with a few properties of literal types. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="Thing"/> is null. </exception>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
public virtual ClientResult AnonymousBody(Thing Thing)
|
||||
public virtual ClientResult AnonymousBody()
|
||||
{
|
||||
Argument.AssertNotNull(Thing, nameof(Thing));
|
||||
|
||||
ClientResult result = AnonymousBody(Thing, null);
|
||||
return ClientResult.FromValue((Thing)result, result.GetRawResponse());
|
||||
return AnonymousBody(null);
|
||||
}
|
||||
|
||||
/// <summary> body parameter without body decorator. </summary>
|
||||
/// <param name="Thing"> A model with a few properties of literal types. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="Thing"/> is null. </exception>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
public virtual async Task<ClientResult> AnonymousBodyAsync(Thing Thing)
|
||||
public virtual async Task<ClientResult> AnonymousBodyAsync()
|
||||
{
|
||||
Argument.AssertNotNull(Thing, nameof(Thing));
|
||||
|
||||
ClientResult result = await AnonymousBodyAsync(Thing, null).ConfigureAwait(false);
|
||||
return ClientResult.FromValue((Thing)result, result.GetRawResponse());
|
||||
return await AnonymousBodyAsync(null).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -653,13 +641,12 @@ namespace UnbrandedTypeSpec
|
|||
/// </item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="content"> The content to send as the body of the request. </param>
|
||||
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
/// <returns> The response returned from the service. </returns>
|
||||
public virtual ClientResult FriendlyModel(BinaryContent content, RequestOptions options)
|
||||
public virtual ClientResult FriendlyModel(RequestOptions options)
|
||||
{
|
||||
using PipelineMessage message = CreateFriendlyModelRequest(content, options);
|
||||
using PipelineMessage message = CreateFriendlyModelRequest(options);
|
||||
return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options));
|
||||
}
|
||||
|
||||
|
@ -671,38 +658,27 @@ namespace UnbrandedTypeSpec
|
|||
/// </item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="content"> The content to send as the body of the request. </param>
|
||||
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
/// <returns> The response returned from the service. </returns>
|
||||
public virtual async Task<ClientResult> FriendlyModelAsync(BinaryContent content, RequestOptions options)
|
||||
public virtual async Task<ClientResult> FriendlyModelAsync(RequestOptions options)
|
||||
{
|
||||
using PipelineMessage message = CreateFriendlyModelRequest(content, options);
|
||||
using PipelineMessage message = CreateFriendlyModelRequest(options);
|
||||
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
/// <summary> Model can have its friendly name. </summary>
|
||||
/// <param name="Friend"> this is not a friendly model but with a friendly name. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="Friend"/> is null. </exception>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
public virtual ClientResult FriendlyModel(Friend Friend)
|
||||
public virtual ClientResult FriendlyModel()
|
||||
{
|
||||
Argument.AssertNotNull(Friend, nameof(Friend));
|
||||
|
||||
ClientResult result = FriendlyModel(Friend, null);
|
||||
return ClientResult.FromValue((Friend)result, result.GetRawResponse());
|
||||
return FriendlyModel(null);
|
||||
}
|
||||
|
||||
/// <summary> Model can have its friendly name. </summary>
|
||||
/// <param name="Friend"> this is not a friendly model but with a friendly name. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="Friend"/> is null. </exception>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
public virtual async Task<ClientResult> FriendlyModelAsync(Friend Friend)
|
||||
public virtual async Task<ClientResult> FriendlyModelAsync()
|
||||
{
|
||||
Argument.AssertNotNull(Friend, nameof(Friend));
|
||||
|
||||
ClientResult result = await FriendlyModelAsync(Friend, null).ConfigureAwait(false);
|
||||
return ClientResult.FromValue((Friend)result, result.GetRawResponse());
|
||||
return await FriendlyModelAsync(null).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -765,13 +741,12 @@ namespace UnbrandedTypeSpec
|
|||
/// </item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="content"> The content to send as the body of the request. </param>
|
||||
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
/// <returns> The response returned from the service. </returns>
|
||||
public virtual ClientResult ProjectedNameModel(BinaryContent content, RequestOptions options)
|
||||
public virtual ClientResult ProjectedNameModel(RequestOptions options)
|
||||
{
|
||||
using PipelineMessage message = CreateProjectedNameModelRequest(content, options);
|
||||
using PipelineMessage message = CreateProjectedNameModelRequest(options);
|
||||
return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options));
|
||||
}
|
||||
|
||||
|
@ -783,38 +758,27 @@ namespace UnbrandedTypeSpec
|
|||
/// </item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="content"> The content to send as the body of the request. </param>
|
||||
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
/// <returns> The response returned from the service. </returns>
|
||||
public virtual async Task<ClientResult> ProjectedNameModelAsync(BinaryContent content, RequestOptions options)
|
||||
public virtual async Task<ClientResult> ProjectedNameModelAsync(RequestOptions options)
|
||||
{
|
||||
using PipelineMessage message = CreateProjectedNameModelRequest(content, options);
|
||||
using PipelineMessage message = CreateProjectedNameModelRequest(options);
|
||||
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
/// <summary> Model can have its projected name. </summary>
|
||||
/// <param name="ProjectedModel"> this is a model with a projected name. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="ProjectedModel"/> is null. </exception>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
public virtual ClientResult ProjectedNameModel(ProjectedModel ProjectedModel)
|
||||
public virtual ClientResult ProjectedNameModel()
|
||||
{
|
||||
Argument.AssertNotNull(ProjectedModel, nameof(ProjectedModel));
|
||||
|
||||
ClientResult result = ProjectedNameModel(ProjectedModel, null);
|
||||
return ClientResult.FromValue((ProjectedModel)result, result.GetRawResponse());
|
||||
return ProjectedNameModel(null);
|
||||
}
|
||||
|
||||
/// <summary> Model can have its projected name. </summary>
|
||||
/// <param name="ProjectedModel"> this is a model with a projected name. </param>
|
||||
/// <exception cref="ArgumentNullException"> <paramref name="ProjectedModel"/> is null. </exception>
|
||||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
|
||||
public virtual async Task<ClientResult> ProjectedNameModelAsync(ProjectedModel ProjectedModel)
|
||||
public virtual async Task<ClientResult> ProjectedNameModelAsync()
|
||||
{
|
||||
Argument.AssertNotNull(ProjectedModel, nameof(ProjectedModel));
|
||||
|
||||
ClientResult result = await ProjectedNameModelAsync(ProjectedModel, null).ConfigureAwait(false);
|
||||
return ClientResult.FromValue((ProjectedModel)result, result.GetRawResponse());
|
||||
return await ProjectedNameModelAsync(null).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -13,7 +13,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@azure-tools/typespec-azure-core": "0.43.0",
|
||||
"@azure-tools/typespec-client-generator-core": "0.43.1",
|
||||
"@azure-tools/typespec-client-generator-core": "0.43.2",
|
||||
"@microsoft/api-extractor": "^7.40.3",
|
||||
"@types/node": "~18.13.0",
|
||||
"@typespec/compiler": "0.57.0",
|
||||
|
@ -74,9 +74,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@azure-tools/typespec-client-generator-core": {
|
||||
"version": "0.43.1",
|
||||
"resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.43.1.tgz",
|
||||
"integrity": "sha512-NwNN/fIOcjOU/8o6ViCuEAAQl6zmu2X1QKPuXxeSy8ssDwrTiX9Ho2X/7IZM4XmOArKTtgmTkNcSnnmuj5dsGg==",
|
||||
"version": "0.43.2",
|
||||
"resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.43.2.tgz",
|
||||
"integrity": "sha512-UAVV30BtTQBiXmBoQ3SyvmiuBDYoqWFIn7G96hjojpwXpE6D5ba0y5LascMuF1b65eAhGnnf974DElJE9DGepQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"change-case": "~5.4.4",
|
||||
|
@ -90,8 +90,7 @@
|
|||
"@typespec/compiler": "~0.57.0",
|
||||
"@typespec/http": "~0.57.0",
|
||||
"@typespec/rest": "~0.57.0",
|
||||
"@typespec/versioning": "~0.57.0",
|
||||
"@typespec/xml": "~0.57.0"
|
||||
"@typespec/versioning": "~0.57.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
|
@ -1358,19 +1357,6 @@
|
|||
"@typespec/compiler": "~0.57.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@typespec/xml": {
|
||||
"version": "0.57.0",
|
||||
"resolved": "https://registry.npmjs.org/@typespec/xml/-/xml-0.57.0.tgz",
|
||||
"integrity": "sha512-itsFsahgBRNREoF4FXUgELmNGtOMmzNnhxT+NeAl4f7EXmz/mu1y/k9hWmDXWr+DB0Oq1r0Fc+D0TSl51szzlQ==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@typespec/compiler": "~0.57.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vitest/coverage-v8": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-1.4.0.tgz",
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@azure-tools/typespec-azure-core": "0.43.0",
|
||||
"@azure-tools/typespec-client-generator-core": "0.43.1",
|
||||
"@azure-tools/typespec-client-generator-core": "0.43.2",
|
||||
"@microsoft/api-extractor": "^7.40.3",
|
||||
"@types/node": "~18.13.0",
|
||||
"@typespec/compiler": "0.57.0",
|
||||
|
|
Загрузка…
Ссылка в новой задаче