-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathGenerateServerStub.cmd
More file actions
62 lines (48 loc) · 1.63 KB
/
Copy pathGenerateServerStub.cmd
File metadata and controls
62 lines (48 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@setlocal
@echo off
rem ------------------------------------------------------------------------------
rem Check the command line
rem ------------------------------------------------------------------------------
if "%~1" == "" (
goto :Usage
)
if not "%~2" == "" (
goto :Usage
)
rem ------------------------------------------------------------------------------
rem Set some variable
rem ------------------------------------------------------------------------------
set NSWAG=%~1\Net70\dotnet-nswag.exe
set RUNTIME=Net70
set CONFIG=nswag.json
set INPUT=swagger.json
set OUTPUT=WorkloadAPI_Generated.cs
rem ------------------------------------------------------------------------------
rem Check everything is in place
rem ------------------------------------------------------------------------------
if not exist "%NSWAG%" (
echo %NSWAG% not found
goto :Error
)
if not exist "%~dp0%CONFIG%" (
echo Configuration file %CONFIG% not found in %~dp0
goto :Error
)
if not exist "%~dp0%INPUT%" (
echo Input file %INPUT% not found in %~dp0
goto :Error
)
rem ------------------------------------------------------------------------------
rem Switch to the script directory and execute
rem ------------------------------------------------------------------------------
cd "%~dp0"
%NSWAG% run "%CONFIG%" /variables:Runtime=%RUNTIME%,Input=%INPUT%,Output=%OUTPUT%
echo Done
exit /b 0
:Usage
echo Usage: %~nx0 ^<NSwag installation directory^>
echo In the same directory with this script (%~dp0) you need to have two files:
echo %CONFIG%: the configuration for the code generator
echo %INPUT%: the swagger definition
:Error
exit /b 1