File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Generates new test files for models. Run from the root.
4+
5+ # allow generator to write test files
6+ sed -i.bak ' s/^src\/Bandwidth\.Standard\.Test\//# src\/Bandwidth.Standard.Test\//' .openapi-generator-ignore && rm .openapi-generator-ignore.bak
7+ # remove current test files for models
8+ rm -f ./src/Bandwidth.Standard.Test/Unit/Model/*
9+ # generate new test files for models
10+ openapi-generator-cli generate -i bandwidth.yml -o ./ -c openapi-config.yml -g csharp > /dev/null
11+ # move generated test files to the correct location
12+ mv ./src/Bandwidth.Standard.Test/Model/* ./src/Bandwidth.Standard.Test/Unit/Model/
13+ # fix namespace declarations in moved test files
14+ sed -i ' ' ' s/namespace Bandwidth\.Standard\.Test\.Model/namespace Bandwidth.Standard.Test.Unit.Model/g' ./src/Bandwidth.Standard.Test/Unit/Model/* .cs
15+ # remove the rest of the generated files
16+ rm -rf ./src/Bandwidth.Standard.Test/Api ./src/Bandwidth.Standard.Test/Model
17+ # discard changes to modified files only (leaves deletions and new test files intact)
18+ modified=$( git diff --name-only --diff-filter=M) && [ -n " $modified " ] && echo " $modified " | xargs git checkout --
You can’t perform that action at this time.
0 commit comments