github.com/rzurga/go-swagger@v0.28.1-0.20211109195225-5d1f453ffa3a/fixtures/bugs/909/gen-fixtures.sh (about) 1 #! /bin/bash 2 # A small utility to build fixture servers 3 testcases="fixture-909-1.yaml fixture-909-2.yaml fixture-909-3.yaml fixture-909-4.yaml fixture-909-5.yaml fixture-909-6.yaml" 4 testcases="${testcases} gentest.yaml gentest2.yaml gentest3.yaml fixture-1414.json" 5 6 for testcase in ${testcases} ; do 7 target="./gen-${testcase%.*}" 8 spec="${testcase}" 9 serverName="bugfix" 10 11 rm -rf "${target}" 12 mkdir "${target}" 13 14 if ! swagger generate client --skip-validation --spec "${spec}" --target "${target}" ; then 15 echo "Client generation failed for ${spec}" 16 exit 1 17 fi 18 echo "${spec}: Client generation OK" 19 if ! (cd "${target}/client"; go build) ; then 20 echo "Client build failed for ${spec}" 21 exit 1 22 fi 23 echo "${spec}: Client build OK" 24 if ! swagger generate server --skip-validation --spec "${spec}" --target "${target}" --name "${serverName}"; then 25 echo "Server generation failed for ${spec}" 26 exit 1 27 fi 28 if ! (cd "${target}/cmd/${serverName}-server"; go build) ; then 29 echo "Server build failed for ${spec}" 30 exit 1 31 fi 32 done