github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/fixtures/bugs/1617/gen-fixtures.sh (about) 1 #! /bin/bash 2 if [[ ${1} == "--clean" ]] ; then 3 clean=1 4 fi 5 # A small utility to build fixture servers 6 # Fixtures with models only 7 testcases="${testcases} fixture-1617.yaml" 8 # For this, skip --with-expand (contains polymorphic models): 9 #testcases="${testcases} ../../codegen/todolist.models.yml" 10 for opts in "--with-flatten=minimal" "--with-flatten=full" "--with-expand" ;do 11 for testcase in ${testcases} ; do 12 target=./gen-`basename ${testcase%.*}` 13 case ${opts} in 14 "--with-flatten=minimal") 15 target=${target}"-minimal" 16 ;; 17 "--with-flatten=full") 18 target=${target}"-full" 19 ;; 20 "--with-expand") 21 target=${target}"-expand" 22 ;; 23 esac 24 spec=./${testcase} 25 serverName="codegensrv" 26 rm -rf ${target} 27 mkdir ${target} 28 echo "Model generation for ${spec} with ${opts}" 29 swagger generate model --skip-validation ${opts} --spec ${spec} --target ${target} --output=${testcase%.*}.log 30 # 1>x.log 2>&1 31 # 32 if [[ $? != 0 ]] ; then 33 echo "Generation failed for ${spec}" 34 exit 1 35 fi 36 echo "${spec}: Generation OK" 37 if [[ ! -d ${target}/models ]] ; then 38 echo "No model in this spec! Skipped" 39 else 40 (cd ${target}/models; go build) 41 if [[ $? != 0 ]] ; then 42 echo "Build failed for ${spec}" 43 exit 1 44 fi 45 echo "${spec}: Build OK" 46 if [[ -n ${clean} ]] ; then 47 rm -rf ${target} 48 fi 49 fi 50 done 51 done 52 exit