mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-27 10:47:01 +02:00
Add Grpc ProtoBuf support (request-response) (#1047)
* ProtoBuf
* .
* x
* ---
* x
* fx
* ...
* sc
* ...
* .
* groen
* x
* fix tests
* ok!?
* fix tests
* fix tests
* !
* x
* 6
* .
* x
* ivaluematcher
* transformer
* .
* sc
* .
* mapping
* x
* tra
* com
* ...
* .
* .
* .
* AddProtoDefinition
* .
* set
* grpahj
* .
* .
* IdOrText
* ...
* async
* async2
* .
* t
* nuget
* <PackageReference Include="ProtoBufJsonConverter" Version="0.2.0-preview-04" />
* http version
* tests
* .WithHttpVersion("2")
* <PackageReference Include="ProtoBufJsonConverter" Version="0.2.0" />
* HttpVersionParser
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WireMock.Models;
|
||||
using WireMock.Types;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace WireMock.Util;
|
||||
|
||||
/// <summary>
|
||||
@@ -9,7 +12,7 @@ namespace WireMock.Util;
|
||||
/// </summary>
|
||||
public class BodyData : IBodyData
|
||||
{
|
||||
/// <inheritdoc cref="IBodyData.Encoding" />
|
||||
/// <inheritdoc />
|
||||
public Encoding? Encoding { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -18,30 +21,38 @@ public class BodyData : IBodyData
|
||||
/// <inheritdoc />
|
||||
public IDictionary<string, string>? BodyAsFormUrlEncoded { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IBodyData.BodyAsJson" />
|
||||
/// <inheritdoc />
|
||||
public object? BodyAsJson { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IBodyData.BodyAsBytes" />
|
||||
/// <inheritdoc />
|
||||
public byte[]? BodyAsBytes { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IBodyData.BodyAsJsonIndented" />
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool? BodyAsJsonIndented { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IBodyData.BodyAsFile" />
|
||||
/// <inheritdoc />
|
||||
public string? BodyAsFile { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IBodyData.BodyAsFileIsCached" />
|
||||
/// <inheritdoc />
|
||||
public bool? BodyAsFileIsCached { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IBodyData.DetectedBodyType" />
|
||||
/// <inheritdoc />
|
||||
public BodyType? DetectedBodyType { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IBodyData.DetectedBodyTypeFromContentType" />
|
||||
/// <inheritdoc />
|
||||
public BodyType? DetectedBodyTypeFromContentType { get; set; }
|
||||
|
||||
/// <inheritdoc cref="IRequestMessage.DetectedCompression" />
|
||||
/// <inheritdoc />
|
||||
public string? DetectedCompression { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string? IsFuncUsed { get; set; }
|
||||
|
||||
#region ProtoBuf
|
||||
/// <inheritdoc />
|
||||
public Func<IdOrText>? ProtoDefinition { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string? ProtoBufMessageType { get; set; }
|
||||
#endregion
|
||||
}
|
||||
61
src/WireMock.Net/Models/GraphQLSchemaDetails.cs
Normal file
61
src/WireMock.Net/Models/GraphQLSchemaDetails.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AnyOfTypes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace WireMock.Models;
|
||||
|
||||
/// <summary>
|
||||
/// GraphQLSchemaDetails
|
||||
/// </summary>
|
||||
public class GraphQLSchemaDetails
|
||||
{
|
||||
/// <summary>
|
||||
/// The GraphQL schema as a string.
|
||||
/// </summary>
|
||||
public string? SchemaAsString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The GraphQL schema as a StringPattern.
|
||||
/// </summary>
|
||||
public StringPattern? SchemaAsStringPattern { get; set; }
|
||||
|
||||
#if GRAPHQL
|
||||
/// <summary>
|
||||
/// The GraphQL schema as a <seealso cref="GraphQL.Types.ISchema"/>.
|
||||
/// </summary>
|
||||
public GraphQL.Types.ISchema? SchemaAsISchema { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The GraphQL Schema.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public AnyOf<string, StringPattern, GraphQL.Types.ISchema>? Schema
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SchemaAsString != null)
|
||||
{
|
||||
return SchemaAsString;
|
||||
}
|
||||
|
||||
if (SchemaAsStringPattern != null)
|
||||
{
|
||||
return SchemaAsStringPattern;
|
||||
}
|
||||
|
||||
if (SchemaAsISchema != null)
|
||||
{
|
||||
return new AnyOf<string, StringPattern, GraphQL.Types.ISchema>(SchemaAsISchema);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The custom Scalars to define for this schema.
|
||||
/// </summary>
|
||||
public IDictionary<string, Type>? CustomScalars { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user