git.iko.soy/typeable/mock-server-client
on 1d150ac help sign in
18 files changed+325−515
since splitsnapshots
unifiedsplit
.github/workflows/haskell-ci.yml−25 .gitignore−2 README.md+33−77 codegen/mock-server-openapi.yaml+269−257 ghc-9.0.2.yaml−8 ghc-9.0.2.yaml.lock−12 ghc-9.2.5.yaml−8 ghc-9.2.5.yaml.lock−12 mock-server-client.cabal−3 src/MockServer.hs−2 src/MockServer/Common.hs+5−23 src/MockServer/Operations/Put_mockserver_retrieve.hs+2−2 src/MockServer/Types.hs−2 src/MockServer/Types/HttpRequest.hs+3−7 src/MockServer/Types/JsonSchemaBodyMatcher.hs+6−6 src/MockServer/Types/Protocol.hs−53 src/MockServer/Types/Protocol.hs-boot−9 src/MockServer/Types/StringOrJsonSchema.hs+7−7
.github/workflows/haskell-ci.ymldeleted−25
@@ -1,25 +0,0 @@
1−name: Haskell-CI
2−on: [push]
3−jobs:
4− linux:
5− name: GHC-${{ matrix.ghc-version }}
6− runs-on: ubuntu-latest
7− strategy:
8− matrix:
9− ghc-version:
10− - 9.0.2
11− - 9.2.5
12− steps:
13− - uses: actions/checkout@v3
14− - uses: haskell/actions/setup@v2
15− with:
16− enable-stack: true
17− ghc-version: ${{ matrix.ghc-version }}
18− stack-version: 'latest'
19− - uses: actions/cache@v3
20− with:
21− path: |
22− ~/.stack
23− ./.stack-work
24− key: ${{ matrix.ghc-version }}
25− - run: stack --stack-yaml ghc-${{ matrix.ghc-version }}.yaml --install-ghc test --fast --haddock
.gitignoredeleted−2
@@ -1,2 +0,0 @@
1−.stack-work
2−TAGS
README.md+33−77
@@ -1,96 +1,52 @@
1−# About
1+## About
22
33The package is the client library for the [mock server](https://www.mock-server.com/). The source code is
44generated by the [openapi3-code-generator](https://hackage.haskell.org/package/openapi3-code-generator), specifically its patched version.
55
6−## Usage
6+## How to regenerate
77
8−``` haskell
9−module Main
10−
11−import MockServer as Mock
12−import Network.HTTP.Client
13−
14−conf :: Mock.Configuration
15−conf = Configuration
16− { configBaseURL = "http://localhost"
17− , configSecurityScheme = id
18− , configIncludeUserAgent = False
19− , configApplicationName = "ping-app" }
20−
21−expectation :: Mock.Expectations
22−expectation = Mock.ExpectationsExpectation $ Mock.mkExpectation
23− { expectationHttpRequest = Just request
24− , expectationHttpResponse = Just response }
25− where
26− request = Mock.mkHttpRequest
27− { httpRequestMethod = Just $ StringOrJsonSchemaText "POST"
28− , httpRequestPath = Just $ StringOrJsonSchemaText "/ping" }
29− response = Mock.mkHttpResponse
30− { httpResponseBody = Just $ BodyWithContentTypeRawStringResponseBody "pong"
31− , httpResponseStatusCode = Just 200 }
32−
33−-- | Puts the expectation which will response with "pong" body to the "POST /ping" request
34−main :: IO ()
35−main = do
36− void $ Mock.runWithConfiguration conf $ Mock.put_mockserver_expectation expectation
378```
9+cd codegen && ./regen.sh
10+```
11+
12+It requires the `nix` to be installed in your system because it uses the
13+`openapi3-code-generator` built by the `nix`.
3814
39−# Maintainance
15+After regeneration you will see some `.hs` files changed. This is because some
16+parts of the libary are modified by hand to make the more usable.
4017
4118## Files
4219
4320### The `codegen` dir
4421
4522* `regen.sh` is the simple script to regenerate the whole package.
46−* `shell.nix` a shell in which the `regen.sh` calls the `openapi3-code-generator` to regenerate the code
47−* `mock-server-openapi.yaml` not the [original specification](https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi) of the `mock-server` as you might
48− think. The thing is that the `openapi3-code-generator` does not support all the features of the
49− OpenAPI3 standard correctly, so it is hand-postprocessed. It was originally downloaded from
50− [here](https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi/5.13.x) and fixed.
51−
52−### Other
23+* `shell.nix` a shell in which the `regen.sh` calls the `openapi3-code-generator` to regenerate the
24+* `mock-server-openapi-5.13.x-swagger.yaml` not the original file as you might
25+ think. The thing is that the `openapi3-code-generator` does not support all
26+ the features of the OpenAPI3 standard correctly, so it is
27+ hand-postprocessed. It was originally downloaded from [here](https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi/5.13.x) and fixed.
28+* `src` contails the generted code, but not exactly. Some of the parts of the
29+ generted code was not very pleasant, so it was fixed too.
5330
54−* `src` and `mock-server-client.cabal` contain the generted code, but not exactly. Some of the parts
55− of the generted code was not very pleasant, so it was fixed too.
56−
57−## What will happen if you just call the `regen.sh`?
31+### What will happen if you just call the `regen.sh`?
5832
5933It will build the `openapi3-code-generator` in `nix` and regenerate the whole
6034Haskell source code. You will see that the code was changed, because as
6135mentioned earlier the original code was slightly modified, so watch your commits.
6236
63−## How to update the package to the new version of the `mock-server` spec?
64−
65−* Commit or discard all changes
66−* `git checkout update-openapi-spec`
67−* Replace the `codegen/mock-server-openapi.yaml` with a newer version
68−* `git commit -m "updated mock-server-openapi.yaml to version $NEWVERSION"`
69−* `git checkout -b "update-$NEWVERSION" master`
70−* `git merge update-openapi-spec`
71−* Resolve conflicts if any
72−* `./codegen/regen.sh`
73−* `git symbolic-ref HEAD refs/heads/update-generated-code && git reset`
74− switching to the branch `update-generated-code` without checking out the working-tree
75−* `git commit -m "update the generted code for version $NEWVERSION"`
76−* `git checkout "update-$NEWVERSION"`
77−* `git merge update-generated-code`
78−* Resolve conflicts if any
79−* `git push origin "update-$NEWVERSION"`
80−* Create PR, wait for CI, review, merge into the master
81−
82−The algorithm is kind of weird, but for a reason.
83−
84−The branch `update-openapi-spec` is the branch tracking only original
85−`codegen/mock-server-openapi.yaml` changes, meaning changes made by authors of the
86−`mock-server`. So, when you merge changes of this branch into the master you literally merge the
87−changes made by authors of the `mock-server` with our manual changes made to please the
88−`openapi3-code-generator`.
89−
90−The bratch `update-generated-code` is for tracking "changes" made by the code generator when it is
91−feed by the new OpenAPI spec file. So, when you merge this branch into the master you literally
92−merge the "code regeneration patch" with changes made by hand.
93−
94−The `master` branch is for manual changes only. The changes made to keep things working and the
95−package usable. You can always see the manual changes just by `git diff update-generated-code
96−master` or `git diff update-openapi-spec master`
37+## How the to update the package to the new version of the `mock-server`?
38+
39+* Commit all changes in git
40+* Run the `regen.sh` and regenerate the whole package
41+* Run `git diff -p > src.patch` and save the manual changes made to the source code
42+* Download the [original spec](https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi/5.13.x) in place of our patched spec file
43+* Run the `git diff -- codegen/mock-server-openapi-5.13.x-swagger.yaml -p > spec.patch`
44+* Download the [new spec](https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi) and put it in place of the old one
45+* Try to `git apply spec.patch` to the newer version of the spec to apply manual
46+ changes to the new spec. If somethig goes wrong use AI to fix it for you, heh.
47+* Fix the `regen.sh` and rename the `mock-server-openapi-5.13.x-swagger.yaml` to
48+ the newer version.
49+* `git commit -m 'dangerous action'`
50+* Run the `regen.sh` so you will hopefuly have a new version of the client code
51+ generated.
52+* `git apply src.patch` to apply manual patches to the new version.
codegen/mock-server-openapi.yaml+269−257
@@ -4,7 +4,7 @@ servers:
44 - url: 'https://localhost:1080/'
55info:
66 title: MockServer API
7− version: 5.15.x
7+ version: 5.13.x
88 description: >-
99 MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby and a simple REST API (as shown below).
1010
@@ -18,7 +18,7 @@ info:
1818 name: Apache 2.0
1919tags:
2020 - name: expectation
21− description: Create or update expectations - updates if the id matches an existing expectations (only supported by MockServer)
21+ description: Create or update expectations - updates if the id matches an existing expecations (only supported by MockServer)
2222 - name: verify
2323 description: Verify requests (both MockServer & MockServer Proxy)
2424 - name: control
@@ -36,7 +36,7 @@ paths:
3636 content:
3737 application/json:
3838 schema:
39− title: list of upserted expectations
39+ description: "list of upserted expectations"
4040 type: array
4141 additionalProperties: false
4242 items:
@@ -63,7 +63,7 @@ paths:
6363 content:
6464 application/json:
6565 schema:
66− title: list of upserted expectations
66+ description: "list of upserted expectations"
6767 type: array
6868 additionalProperties: false
6969 items:
@@ -89,6 +89,15 @@ paths:
8989 description: expectations and recorded requests cleared
9090 '400':
9191 description: incorrect request format
92+ parameters:
93+ - in: query
94+ name: type
95+ schema:
96+ type: string
97+ enum: ["all", "log", "expectations"]
98+ default: "all"
99+ required: false
100+ description: specifies the type of information to clear, default if not specified is "all", supported values are "all", "log", "expectations"
92101 requestBody:
93102 content:
94103 application/json:
@@ -96,7 +105,7 @@ paths:
96105 oneOf:
97106 - $ref: "#/components/schemas/RequestDefinition"
98107 - $ref: "#/components/schemas/ExpectationId"
99− description: request used to match expectations and record requests to clear
108+ description: request used to match expectations and recored requests to clear
100109 /mockserver/reset:
101110 put:
102111 tags:
@@ -116,12 +125,14 @@ paths:
116125 schema:
117126 type: string
118127 enum: [ "java", "json", "log_entries" ]
119− description: changes response format, default if not specified is "json", supported values are "java", "json", "log_entries"
128+ required: false
129+ description: changes response format, default if not specificed is "json", supported values are "java", "json", "log_entries"
120130 - in: query
121131 name: type
122132 schema:
123133 type: string
124134 enum: [ "logs", "requests", "request_responses", "recorded_expectations", "active_expectations" ]
135+ required: false
125136 description: specifies the type of object that is retrieve, default if not specified is "requests", supported values are "logs", "requests", "recorded_expectations", "active_expectations"
126137 responses:
127138 '200':
@@ -137,7 +148,11 @@ paths:
137148 - type: array
138149 additionalProperties: false
139150 items:
140− $ref: "#/components/schemas/HttpResponse"
151+ $ref: "#/components/schemas/HttpRequest"
152+ - type: array
153+ additionalProperties: false
154+ items:
155+ $ref: "#/components/schemas/HttpRequestAndHttpResponse"
141156 application/java:
142157 schema:
143158 type: string
@@ -257,7 +272,7 @@ paths:
257272components:
258273 schemas:
259274 Expectations:
260− title: "list of expectations"
275+ description: "list of expectations"
261276 oneOf:
262277 - $ref: "#/components/schemas/Expectation"
263278 - type: array
@@ -265,7 +280,7 @@ components:
265280 items:
266281 $ref: "#/components/schemas/Expectation"
267282 Expectation:
268− title: "expectation"
283+ description: "expectation"
269284 type: object
270285 additionalProperties: false
271286 properties:
@@ -275,8 +290,6 @@ components:
275290 type: integer
276291 httpRequest:
277292 $ref: "#/components/schemas/RequestDefinition"
278− openAPIDefinition:
279− $ref: "#/components/schemas/OpenAPIDefinition"
280293 httpResponse:
281294 $ref: "#/components/schemas/HttpResponse"
282295 httpResponseTemplate:
@@ -301,8 +314,29 @@ components:
301314 $ref: "#/components/schemas/Times"
302315 timeToLive:
303316 $ref: "#/components/schemas/TimeToLive"
317+ oneOf:
318+ - required:
319+ - httpResponse
320+ - required:
321+ - httpResponseTemplate
322+ - required:
323+ - httpResponseClassCallback
324+ - required:
325+ - httpResponseObjectCallback
326+ - required:
327+ - httpForward
328+ - required:
329+ - httpForwardTemplate
330+ - required:
331+ - httpForwardClassCallback
332+ - required:
333+ - httpForwardObjectCallback
334+ - required:
335+ - httpOverrideForwardedRequest
336+ - required:
337+ - httpError
304338 ExpectationId:
305− title: "pointer to existing expectation"
339+ description: "pointer to existing expectation"
306340 type: object
307341 additionalProperties: false
308342 properties:
@@ -311,7 +345,7 @@ components:
311345 required:
312346 - id
313347 OpenAPIExpectations:
314− title: "list of open api expectations"
348+ description: "list of open api expectations"
315349 oneOf:
316350 - $ref: "#/components/schemas/OpenAPIExpectation"
317351 - type: array
@@ -319,7 +353,7 @@ components:
319353 items:
320354 $ref: "#/components/schemas/OpenAPIExpectation"
321355 OpenAPIExpectation:
322− title: "open api or swagger expectation"
356+ description: "open api or swagger expectation"
323357 type: object
324358 additionalProperties: false
325359 properties:
@@ -334,12 +368,12 @@ components:
334368 required:
335369 - specUrlOrPayload
336370 RequestDefinition:
337− title: "request definition"
371+ description: "request definition"
338372 oneOf:
339373 - $ref: "#/components/schemas/HttpRequest"
340374 - $ref: "#/components/schemas/OpenAPIDefinition"
341375 HttpRequest:
342− title: "request properties matcher"
376+ description: "request properties matcher"
343377 type: object
344378 additionalProperties: false
345379 properties:
@@ -363,10 +397,8 @@ components:
363397 $ref: "#/components/schemas/KeyToValue"
364398 socketAddress:
365399 $ref: "#/components/schemas/SocketAddress"
366− protocol:
367− $ref: "#/components/schemas/Protocol"
368400 OpenAPIDefinition:
369− title: "open api or swagger request matcher"
401+ description: "open api or swagger request matcher"
370402 type: object
371403 additionalProperties: false
372404 properties:
@@ -375,7 +407,7 @@ components:
375407 operationId:
376408 type: string
377409 HttpResponse:
378− title: "response to return"
410+ description: "response to return"
379411 type: object
380412 additionalProperties: false
381413 properties:
@@ -394,7 +426,7 @@ components:
394426 reasonPhrase:
395427 type: string
396428 HttpTemplate:
397− title: "template to generate response / request"
429+ description: "template to generate response / request"
398430 type: object
399431 additionalProperties: false
400432 properties:
@@ -408,7 +440,7 @@ components:
408440 template:
409441 type: string
410442 HttpForward:
411− title: host and port to forward to
443+ description: "host and port to forward to"
412444 type: object
413445 additionalProperties: false
414446 properties:
@@ -423,7 +455,7 @@ components:
423455 - HTTP
424456 - HTTPS
425457 HttpClassCallback:
426− title: class callback
458+ description: "class callback"
427459 type: object
428460 additionalProperties: false
429461 properties:
@@ -432,7 +464,7 @@ components:
432464 callbackClass:
433465 type: string
434466 HttpObjectCallback:
435− title: object / method callback
467+ description: "object / method callback"
436468 type: object
437469 additionalProperties: false
438470 properties:
@@ -443,7 +475,7 @@ components:
443475 responseCallback:
444476 type: boolean
445477 HttpOverrideForwardedRequest:
446− title: override forwarded request
478+ description: "override forwarded request"
447479 oneOf:
448480 - type: object
449481 additionalProperties: false
@@ -545,7 +577,7 @@ components:
545577 httpResponse:
546578 "$ref": "#/components/schemas/HttpResponse"
547579 HttpError:
548− title: error behaviour
580+ description: "error behaviour"
549581 type: object
550582 additionalProperties: false
551583 properties:
@@ -556,7 +588,7 @@ components:
556588 responseBytes:
557589 type: string
558590 Times:
559− title: "number of responses"
591+ description: "number of responses"
560592 type: object
561593 additionalProperties: false
562594 properties:
@@ -565,7 +597,7 @@ components:
565597 unlimited:
566598 type: boolean
567599 TimeToLive:
568− title: "time expectation is valid for"
600+ description: "time expectation is valid for"
569601 type: object
570602 additionalProperties: false
571603 properties:
@@ -655,7 +687,7 @@ components:
655687 # "^\\S+$":
656688 # $ref: "#/components/schemas/StringOrJsonSchema"
657689 StringOrJsonSchema:
658− title: string value that can be support nottable, optional or a json schema
690+ description: "string value that can be support nottable, optional or a json schema"
659691 oneOf:
660692 - type: string
661693 - type: object
@@ -686,7 +718,7 @@ components:
686718 - PIPE_DELIMITED
687719 - DEEP_OBJECT
688720 SocketAddress:
689− title: remote address to send request to
721+ description: "remote address to send request to, only used for request overrides"
690722 type: object
691723 additionalProperties: false
692724 properties:
@@ -698,239 +730,198 @@ components:
698730 enum:
699731 - HTTP
700732 - HTTPS
701− BinaryBodyMatcher:
702− type: object
703− description: "binary body matcher"
704− additionalProperties: false
705− properties:
706− not:
707− type: boolean
708− type:
709− enum:
710− - BINARY
711− base64Bytes:
712− type: string
713− contentType:
714− type: string
715− JsonBodyMatcher:
716− type: object
717− description: "json body matcher"
718− additionalProperties: false
719− properties:
720− not:
721− type: boolean
722− type:
723− enum:
724− - JSON
725− json:
726− type: string
727− contentType:
728− type: string
729− matchType:
730− enum:
731− - STRICT
732− - ONLY_MATCHING_FIELDS
733− RawJsonBodyMatcher:
734− type: object
735− description: "json matching fields body matcher"
736− additionalProperties: true
737− JsonSchemaBodyMatcher:
738− type: object
739− description: "json schema body matcher"
740− additionalProperties: false
741− properties:
742− not:
743− type: boolean
744− type:
745− enum:
746− - JSON_SCHEMA
747− jsonSchema:
748− $ref: http://json-schema.org/draft-04/schema
749− JsonPathBodyMatcher:
750− type: object
751− description: "JSON path body matcher"
752− additionalProperties: false
753− properties:
754− not:
755− type: boolean
756− type:
757− enum:
758− - JSON_PATH
759− jsonPath:
760− type: string
761− ParameterBodyMatcher:
762− type: object
763− description: "parameter body matcher"
764− additionalProperties: false
765− properties:
766− not:
767− type: boolean
768− type:
769− enum:
770− - PARAMETERS
771− parameters:
772− $ref: "#/components/schemas/KeyToMultiValue"
773− RegexBodyMatcher:
774− type: object
775− description: "regex body matcher"
776− additionalProperties: false
777− properties:
778− not:
779− type: boolean
780− type:
781− enum:
782− - REGEX
783− regex:
784− type: string
785− StringBodyMatcher:
786− type: object
787− description: "string body matcher"
788− additionalProperties: false
789− properties:
790− not:
791− type: boolean
792− type:
793− enum:
794− - STRING
795− string:
796− type: string
797− contentType:
798− type: string
799− subString:
800− type: boolean
801− RawStringBodyMatcher:
802− type: string
803− description: "substring body matcher"
804− XmlBodyMatcher:
805− type: object
806− description: "xml body matcher"
807− additionalProperties: false
808− properties:
809− not:
810− type: boolean
811− type:
812− enum:
813− - XML
814− xml:
815− type: string
816− contentType:
817− type: string
818− XmlSchemaBodyMatcher:
819− type: object
820− description: "xml schema body matcher"
821− additionalProperties: false
822− properties:
823− not:
824− type: boolean
825− type:
826− enum:
827− - XML_SCHEMA
828− xmlSchema:
829− type: string
830− XpathBodyMatcher:
831− type: object
832− description: "xpath body matcher"
833− additionalProperties: false
834− properties:
835− not:
836− type: boolean
837− type:
838− enum:
839− - XPATH
840− xpath:
841− type: string
842− Protocol:
843− description: "protocol matcher"
844− enum:
845− - HTTP_1_1
846− - HTTP_2
847733 Body:
848734 description: "request body matcher"
849735 anyOf:
850− - $ref: "#/components/schemas/BinaryBodyMatcher"
851− - $ref: "#/components/schemas/JsonBodyMatcher"
852− - $ref: "#/components/schemas/RawJsonBodyMatcher"
853− - $ref: "#/components/schemas/JsonSchemaBodyMatcher"
854− - $ref: "#/components/schemas/JsonPathBodyMatcher"
855− - $ref: "#/components/schemas/ParameterBodyMatcher"
856− - $ref: "#/components/schemas/RegexBodyMatcher"
857− - $ref: "#/components/schemas/StringBodyMatcher"
858− - $ref: "#/components/schemas/RawStringBodyMatcher"
859− - $ref: "#/components/schemas/XmlBodyMatcher"
860− - $ref: "#/components/schemas/XmlSchemaBodyMatcher"
861− - $ref: "#/components/schemas/XpathBodyMatcher"
862− BinaryBodyResponse:
863− type: object
864− description: "binary response body"
865− additionalProperties: false
866− properties:
867− not:
868− type: boolean
869− type:
870− enum:
871− - BINARY
872− base64Bytes:
873− type: string
874− contentType:
875− type: string
876− JsonResponseBody:
877− type: object
878− description: "json response body"
879− additionalProperties: false
880− properties:
881− not:
882− type: boolean
883− type:
884− enum:
885− - JSON
886− json:
887− type: string
888− contentType:
889− type: string
890− RawJsonResponseBody:
891− type: object
892− description: "json response body"
893− additionalProperties: true
894− StringResponseBody:
895− type: object
896− description: "string response body"
897− additionalProperties: false
898− properties:
899− not:
900− type: boolean
901− type:
902− enum:
903− - STRING
904− string:
905− type: string
906− contentType:
907− type: string
908− RawStringResponseBody:
909− type: string
910− description: "string response body"
911− XmlResponseBody:
912− type: object
913− description: "xml response body"
914− additionalProperties: false
915− properties:
916− not:
917− type: boolean
918− type:
919− enum:
920− - XML
921− xml:
922− type: string
923− contentType:
924− type: string
736+ - type: object
737+ description: "binary body matcher"
738+ additionalProperties: false
739+ properties:
740+ not:
741+ type: boolean
742+ type:
743+ enum:
744+ - BINARY
745+ base64Bytes:
746+ type: string
747+ contentType:
748+ type: string
749+ - type: object
750+ description: "json body matcher"
751+ additionalProperties: false
752+ properties:
753+ not:
754+ type: boolean
755+ type:
756+ enum:
757+ - JSON
758+ json:
759+ type: string
760+ contentType:
761+ type: string
762+ matchType:
763+ enum:
764+ - STRICT
765+ - ONLY_MATCHING_FIELDS
766+ - type: object
767+ description: "json matching fields body matcher"
768+ additionalProperties: true
769+ - type: object
770+ description: "json schema body matcher"
771+ additionalProperties: false
772+ properties:
773+ not:
774+ type: boolean
775+ type:
776+ enum:
777+ - JSON_SCHEMA
778+ jsonSchema:
779+ $ref: http://json-schema.org/draft-04/schema
780+ - type: object
781+ description: "JSON path body matcher"
782+ additionalProperties: false
783+ properties:
784+ not:
785+ type: boolean
786+ type:
787+ enum:
788+ - JSON_PATH
789+ jsonPath:
790+ type: string
791+ - type: object
792+ description: "parameter body matcher"
793+ additionalProperties: false
794+ properties:
795+ not:
796+ type: boolean
797+ type:
798+ enum:
799+ - PARAMETERS
800+ parameters:
801+ $ref: "#/components/schemas/KeyToMultiValue"
802+ - type: object
803+ description: "regex body matcher"
804+ additionalProperties: false
805+ properties:
806+ not:
807+ type: boolean
808+ type:
809+ enum:
810+ - REGEX
811+ regex:
812+ type: string
813+ - type: object
814+ description: "string body matcher"
815+ additionalProperties: false
816+ properties:
817+ not:
818+ type: boolean
819+ type:
820+ enum:
821+ - STRING
822+ string:
823+ type: string
824+ contentType:
825+ type: string
826+ subString:
827+ type: boolean
828+ - type: string
829+ description: "substring body matcher"
830+ - type: object
831+ description: "xml body matcher"
832+ additionalProperties: false
833+ properties:
834+ not:
835+ type: boolean
836+ type:
837+ enum:
838+ - XML
839+ xml:
840+ type: string
841+ contentType:
842+ type: string
843+ - type: object
844+ description: "xml schema body matcher"
845+ additionalProperties: false
846+ properties:
847+ not:
848+ type: boolean
849+ type:
850+ enum:
851+ - XML_SCHEMA
852+ xmlSchema:
853+ type: string
854+ - type: object
855+ description: "xpath body matcher"
856+ additionalProperties: false
857+ properties:
858+ not:
859+ type: boolean
860+ type:
861+ enum:
862+ - XPATH
863+ xpath:
864+ type: string
925865 BodyWithContentType:
926866 description: "response body"
927867 anyOf:
928− - $ref: "#/components/schemas/BinaryBodyResponse"
929− - $ref: "#/components/schemas/JsonResponseBody"
930− - $ref: "#/components/schemas/RawJsonResponseBody"
931− - $ref: "#/components/schemas/StringResponseBody"
932− - $ref: "#/components/schemas/RawStringResponseBody"
933− - $ref: "#/components/schemas/XmlResponseBody"
868+ - type: object
869+ description: "binary response body"
870+ additionalProperties: false
871+ properties:
872+ not:
873+ type: boolean
874+ type:
875+ enum:
876+ - BINARY
877+ base64Bytes:
878+ type: string
879+ contentType:
880+ type: string
881+ - type: object
882+ description: "json response body"
883+ additionalProperties: false
884+ properties:
885+ not:
886+ type: boolean
887+ type:
888+ enum:
889+ - JSON
890+ json:
891+ type: string
892+ contentType:
893+ type: string
894+ - type: object
895+ description: "json response body"
896+ additionalProperties: true
897+ - type: object
898+ description: "string response body"
899+ additionalProperties: false
900+ properties:
901+ not:
902+ type: boolean
903+ type:
904+ enum:
905+ - STRING
906+ string:
907+ type: string
908+ contentType:
909+ type: string
910+ - type: string
911+ description: "string response body"
912+ - type: object
913+ description: "xml response body"
914+ additionalProperties: false
915+ properties:
916+ not:
917+ type: boolean
918+ type:
919+ enum:
920+ - XML
921+ xml:
922+ type: string
923+ contentType:
924+ type: string
934925 Delay:
935926 description: "response delay"
936927 type: object
@@ -972,6 +963,11 @@ components:
972963 $ref: "#/components/schemas/VerificationTimes"
973964 maximumNumberOfRequestToReturnInVerificationFailure:
974965 type: integer
966+ oneOf:
967+ - required:
968+ - expectationId
969+ - required:
970+ - httpRequest
975971 VerificationTimes:
976972 description: "number of request to verify"
977973 type: object
@@ -997,6 +993,11 @@ components:
997993 $ref: "#/components/schemas/RequestDefinition"
998994 maximumNumberOfRequestToReturnInVerificationFailure:
999995 type: integer
996+ oneOf:
997+ - required:
998+ - expectationIds
999+ - required:
1000+ - httpRequests
10001001 Ports:
10011002 description: "list of ports"
10021003 type: object
@@ -1006,3 +1007,14 @@ components:
10061007 items:
10071008 type: number
10081009 type: array
1010+ HttpRequestAndHttpResponse:
1011+ description: "request and response"
1012+ type: object
1013+ additionalProperties: false
1014+ properties:
1015+ httpRequest:
1016+ $ref: "#/components/schemas/HttpRequest"
1017+ httpResponse:
1018+ $ref: "#/components/schemas/HttpResponse"
1019+ timestamp:
1020+ type: string
ghc-9.0.2.yamldeleted−8
@@ -1,8 +0,0 @@
1−resolver: lts-19.33
2−
3−nix:
4− packages:
5− - zlib
6−
7−packages:
8− - .
ghc-9.0.2.yaml.lockdeleted−12
@@ -1,12 +0,0 @@
1−# This file was autogenerated by Stack.
2−# You should not edit this file by hand.
3−# For more information, please see the documentation at:
4−# https://docs.haskellstack.org/en/stable/lock_files
5−
6−packages: []
7−snapshots:
8−- completed:
9− sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4
10− size: 619204
11− url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml
12− original: lts-19.33
ghc-9.2.5.yamldeleted−8
@@ -1,8 +0,0 @@
1−resolver: lts-20.8
2−
3−nix:
4− packages:
5− - zlib
6−
7−packages:
8− - .
ghc-9.2.5.yaml.lockdeleted−12
@@ -1,12 +0,0 @@
1−# This file was autogenerated by Stack.
2−# You should not edit this file by hand.
3−# For more information, please see the documentation at:
4−# https://docs.haskellstack.org/en/stable/lock_files
5−
6−packages: []
7−snapshots:
8−- completed:
9− sha256: bfafe5735ccb74527d754b1f9999ded72d7c3a6c3a88529449661431ccfbd6cc
10− size: 649327
11− url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/8.yaml
12− original: lts-20.8
mock-server-client.cabal−3
@@ -47,7 +47,6 @@ library
4747 MockServer.Types.OpenAPIExpectations
4848 MockServer.Types.ParameterBodyMatcher
4949 MockServer.Types.Ports
50− MockServer.Types.Protocol
5150 MockServer.Types.RegexBodyMatcher
5251 MockServer.Types.RequestDefinition
5352 MockServer.Types.SocketAddress
@@ -77,7 +76,6 @@ library
7776 , http-types
7877 , bytestring
7978 , aeson
80− , openapi3
8179 , unordered-containers
8280 , vector
8381 , scientific
@@ -85,4 +83,3 @@ library
8583 , mtl
8684 , transformers
8785 default-language: Haskell2010
88− default-extensions: DeriveGeneric
src/MockServer.hs−2
@@ -42,7 +42,6 @@ module MockServer (
4242 module MockServer.Types.OpenAPIExpectations,
4343 module MockServer.Types.ParameterBodyMatcher,
4444 module MockServer.Types.Ports,
45− module MockServer.Types.Protocol,
4645 module MockServer.Types.RegexBodyMatcher,
4746 module MockServer.Types.RequestDefinition,
4847 module MockServer.Types.SocketAddress,
@@ -103,7 +102,6 @@ import MockServer.Types.OpenAPIExpectation
103102import MockServer.Types.OpenAPIExpectations
104103import MockServer.Types.ParameterBodyMatcher
105104import MockServer.Types.Ports
106−import MockServer.Types.Protocol
107105import MockServer.Types.RegexBodyMatcher
108106import MockServer.Types.RequestDefinition
109107import MockServer.Types.SocketAddress
src/MockServer/Common.hs+5−23
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE FlexibleInstances #-}
32{-# LANGUAGE GeneralizedNewtypeDeriving #-}
43{-# LANGUAGE LambdaCase #-}
@@ -34,18 +33,12 @@ where
3433import qualified Control.Monad.IO.Class as MIO
3534import qualified Control.Monad.Reader as MR
3635import qualified Control.Monad.Trans.Class as MT
37−#if MIN_VERSION_aeson(2,0,0)
38−import qualified Data.Aeson.KeyMap as KeyMap
39−import qualified Data.Aeson.Key as Key
40−import Data.Bifunctor
41−#else
42−import qualified Data.HashMap.Strict as HashMap
43−#endif
4436import qualified Data.Aeson as Aeson
4537import qualified Data.Aeson.Encoding as Encoding
4638import qualified Data.Bifunctor as BF
4739import qualified Data.ByteString.Char8 as B8
4840import qualified Data.ByteString.Lazy.Char8 as LB8
41+import qualified Data.HashMap.Strict as HMap
4942import qualified Data.Maybe as Maybe
5043import qualified Data.Scientific as Scientific
5144import Data.Text (Text)
@@ -57,15 +50,6 @@ import qualified Network.HTTP.Client as HC
5750import qualified Network.HTTP.Simple as HS
5851import qualified Network.HTTP.Types as HT
5952
60−
61−#if MIN_VERSION_aeson(2,0,0)
62−toList' :: Aeson.Object -> [(Text, Aeson.Value)]
63−toList' = fmap (first Key.toText) . KeyMap.toList
64−#else
65−toList' :: Aeson.Object -> [(Text, Aeson.Value)]
66−toList' = HashMap.toList
67−#endif
68−
6953-- | Abstracts the usage of 'Network.HTTP.Simple.httpBS' away,
7054-- so that it can be used for testing
7155class Monad m => MonadHTTP m where
@@ -301,10 +285,8 @@ jsonToFormDataFlat _ Aeson.Null = []
301285jsonToFormDataFlat name (Aeson.Number a) = [(name, encodeStrict a)]
302286jsonToFormDataFlat name (Aeson.String a) = [(name, textToByte a)]
303287jsonToFormDataFlat name (Aeson.Bool a) = [(name, encodeStrict a)]
304−jsonToFormDataFlat _ (Aeson.Object object) =
305− toList' object >>= uncurry jsonToFormDataFlat . BF.first Just
306−jsonToFormDataFlat name (Aeson.Array vector) =
307− Vector.toList vector >>= jsonToFormDataFlat name
288+jsonToFormDataFlat _ (Aeson.Object object) = HMap.toList object >>= uncurry jsonToFormDataFlat . BF.first Just
289+jsonToFormDataFlat name (Aeson.Array vector) = Vector.toList vector >>= jsonToFormDataFlat name
308290
309291-- | creates form data bytestring array
310292createFormData :: (Aeson.ToJSON a) => a -> [(B8.ByteString, B8.ByteString)]
@@ -338,9 +320,9 @@ jsonToFormDataPrefixed prefix (Aeson.Bool False) = [(prefix, "false")]
338320jsonToFormDataPrefixed _ Aeson.Null = []
339321jsonToFormDataPrefixed prefix (Aeson.String a) = [(prefix, a)]
340322jsonToFormDataPrefixed "" (Aeson.Object object) =
341− toList' object >>= uncurry jsonToFormDataPrefixed
323+ HMap.toList object >>= uncurry jsonToFormDataPrefixed
342324jsonToFormDataPrefixed prefix (Aeson.Object object) =
343− toList' object >>= (\(x, y) -> jsonToFormDataPrefixed (prefix <> "[" <> x <> "]") y)
325+ HMap.toList object >>= (\(x, y) -> jsonToFormDataPrefixed (prefix <> "[" <> x <> "]") y)
344326jsonToFormDataPrefixed prefix (Aeson.Array vector) =
345327 Vector.toList vector >>= jsonToFormDataPrefixed (prefix <> "[]")
346328
src/MockServer/Operations/Put_mockserver_retrieve.hs+2−2
@@ -62,7 +62,7 @@ put_mockserver_retrieve parameters
6262data Put_mockserver_retrieveParameters = Put_mockserver_retrieveParameters {
6363 -- | queryFormat: Represents the parameter named \'format\'
6464 --
65− -- changes response format, default if not specified is \"json\", supported values are \"java\", \"json\", \"log_entries\"
65+ -- changes response format, default if not specificed is \"json\", supported values are \"java\", \"json\", \"log_entries\"
6666 put_mockserver_retrieveParametersQueryFormat :: (GHC.Maybe.Maybe Put_mockserver_retrieveParametersQueryFormat)
6767 -- | queryType: Represents the parameter named \'type\'
6868 --
@@ -83,7 +83,7 @@ mkPut_mockserver_retrieveParameters = Put_mockserver_retrieveParameters{put_mock
8383--
8484-- Represents the parameter named \'format\'
8585--
86−-- changes response format, default if not specified is \"json\", supported values are \"java\", \"json\", \"log_entries\"
86+-- changes response format, default if not specificed is \"json\", supported values are \"java\", \"json\", \"log_entries\"
8787data Put_mockserver_retrieveParametersQueryFormat =
8888 Put_mockserver_retrieveParametersQueryFormatOther Data.Aeson.Types.Internal.Value -- ^ This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
8989 | Put_mockserver_retrieveParametersQueryFormatTyped Data.Text.Internal.Text -- ^ This constructor can be used to send values to the server which are not present in the specification yet.
src/MockServer/Types.hs−2
@@ -31,7 +31,6 @@ module MockServer.Types (
3131 module MockServer.Types.OpenAPIExpectations,
3232 module MockServer.Types.ParameterBodyMatcher,
3333 module MockServer.Types.Ports,
34− module MockServer.Types.Protocol,
3534 module MockServer.Types.RegexBodyMatcher,
3635 module MockServer.Types.RequestDefinition,
3736 module MockServer.Types.SocketAddress,
@@ -78,7 +77,6 @@ import MockServer.Types.OpenAPIExpectation
7877import MockServer.Types.OpenAPIExpectations
7978import MockServer.Types.ParameterBodyMatcher
8079import MockServer.Types.Ports
81−import MockServer.Types.Protocol
8280import MockServer.Types.RegexBodyMatcher
8381import MockServer.Types.RequestDefinition
8482import MockServer.Types.SocketAddress
src/MockServer/Types/HttpRequest.hs+3−7
@@ -35,7 +35,6 @@ import MockServer.TypeAlias
3535import {-# SOURCE #-} MockServer.Types.Body
3636import {-# SOURCE #-} MockServer.Types.KeyToMultiValue
3737import {-# SOURCE #-} MockServer.Types.KeyToValue
38−import {-# SOURCE #-} MockServer.Types.Protocol
3938import {-# SOURCE #-} MockServer.Types.SocketAddress
4039import {-# SOURCE #-} MockServer.Types.StringOrJsonSchema
4140
@@ -57,8 +56,6 @@ data HttpRequest = HttpRequest {
5756 , httpRequestPath :: (GHC.Maybe.Maybe StringOrJsonSchema)
5857 -- | pathParameters
5958 , httpRequestPathParameters :: (GHC.Maybe.Maybe KeyToMultiValue)
60− -- | protocol: protocol matcher
61− , httpRequestProtocol :: (GHC.Maybe.Maybe Protocol)
6259 -- | queryStringParameters
6360 , httpRequestQueryStringParameters :: (GHC.Maybe.Maybe KeyToMultiValue)
6461 -- | secure
@@ -68,10 +65,10 @@ data HttpRequest = HttpRequest {
6865 } deriving (GHC.Show.Show
6966 , GHC.Classes.Eq)
7067instance Data.Aeson.Types.ToJSON.ToJSON HttpRequest
71− where toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("body" Data.Aeson.Types.ToJSON..=)) (httpRequestBody obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("cookies" Data.Aeson.Types.ToJSON..=)) (httpRequestCookies obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("headers" Data.Aeson.Types.ToJSON..=)) (httpRequestHeaders obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("keepAlive" Data.Aeson.Types.ToJSON..=)) (httpRequestKeepAlive obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("method" Data.Aeson.Types.ToJSON..=)) (httpRequestMethod obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("path" Data.Aeson.Types.ToJSON..=)) (httpRequestPath obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("pathParameters" Data.Aeson.Types.ToJSON..=)) (httpRequestPathParameters obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("protocol" Data.Aeson.Types.ToJSON..=)) (httpRequestProtocol obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryStringParameters" Data.Aeson.Types.ToJSON..=)) (httpRequestQueryStringParameters obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("secure" Data.Aeson.Types.ToJSON..=)) (httpRequestSecure obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("socketAddress" Data.Aeson.Types.ToJSON..=)) (httpRequestSocketAddress obj) : GHC.Base.mempty))
72− toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("body" Data.Aeson.Types.ToJSON..=)) (httpRequestBody obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("cookies" Data.Aeson.Types.ToJSON..=)) (httpRequestCookies obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("headers" Data.Aeson.Types.ToJSON..=)) (httpRequestHeaders obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("keepAlive" Data.Aeson.Types.ToJSON..=)) (httpRequestKeepAlive obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("method" Data.Aeson.Types.ToJSON..=)) (httpRequestMethod obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("path" Data.Aeson.Types.ToJSON..=)) (httpRequestPath obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("pathParameters" Data.Aeson.Types.ToJSON..=)) (httpRequestPathParameters obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("protocol" Data.Aeson.Types.ToJSON..=)) (httpRequestProtocol obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryStringParameters" Data.Aeson.Types.ToJSON..=)) (httpRequestQueryStringParameters obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("secure" Data.Aeson.Types.ToJSON..=)) (httpRequestSecure obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("socketAddress" Data.Aeson.Types.ToJSON..=)) (httpRequestSocketAddress obj) : GHC.Base.mempty)))
68+ where toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("body" Data.Aeson.Types.ToJSON..=)) (httpRequestBody obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("cookies" Data.Aeson.Types.ToJSON..=)) (httpRequestCookies obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("headers" Data.Aeson.Types.ToJSON..=)) (httpRequestHeaders obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("keepAlive" Data.Aeson.Types.ToJSON..=)) (httpRequestKeepAlive obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("method" Data.Aeson.Types.ToJSON..=)) (httpRequestMethod obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("path" Data.Aeson.Types.ToJSON..=)) (httpRequestPath obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("pathParameters" Data.Aeson.Types.ToJSON..=)) (httpRequestPathParameters obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryStringParameters" Data.Aeson.Types.ToJSON..=)) (httpRequestQueryStringParameters obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("secure" Data.Aeson.Types.ToJSON..=)) (httpRequestSecure obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("socketAddress" Data.Aeson.Types.ToJSON..=)) (httpRequestSocketAddress obj) : GHC.Base.mempty))
69+ toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("body" Data.Aeson.Types.ToJSON..=)) (httpRequestBody obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("cookies" Data.Aeson.Types.ToJSON..=)) (httpRequestCookies obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("headers" Data.Aeson.Types.ToJSON..=)) (httpRequestHeaders obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("keepAlive" Data.Aeson.Types.ToJSON..=)) (httpRequestKeepAlive obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("method" Data.Aeson.Types.ToJSON..=)) (httpRequestMethod obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("path" Data.Aeson.Types.ToJSON..=)) (httpRequestPath obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("pathParameters" Data.Aeson.Types.ToJSON..=)) (httpRequestPathParameters obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("queryStringParameters" Data.Aeson.Types.ToJSON..=)) (httpRequestQueryStringParameters obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("secure" Data.Aeson.Types.ToJSON..=)) (httpRequestSecure obj) : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("socketAddress" Data.Aeson.Types.ToJSON..=)) (httpRequestSocketAddress obj) : GHC.Base.mempty)))
7370instance Data.Aeson.Types.FromJSON.FromJSON HttpRequest
74− where parseJSON = Data.Aeson.Types.FromJSON.withObject "HttpRequest" (\obj -> ((((((((((GHC.Base.pure HttpRequest GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "body")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "cookies")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "headers")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "keepAlive")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "method")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "path")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "pathParameters")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "protocol")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "queryStringParameters")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "secure")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "socketAddress"))
71+ where parseJSON = Data.Aeson.Types.FromJSON.withObject "HttpRequest" (\obj -> (((((((((GHC.Base.pure HttpRequest GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "body")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "cookies")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "headers")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "keepAlive")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "method")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "path")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "pathParameters")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "queryStringParameters")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "secure")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "socketAddress"))
7572-- | Create a new 'HttpRequest' with all required fields.
7673mkHttpRequest :: HttpRequest
7774mkHttpRequest = HttpRequest{httpRequestBody = GHC.Maybe.Nothing,
@@ -81,7 +78,6 @@ mkHttpRequest = HttpRequest{httpRequestBody = GHC.Maybe.Nothing,
8178 httpRequestMethod = GHC.Maybe.Nothing,
8279 httpRequestPath = GHC.Maybe.Nothing,
8380 httpRequestPathParameters = GHC.Maybe.Nothing,
84− httpRequestProtocol = GHC.Maybe.Nothing,
8581 httpRequestQueryStringParameters = GHC.Maybe.Nothing,
8682 httpRequestSecure = GHC.Maybe.Nothing,
8783 httpRequestSocketAddress = GHC.Maybe.Nothing}
src/MockServer/Types/JsonSchemaBodyMatcher.hs+6−6
@@ -6,19 +6,20 @@
66-- | Contains the types generated from the schema JsonSchemaBodyMatcher
77module MockServer.Types.JsonSchemaBodyMatcher where
88
9+import qualified Prelude as GHC.Integer.Type
10+import qualified Prelude as GHC.Maybe
911import qualified Control.Monad.Fail
1012import qualified Data.Aeson
1113import qualified Data.Aeson as Data.Aeson.Encoding.Internal
1214import qualified Data.Aeson as Data.Aeson.Types
1315import qualified Data.Aeson as Data.Aeson.Types.FromJSON
14−import qualified Data.Aeson as Data.Aeson.Types.Internal
1516import qualified Data.Aeson as Data.Aeson.Types.ToJSON
17+import qualified Data.Aeson as Data.Aeson.Types.Internal
1618import qualified Data.ByteString.Char8
1719import qualified Data.ByteString.Char8 as Data.ByteString.Internal
1820import qualified Data.Foldable
1921import qualified Data.Functor
2022import qualified Data.Maybe
21−import Data.OpenApi.Internal (Schema)
2223import qualified Data.Scientific
2324import qualified Data.Text
2425import qualified Data.Text.Internal
@@ -31,15 +32,14 @@ import qualified GHC.Show
3132import qualified GHC.Types
3233import qualified MockServer.Common
3334import MockServer.TypeAlias
34−import qualified Prelude as GHC.Integer.Type
35−import qualified Prelude as GHC.Maybe
35+import {-# SOURCE #-} MockServer.Types.Http__JsonSchema_OrgDraft_04Schema
3636
3737-- | Defines the object schema located at @components.schemas.JsonSchemaBodyMatcher@ in the specification.
38−--
38+--
3939-- json schema body matcher
4040data JsonSchemaBodyMatcher = JsonSchemaBodyMatcher {
4141 -- | jsonSchema
42− jsonSchemaBodyMatcherJsonSchema :: (GHC.Maybe.Maybe Schema)
42+ jsonSchemaBodyMatcherJsonSchema :: (GHC.Maybe.Maybe Http___json_schema'org_draft_04_schema)
4343 -- | not
4444 , jsonSchemaBodyMatcherNot :: (GHC.Maybe.Maybe GHC.Types.Bool)
4545 -- | type
src/MockServer/Types/Protocol.hsdeleted−53
@@ -1,53 +0,0 @@
1−-- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator.
2−
3−{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE MultiWayIf #-}
5−
6−-- | Contains the types generated from the schema Protocol
7−module MockServer.Types.Protocol where
8−
9−import qualified Prelude as GHC.Integer.Type
10−import qualified Prelude as GHC.Maybe
11−import qualified Control.Monad.Fail
12−import qualified Data.Aeson
13−import qualified Data.Aeson as Data.Aeson.Encoding.Internal
14−import qualified Data.Aeson as Data.Aeson.Types
15−import qualified Data.Aeson as Data.Aeson.Types.FromJSON
16−import qualified Data.Aeson as Data.Aeson.Types.ToJSON
17−import qualified Data.Aeson as Data.Aeson.Types.Internal
18−import qualified Data.ByteString.Char8
19−import qualified Data.ByteString.Char8 as Data.ByteString.Internal
20−import qualified Data.Foldable
21−import qualified Data.Functor
22−import qualified Data.Maybe
23−import qualified Data.Scientific
24−import qualified Data.Text
25−import qualified Data.Text.Internal
26−import qualified Data.Time.Calendar as Data.Time.Calendar.Days
27−import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
28−import qualified GHC.Base
29−import qualified GHC.Classes
30−import qualified GHC.Int
31−import qualified GHC.Show
32−import qualified GHC.Types
33−import qualified MockServer.Common
34−import MockServer.TypeAlias
35−
36−-- | Defines the enum schema located at @components.schemas.Protocol@ in the specification.
37−--
38−-- protocol matcher
39−data Protocol =
40− ProtocolOther Data.Aeson.Types.Internal.Value -- ^ This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
41− | ProtocolTyped Data.Aeson.Types.Internal.Object -- ^ This constructor can be used to send values to the server which are not present in the specification yet.
42− | ProtocolEnumHTTP_1_1 -- ^ Represents the JSON value @"HTTP_1_1"@
43− | ProtocolEnumHTTP_2 -- ^ Represents the JSON value @"HTTP_2"@
44− deriving (GHC.Show.Show, GHC.Classes.Eq)
45−instance Data.Aeson.Types.ToJSON.ToJSON Protocol
46− where toJSON (ProtocolOther val) = val
47− toJSON (ProtocolTyped val) = Data.Aeson.Types.ToJSON.toJSON val
48− toJSON (ProtocolEnumHTTP_1_1) = "HTTP_1_1"
49− toJSON (ProtocolEnumHTTP_2) = "HTTP_2"
50−instance Data.Aeson.Types.FromJSON.FromJSON Protocol
51− where parseJSON val = GHC.Base.pure (if | val GHC.Classes.== "HTTP_1_1" -> ProtocolEnumHTTP_1_1
52− | val GHC.Classes.== "HTTP_2" -> ProtocolEnumHTTP_2
53− | GHC.Base.otherwise -> ProtocolOther val)
src/MockServer/Types/Protocol.hs-bootdeleted−9
@@ -1,9 +0,0 @@
1−module MockServer.Types.Protocol where
2−import Data.Aeson
3−import qualified Data.Aeson as Data.Aeson.Types.Internal
4−import qualified MockServer.Common
5−data Protocol
6−instance Show Protocol
7−instance Eq Protocol
8−instance FromJSON Protocol
9−instance ToJSON Protocol
src/MockServer/Types/StringOrJsonSchema.hs+7−7
@@ -6,19 +6,20 @@
66-- | Contains the types generated from the schema StringOrJsonSchema
77module MockServer.Types.StringOrJsonSchema where
88
9+import qualified Prelude as GHC.Integer.Type
10+import qualified Prelude as GHC.Maybe
911import qualified Control.Monad.Fail
1012import qualified Data.Aeson
1113import qualified Data.Aeson as Data.Aeson.Encoding.Internal
1214import qualified Data.Aeson as Data.Aeson.Types
1315import qualified Data.Aeson as Data.Aeson.Types.FromJSON
14−import qualified Data.Aeson as Data.Aeson.Types.Internal
1516import qualified Data.Aeson as Data.Aeson.Types.ToJSON
17+import qualified Data.Aeson as Data.Aeson.Types.Internal
1618import qualified Data.ByteString.Char8
1719import qualified Data.ByteString.Char8 as Data.ByteString.Internal
1820import qualified Data.Foldable
1921import qualified Data.Functor
2022import qualified Data.Maybe
21−import Data.OpenApi.Internal (Schema)
2223import qualified Data.Scientific
2324import qualified Data.Text
2425import qualified Data.Text.Internal
@@ -31,12 +32,11 @@ import qualified GHC.Show
3132import qualified GHC.Types
3233import qualified MockServer.Common
3334import MockServer.TypeAlias
34−import qualified Prelude as GHC.Integer.Type
35−import qualified Prelude as GHC.Maybe
35+import {-# SOURCE #-} MockServer.Types.Http__JsonSchema_OrgDraft_04Schema
3636
3737-- | Defines the object schema located at @components.schemas.StringOrJsonSchema.oneOf@ in the specification.
38−--
39−--
38+--
39+--
4040data StringOrJsonSchemaOneOf2 = StringOrJsonSchemaOneOf2 {
4141 -- | not
4242 stringOrJsonSchemaOneOf2Not :: (GHC.Maybe.Maybe GHC.Types.Bool)
@@ -45,7 +45,7 @@ data StringOrJsonSchemaOneOf2 = StringOrJsonSchemaOneOf2 {
4545 -- | parameterStyle
4646 , stringOrJsonSchemaOneOf2ParameterStyle :: (GHC.Maybe.Maybe StringOrJsonSchemaOneOf2ParameterStyle)
4747 -- | schema
48− , stringOrJsonSchemaOneOf2Schema :: (GHC.Maybe.Maybe Schema)
48+ , stringOrJsonSchemaOneOf2Schema :: (GHC.Maybe.Maybe Http___json_schema'org_draft_04_schema)
4949 -- | value
5050 , stringOrJsonSchemaOneOf2Value :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
5151 } deriving (GHC.Show.Show