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