git.iko.soy/typeable/mock-server-client
on 3f2964e help sign in
.github/workflows/haskell-ci.ymldeleted−25
since splitsnapshots
unifiedsplit
@@ -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
2
2
3The package is the client library for the [mock server](https://www.mock-server.com/). The source code is
3The package is the client library for the [mock server](https://www.mock-server.com/). The source code is
4generated by the [openapi3-code-generator](https://hackage.haskell.org/package/openapi3-code-generator), specifically its patched version.
4generated by the [openapi3-code-generator](https://hackage.haskell.org/package/openapi3-code-generator), specifically its patched version.
5
5
6−## Usage
6+## How to regenerate
7
7
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
37```
8```
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`.
38
14
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.
40
17
41## Files
18## Files
42
19
43### The `codegen` dir
20### The `codegen` dir
44
21
45* `regen.sh` is the simple script to regenerate the whole package.
22* `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
23+* `shell.nix` a shell in which the `regen.sh` calls the `openapi3-code-generator` to regenerate the
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
24+* `mock-server-openapi-5.13.x-swagger.yaml` not the original file as you might
48− think. The thing is that the `openapi3-code-generator` does not support all the features of the
25+ think. The thing is that the `openapi3-code-generator` does not support all
49− OpenAPI3 standard correctly, so it is hand-postprocessed. It was originally downloaded from
26+ the features of the OpenAPI3 standard correctly, so it is
50− [here](https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi/5.13.x) and fixed.
27+ hand-postprocessed. It was originally downloaded from [here](https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi/5.13.x) and fixed.
51−
28+* `src` contails the generted code, but not exactly. Some of the parts of the
52−### Other
29+ generted code was not very pleasant, so it was fixed too.
53
30
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`?
58
32
59It will build the `openapi3-code-generator` in `nix` and regenerate the whole
33It will build the `openapi3-code-generator` in `nix` and regenerate the whole
60Haskell source code. You will see that the code was changed, because as
34Haskell source code. You will see that the code was changed, because as
61mentioned earlier the original code was slightly modified, so watch your commits.
35mentioned earlier the original code was slightly modified, so watch your commits.
62
36
63−## How to update the package to the new version of the `mock-server` spec?
37+## How the to update the package to the new version of the `mock-server`?
64−
38+
65−* Commit or discard all changes
39+* Commit all changes in git
66−* `git checkout update-openapi-spec`
40+* Run the `regen.sh` and regenerate the whole package
67−* Replace the `codegen/mock-server-openapi.yaml` with a newer version
41+* Run `git diff -p > src.patch` and save the manual changes made to the source code
68−* `git commit -m "updated mock-server-openapi.yaml to version $NEWVERSION"`
42+* Download the [original spec](https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi/5.13.x) in place of our patched spec file
69−* `git checkout -b "update-$NEWVERSION" master`
43+* Run the `git diff -- codegen/mock-server-openapi-5.13.x-swagger.yaml -p > spec.patch`
70−* `git merge update-openapi-spec`
44+* Download the [new spec](https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi) and put it in place of the old one
71−* Resolve conflicts if any
45+* Try to `git apply spec.patch` to the newer version of the spec to apply manual
72−* `./codegen/regen.sh`
46+ changes to the new spec. If somethig goes wrong use AI to fix it for you, heh.
73−* `git symbolic-ref HEAD refs/heads/update-generated-code && git reset`
47+* Fix the `regen.sh` and rename the `mock-server-openapi-5.13.x-swagger.yaml` to
74− switching to the branch `update-generated-code` without checking out the working-tree
48+ the newer version.
75−* `git commit -m "update the generted code for version $NEWVERSION"`
49+* `git commit -m 'dangerous action'`
76−* `git checkout "update-$NEWVERSION"`
50+* Run the `regen.sh` so you will hopefuly have a new version of the client code
77−* `git merge update-generated-code`
51+ generated.
78−* Resolve conflicts if any
52+* `git apply src.patch` to apply manual patches to the new version.
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`
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−1
@@ -47,7 +47,6 @@ library
47 MockServer.Types.OpenAPIExpectations
47 MockServer.Types.OpenAPIExpectations
48 MockServer.Types.ParameterBodyMatcher
48 MockServer.Types.ParameterBodyMatcher
49 MockServer.Types.Ports
49 MockServer.Types.Ports
50− MockServer.Types.Protocol
51 MockServer.Types.RegexBodyMatcher
50 MockServer.Types.RegexBodyMatcher
52 MockServer.Types.RequestDefinition
51 MockServer.Types.RequestDefinition
53 MockServer.Types.SocketAddress
52 MockServer.Types.SocketAddress
src/MockServer.hs−2
@@ -42,7 +42,6 @@ module MockServer (
42 module MockServer.Types.OpenAPIExpectations,
42 module MockServer.Types.OpenAPIExpectations,
43 module MockServer.Types.ParameterBodyMatcher,
43 module MockServer.Types.ParameterBodyMatcher,
44 module MockServer.Types.Ports,
44 module MockServer.Types.Ports,
45− module MockServer.Types.Protocol,
46 module MockServer.Types.RegexBodyMatcher,
45 module MockServer.Types.RegexBodyMatcher,
47 module MockServer.Types.RequestDefinition,
46 module MockServer.Types.RequestDefinition,
48 module MockServer.Types.SocketAddress,
47 module MockServer.Types.SocketAddress,
@@ -103,7 +102,6 @@ import MockServer.Types.OpenAPIExpectation
103import MockServer.Types.OpenAPIExpectations
102import MockServer.Types.OpenAPIExpectations
104import MockServer.Types.ParameterBodyMatcher
103import MockServer.Types.ParameterBodyMatcher
105import MockServer.Types.Ports
104import MockServer.Types.Ports
106−import MockServer.Types.Protocol
107import MockServer.Types.RegexBodyMatcher
105import MockServer.Types.RegexBodyMatcher
108import MockServer.Types.RequestDefinition
106import MockServer.Types.RequestDefinition
109import MockServer.Types.SocketAddress
107import MockServer.Types.SocketAddress
src/MockServer/Operations/Put_mockserver_retrieve.hs+2−2
@@ -62,7 +62,7 @@ put_mockserver_retrieve parameters
62data Put_mockserver_retrieveParameters = Put_mockserver_retrieveParameters {
62data Put_mockserver_retrieveParameters = Put_mockserver_retrieveParameters {
63 -- | queryFormat: Represents the parameter named \'format\'
63 -- | queryFormat: Represents the parameter named \'format\'
64 --
64 --
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\"
66 put_mockserver_retrieveParametersQueryFormat :: (GHC.Maybe.Maybe Put_mockserver_retrieveParametersQueryFormat)
66 put_mockserver_retrieveParametersQueryFormat :: (GHC.Maybe.Maybe Put_mockserver_retrieveParametersQueryFormat)
67 -- | queryType: Represents the parameter named \'type\'
67 -- | queryType: Represents the parameter named \'type\'
68 --
68 --
@@ -83,7 +83,7 @@ mkPut_mockserver_retrieveParameters = Put_mockserver_retrieveParameters{put_mock
83--
83--
84-- Represents the parameter named \'format\'
84-- Represents the parameter named \'format\'
85--
85--
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\"
87data Put_mockserver_retrieveParametersQueryFormat =
87data Put_mockserver_retrieveParametersQueryFormat =
88 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.
88 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.
89 | 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.
89 | 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 (
31 module MockServer.Types.OpenAPIExpectations,
31 module MockServer.Types.OpenAPIExpectations,
32 module MockServer.Types.ParameterBodyMatcher,
32 module MockServer.Types.ParameterBodyMatcher,
33 module MockServer.Types.Ports,
33 module MockServer.Types.Ports,
34− module MockServer.Types.Protocol,
35 module MockServer.Types.RegexBodyMatcher,
34 module MockServer.Types.RegexBodyMatcher,
36 module MockServer.Types.RequestDefinition,
35 module MockServer.Types.RequestDefinition,
37 module MockServer.Types.SocketAddress,
36 module MockServer.Types.SocketAddress,
@@ -78,7 +77,6 @@ import MockServer.Types.OpenAPIExpectation
78import MockServer.Types.OpenAPIExpectations
77import MockServer.Types.OpenAPIExpectations
79import MockServer.Types.ParameterBodyMatcher
78import MockServer.Types.ParameterBodyMatcher
80import MockServer.Types.Ports
79import MockServer.Types.Ports
81−import MockServer.Types.Protocol
82import MockServer.Types.RegexBodyMatcher
80import MockServer.Types.RegexBodyMatcher
83import MockServer.Types.RequestDefinition
81import MockServer.Types.RequestDefinition
84import MockServer.Types.SocketAddress
82import MockServer.Types.SocketAddress
src/MockServer/Types/HttpRequest.hs+3−7
@@ -35,7 +35,6 @@ import MockServer.TypeAlias
35import {-# SOURCE #-} MockServer.Types.Body
35import {-# SOURCE #-} MockServer.Types.Body
36import {-# SOURCE #-} MockServer.Types.KeyToMultiValue
36import {-# SOURCE #-} MockServer.Types.KeyToMultiValue
37import {-# SOURCE #-} MockServer.Types.KeyToValue
37import {-# SOURCE #-} MockServer.Types.KeyToValue
38−import {-# SOURCE #-} MockServer.Types.Protocol
39import {-# SOURCE #-} MockServer.Types.SocketAddress
38import {-# SOURCE #-} MockServer.Types.SocketAddress
40import {-# SOURCE #-} MockServer.Types.StringOrJsonSchema
39import {-# SOURCE #-} MockServer.Types.StringOrJsonSchema
41
40
@@ -57,8 +56,6 @@ data HttpRequest = HttpRequest {
57 , httpRequestPath :: (GHC.Maybe.Maybe StringOrJsonSchema)
56 , httpRequestPath :: (GHC.Maybe.Maybe StringOrJsonSchema)
58 -- | pathParameters
57 -- | pathParameters
59 , httpRequestPathParameters :: (GHC.Maybe.Maybe KeyToMultiValue)
58 , httpRequestPathParameters :: (GHC.Maybe.Maybe KeyToMultiValue)
60− -- | protocol: protocol matcher
61− , httpRequestProtocol :: (GHC.Maybe.Maybe Protocol)
62 -- | queryStringParameters
59 -- | queryStringParameters
63 , httpRequestQueryStringParameters :: (GHC.Maybe.Maybe KeyToMultiValue)
60 , httpRequestQueryStringParameters :: (GHC.Maybe.Maybe KeyToMultiValue)
64 -- | secure
61 -- | secure
@@ -68,10 +65,10 @@ data HttpRequest = HttpRequest {
68 } deriving (GHC.Show.Show
65 } deriving (GHC.Show.Show
69 , GHC.Classes.Eq)
66 , GHC.Classes.Eq)
70instance Data.Aeson.Types.ToJSON.ToJSON HttpRequest
67instance 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))
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))
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)))
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)))
73instance Data.Aeson.Types.FromJSON.FromJSON HttpRequest
70instance 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"))
75-- | Create a new 'HttpRequest' with all required fields.
72-- | Create a new 'HttpRequest' with all required fields.
76mkHttpRequest :: HttpRequest
73mkHttpRequest :: HttpRequest
77mkHttpRequest = HttpRequest{httpRequestBody = GHC.Maybe.Nothing,
74mkHttpRequest = HttpRequest{httpRequestBody = GHC.Maybe.Nothing,
@@ -81,7 +78,6 @@ mkHttpRequest = HttpRequest{httpRequestBody = GHC.Maybe.Nothing,
81 httpRequestMethod = GHC.Maybe.Nothing,
78 httpRequestMethod = GHC.Maybe.Nothing,
82 httpRequestPath = GHC.Maybe.Nothing,
79 httpRequestPath = GHC.Maybe.Nothing,
83 httpRequestPathParameters = GHC.Maybe.Nothing,
80 httpRequestPathParameters = GHC.Maybe.Nothing,
84− httpRequestProtocol = GHC.Maybe.Nothing,
85 httpRequestQueryStringParameters = GHC.Maybe.Nothing,
81 httpRequestQueryStringParameters = GHC.Maybe.Nothing,
86 httpRequestSecure = GHC.Maybe.Nothing,
82 httpRequestSecure = GHC.Maybe.Nothing,
87 httpRequestSocketAddress = GHC.Maybe.Nothing}
83 httpRequestSocketAddress = GHC.Maybe.Nothing}
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