1{ openapi-generator-cli, fetchurl, runCommand }:
2
3runCommand "openapi-generator-cli-test" {
4 nativeBuildInputs = [ openapi-generator-cli ];
5 petstore = fetchurl {
6 url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/14c0908becbccd78252be49bd92be8c53cd2b9e3/examples/v3.0/petstore.yaml";
7 hash = "sha256-q2D1naR41KwxLNn6vMbL0G+Pl1q4oaDCApsqQfZf7dU=";
8 };
9 config = builtins.toJSON {
10 elmVersion = "0.19";
11 elmPrefixCustomTypeVariants = false;
12 };
13 passAsFile = [ "config" ];
14} ''
15 openapi-generator-cli generate \
16 --input-spec $petstore \
17 --enable-post-process-file \
18 --generator-name elm \
19 --config "$config" \
20 --additional-properties elmEnableCustomBasePaths=true \
21 --output "$out" \
22 ;
23 find $out
24 echo >&2 'Looking for some keywords'
25 set -x
26 grep 'module Api.Request.Pets' $out/src/Api/Request/Pets.elm
27 grep 'createPets' $out/src/Api/Request/Pets.elm
28 grep '"limit"' $out/src/Api/Request/Pets.elm
29 set +x
30 echo "Looks OK!"
31''