git.iko.soy/typeable/mock-server-client
on 3f2964e help sign in
14 files changed+38−220
since splitsnapshots
unifiedsplit
.github/workflows/haskell-ci.yml−25 .gitignore−2 README.md+33−77 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−1 src/MockServer.hs−2 src/MockServer/Operations/Put_mockserver_retrieve.hs+2−2 src/MockServer/Types.hs−2 src/MockServer/Types/HttpRequest.hs+3−7 src/MockServer/Types/Protocol.hs−53 src/MockServer/Types/Protocol.hs-boot−9
.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.
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
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
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/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/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