{"id":20481919,"url":"https://github.com/typeable/mock-server-client","last_synced_at":"2025-10-15T09:49:13.570Z","repository":{"id":66922862,"uuid":"591219360","full_name":"typeable/mock-server-client","owner":"typeable","description":"Client library for the mock-server","archived":false,"fork":false,"pushed_at":"2023-01-20T12:51:41.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-05T15:51:22.167Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typeable.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-20T07:59:41.000Z","updated_at":"2023-01-20T08:00:17.000Z","dependencies_parsed_at":"2023-03-09T15:45:25.275Z","dependency_job_id":null,"html_url":"https://github.com/typeable/mock-server-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/typeable/mock-server-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typeable%2Fmock-server-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typeable%2Fmock-server-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typeable%2Fmock-server-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typeable%2Fmock-server-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typeable","download_url":"https://codeload.github.com/typeable/mock-server-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typeable%2Fmock-server-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279068735,"owners_count":26096554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T16:10:26.005Z","updated_at":"2025-10-15T09:49:13.555Z","avatar_url":"https://github.com/typeable.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\n\nThe package is the client library for the [mock server](https://www.mock-server.com/). The source code is\ngenerated by the [openapi3-code-generator](https://hackage.haskell.org/package/openapi3-code-generator), specifically its patched version.\n\n## Usage\n\n``` haskell\nmodule Main\n\nimport MockServer as Mock\nimport Network.HTTP.Client\n\nconf :: Mock.Configuration\nconf = Configuration\n  { configBaseURL = \"http://localhost\"\n  , configSecurityScheme = id\n  , configIncludeUserAgent = False\n  , configApplicationName = \"ping-app\" }\n\nexpectation :: Mock.Expectations\nexpectation = Mock.ExpectationsExpectation $ Mock.mkExpectation\n  { expectationHttpRequest = Just request\n  , expectationHttpResponse = Just response }\n  where\n    request = Mock.mkHttpRequest\n      { httpRequestMethod = Just $ StringOrJsonSchemaText \"POST\"\n      , httpRequestPath = Just $ StringOrJsonSchemaText \"/ping\" }\n    response = Mock.mkHttpResponse\n      { httpResponseBody = Just $ BodyWithContentTypeRawStringResponseBody \"pong\"\n      , httpResponseStatusCode = Just 200 }\n\n-- | Puts the expectation which will response with \"pong\" body to the \"POST /ping\" request\nmain :: IO ()\nmain = do\n  void $ Mock.runWithConfiguration conf $ Mock.put_mockserver_expectation expectation\n```\n\n# Maintainance\n\n## Files\n\n### The `codegen` dir\n\n* `regen.sh` is the simple script to regenerate the whole package.\n* `shell.nix` a shell in which the `regen.sh` calls the `openapi3-code-generator` to regenerate the code\n* `mock-server-openapi.yaml` not the [original specification](https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi) of the `mock-server` as you might\n  think. The thing is that the `openapi3-code-generator` does not support all the features of the\n  OpenAPI3 standard correctly, so it is hand-postprocessed. It was originally downloaded from\n  [here](https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi/5.13.x) and fixed.\n\n### Other\n\n* `src` and `mock-server-client.cabal` contain the generted code, but not exactly. Some of the parts\n  of the generted code was not very pleasant, so it was fixed too.\n\n## What will happen if you just call the `regen.sh`?\n\nIt will build the `openapi3-code-generator` in `nix` and regenerate the whole\nHaskell source code. You will see that the code was changed, because as\nmentioned earlier the original code was slightly modified, so watch your commits.\n\n## How to update the package to the new version of the `mock-server` spec?\n\n* Commit or discard all changes\n* `git checkout update-openapi-spec`\n* Replace the `codegen/mock-server-openapi.yaml` with a newer version\n* `git commit -m \"updated mock-server-openapi.yaml to version $NEWVERSION\"`\n* `git checkout -b \"update-$NEWVERSION\" master`\n* `git merge update-openapi-spec`\n* Resolve conflicts if any\n* `./codegen/regen.sh`\n* `git symbolic-ref HEAD refs/heads/update-generated-code \u0026\u0026 git reset`\n  switching to the branch `update-generated-code` without checking out the working-tree\n* `git commit -m \"update the generted code for version $NEWVERSION\"`\n* `git checkout \"update-$NEWVERSION\"`\n* `git merge update-generated-code`\n* Resolve conflicts if any\n* `git push origin \"update-$NEWVERSION\"`\n* Create PR, wait for CI, review, merge into the master\n\nThe algorithm is kind of weird, but for a reason.\n\nThe branch `update-openapi-spec` is the branch tracking only original\n`codegen/mock-server-openapi.yaml` changes, meaning changes made by authors of the\n`mock-server`. So, when you merge changes of this branch into the master you literally merge the\nchanges made by authors of the `mock-server` with our manual changes made to please the\n`openapi3-code-generator`.\n\nThe bratch `update-generated-code` is for tracking \"changes\" made by the code generator when it is\nfeed by the new OpenAPI spec file. So, when you merge this branch into the master you literally\nmerge the \"code regeneration patch\" with changes made by hand.\n\nThe `master` branch is for manual changes only. The changes made to keep things working and the\npackage usable. You can always see the manual changes just by `git diff update-generated-code\nmaster` or `git diff update-openapi-spec master`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypeable%2Fmock-server-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypeable%2Fmock-server-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypeable%2Fmock-server-client/lists"}