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:
Stef Heyenrath
2025-05-24 12:17:42 +02:00
committed by GitHub
parent c15206ecd8
commit 96eca4262a
306 changed files with 9746 additions and 9285 deletions

View 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();
}

View 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; }
}

View 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();
}

View 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; }
}

View 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; }
}

View 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;
}

View 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; }
}

View File

@@ -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";
}

View 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; }
}

View 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; }
}

View 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"
}