About
The package is the client library for the mock server. The source code is generated by the openapi3-code-generator, specifically its patched version.
How to regenerate
cd codegen && ./regen.sh
It requires the nix to be installed in your system because it uses the
openapi3-code-generator built by the nix.
After regeneration you will see some .hs files changed. This is because some
parts of the libary are modified by hand to make the more usable.
Files
The codegen dir
regen.shis the simple script to regenerate the whole package.shell.nixa shell in which theregen.shcalls theopenapi3-code-generatorto regenerate themock-server-openapi-5.13.x-swagger.yamlnot the original file as you might think. The thing is that theopenapi3-code-generatordoes not support all the features of the OpenAPI3 standard correctly, so it is hand-postprocessed. It was originally downloaded from here and fixed.srccontails the generted code, but not exactly. Some of the parts of the generted code was not very pleasant, so it was fixed too.
What will happen if you just call the regen.sh?
It will build the openapi3-code-generator in nix and regenerate the whole
Haskell source code. You will see that the code was changed, because as
mentioned earlier the original code was slightly modified, so watch your commits.
How the to update the package to the new version of the mock-server?
- Commit all changes in git
- Run the
regen.shand regenerate the whole package - Run
git diff -p > src.patchand save the manual changes made to the source code - Download the original spec in place of our patched spec file
- Run the
git diff -- codegen/mock-server-openapi-5.13.x-swagger.yaml -p > spec.patch - Download the new spec and put it in place of the old one
- Try to
git apply spec.patchto the newer version of the spec to apply manual changes to the new spec. If somethig goes wrong use AI to fix it for you, heh. - Fix the
regen.shand rename themock-server-openapi-5.13.x-swagger.yamlto the newer version. git commit -m 'dangerous action'- Run the
regen.shso you will hopefuly have a new version of the client code generated. git apply src.patchto apply manual patches to the new version.