mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-25 10:52:52 +01:00
Create WireMock.Net.MimePart project (#1300)
* Create WireMock.Net.MimePart project * . * REFACTOR * ILRepack * -- * ... * x * x * . * fix * public class MimePartMatcher * shared * min * . * <!--<DelaySign>true</DelaySign>--> * Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
15
src/WireMock.Net.Minimal/Pact/Models/V2/Interaction.cs
Normal file
15
src/WireMock.Net.Minimal/Pact/Models/V2/Interaction.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#pragma warning disable CS1591
|
||||
namespace WireMock.Pact.Models.V2;
|
||||
|
||||
public class Interaction
|
||||
{
|
||||
public string? Description { get; set; }
|
||||
|
||||
public string? ProviderState { get; set; }
|
||||
|
||||
public PactRequest Request { get; set; } = new();
|
||||
|
||||
public PactResponse Response { get; set; } = new();
|
||||
}
|
||||
27
src/WireMock.Net.Minimal/Pact/Models/V2/MatchingRule.cs
Normal file
27
src/WireMock.Net.Minimal/Pact/Models/V2/MatchingRule.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#pragma warning disable CS1591
|
||||
namespace WireMock.Pact.Models.V2;
|
||||
|
||||
public class MatchingRule
|
||||
{
|
||||
/// <summary>
|
||||
/// type or regex
|
||||
/// </summary>
|
||||
public string Match { get; set; } = "type";
|
||||
|
||||
/// <summary>
|
||||
/// Used for Match = "type"
|
||||
/// </summary>
|
||||
public string Min { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used for Match = "type"
|
||||
/// </summary>
|
||||
public string Max { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used for Match = "regex"
|
||||
/// </summary>
|
||||
public string Regex { get; set; }
|
||||
}
|
||||
11
src/WireMock.Net.Minimal/Pact/Models/V2/Metadata.cs
Normal file
11
src/WireMock.Net.Minimal/Pact/Models/V2/Metadata.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#pragma warning disable CS1591
|
||||
namespace WireMock.Pact.Models.V2;
|
||||
|
||||
public class Metadata
|
||||
{
|
||||
public string PactSpecificationVersion { get; set; }
|
||||
|
||||
public PactSpecification PactSpecification { get; set; } = new PactSpecification();
|
||||
}
|
||||
17
src/WireMock.Net.Minimal/Pact/Models/V2/Pact.cs
Normal file
17
src/WireMock.Net.Minimal/Pact/Models/V2/Pact.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#pragma warning disable CS1591
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WireMock.Pact.Models.V2;
|
||||
|
||||
public class Pact
|
||||
{
|
||||
public Pacticipant Consumer { get; set; }
|
||||
|
||||
public List<Interaction> Interactions { get; set; } = new List<Interaction>();
|
||||
|
||||
public Metadata Metadata { get; set; }
|
||||
|
||||
public Pacticipant Provider { get; set; }
|
||||
}
|
||||
20
src/WireMock.Net.Minimal/Pact/Models/V2/PactRequest.cs
Normal file
20
src/WireMock.Net.Minimal/Pact/Models/V2/PactRequest.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#pragma warning disable CS1591
|
||||
using System.Collections.Generic;
|
||||
using WireMock.Constants;
|
||||
|
||||
namespace WireMock.Pact.Models.V2;
|
||||
|
||||
public class PactRequest
|
||||
{
|
||||
public IDictionary<string, string>? Headers { get; set; }
|
||||
|
||||
public string Method { get; set; } = HttpRequestMethod.GET;
|
||||
|
||||
public string? Path { get; set; } = "/";
|
||||
|
||||
public string? Query { get; set; }
|
||||
|
||||
public object? Body { get; set; }
|
||||
}
|
||||
15
src/WireMock.Net.Minimal/Pact/Models/V2/PactResponse.cs
Normal file
15
src/WireMock.Net.Minimal/Pact/Models/V2/PactResponse.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#pragma warning disable CS1591
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WireMock.Pact.Models.V2;
|
||||
|
||||
public class PactResponse
|
||||
{
|
||||
public object? Body { get; set; }
|
||||
|
||||
public IDictionary<string, string>? Headers { get; set; }
|
||||
|
||||
public int Status { get; set; } = 200;
|
||||
}
|
||||
13
src/WireMock.Net.Minimal/Pact/Models/V2/PactRust.cs
Normal file
13
src/WireMock.Net.Minimal/Pact/Models/V2/PactRust.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#pragma warning disable CS1591
|
||||
namespace WireMock.Pact.Models.V2;
|
||||
|
||||
public class PactRust
|
||||
{
|
||||
public string Ffi { get; set; }
|
||||
|
||||
public string Mockserver { get; set; }
|
||||
|
||||
public string Models { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#pragma warning disable CS1591
|
||||
namespace WireMock.Pact.Models.V2;
|
||||
|
||||
public class PactSpecification
|
||||
{
|
||||
public string Version { get; set; } = "2.0";
|
||||
}
|
||||
9
src/WireMock.Net.Minimal/Pact/Models/V2/Pacticipant.cs
Normal file
9
src/WireMock.Net.Minimal/Pact/Models/V2/Pacticipant.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#pragma warning disable CS1591
|
||||
namespace WireMock.Pact.Models.V2;
|
||||
|
||||
public class Pacticipant
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
13
src/WireMock.Net.Minimal/Pact/Models/V2/ProviderState.cs
Normal file
13
src/WireMock.Net.Minimal/Pact/Models/V2/ProviderState.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
#pragma warning disable CS1591
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WireMock.Pact.Models.V2;
|
||||
|
||||
public class ProviderState
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public IDictionary<string, string> Params { get; set; }
|
||||
}
|
||||
206
src/WireMock.Net.Minimal/Pact/Models/V2/_v2.json
Normal file
206
src/WireMock.Net.Minimal/Pact/Models/V2/_v2.json
Normal file
@@ -0,0 +1,206 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema",
|
||||
"definitions": {
|
||||
"headers": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"interaction": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"providerState": {
|
||||
"type": "string"
|
||||
},
|
||||
"request": {
|
||||
"$ref": "#/definitions/request"
|
||||
},
|
||||
"response": {
|
||||
"$ref": "#/definitions/response"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"description",
|
||||
"request",
|
||||
"response"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"interactions": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/interaction"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"matchingRules": {
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^\\$.*$": {
|
||||
"oneOf": [
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"match": {
|
||||
"enum": [ "type" ],
|
||||
"type": "string"
|
||||
},
|
||||
"max": {
|
||||
"type": "number"
|
||||
},
|
||||
"min": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [ "match" ],
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"match": {
|
||||
"enum": [ "regex" ],
|
||||
"type": "string"
|
||||
},
|
||||
"regex": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"match",
|
||||
"regex"
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"metadata": {
|
||||
"properties": {
|
||||
"pactSpecification": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [ "version" ],
|
||||
"type": "object"
|
||||
},
|
||||
"pactSpecificationVersion": {
|
||||
"type": "string"
|
||||
},
|
||||
"pact-specification": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [ "version" ],
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"pacticipant": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [ "name" ],
|
||||
"type": "object"
|
||||
},
|
||||
"request": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"body": {},
|
||||
"headers": {
|
||||
"$ref": "#/definitions/headers"
|
||||
},
|
||||
"matchingRules": {
|
||||
"$ref": "#/definitions/matchingRules"
|
||||
},
|
||||
"method": {
|
||||
"enum": [
|
||||
"connect",
|
||||
"CONNECT",
|
||||
"delete",
|
||||
"DELETE",
|
||||
"get",
|
||||
"GET",
|
||||
"head",
|
||||
"HEAD",
|
||||
"options",
|
||||
"OPTIONS",
|
||||
"post",
|
||||
"POST",
|
||||
"put",
|
||||
"PUT",
|
||||
"trace",
|
||||
"TRACE"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"query": {
|
||||
"pattern": "^$|^[^=&]+=[^=&]+&?$|^[^=&]+=[^=&]+(&[^=&]+=[^=&]+)*&?$",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"method",
|
||||
"path"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"response": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"body": {},
|
||||
"headers": {
|
||||
"$ref": "#/definitions/headers"
|
||||
},
|
||||
"matchingRules": {
|
||||
"$ref": "#/definitions/matchingRules"
|
||||
},
|
||||
"status": {
|
||||
"maximum": 599,
|
||||
"minimum": 100,
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [ "status" ],
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"description": "Schema for a Pact file",
|
||||
"properties": {
|
||||
"consumer": {
|
||||
"$ref": "#/definitions/pacticipant"
|
||||
},
|
||||
"interactions": {
|
||||
"$ref": "#/definitions/interactions"
|
||||
},
|
||||
"metadata": {
|
||||
"$ref": "#/definitions/metadata"
|
||||
},
|
||||
"provider": {
|
||||
"$ref": "#/definitions/pacticipant"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"consumer",
|
||||
"interactions",
|
||||
"provider"
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
Reference in New Issue
Block a user