Skip to content

Commit

Permalink
[PowerShell] Add PowerShell API client generator (WIP) (#5789)
Browse files Browse the repository at this point in the history
* add powershell generator (wip)

* minor fix to api template

* rename model files

* Powershell generator fix (#11)

* Fix typo

pacakge -> package

* Add missing `petstore` subfolder to $ClientPath

* Resolve $ClientPath to absolute path

Start-Process needs WorkingDirectory to be absolute

* Fix spaces in variable name

${ somevar } is a vairable that literally has spaces in name. We need to
temporarily redifine mustache delimiters so we can generate var. names
without spaces.

* Fix typo

Remove stray `r`

* Fix *.ps1 import in module

Directory structure has changed + we should export functions using
manifest.

* Remove erroneous file

* various fixes and enhancements

* remove nullable for string

* change function name based on feedback by beatcracker

* set index to start at 0

* fix file type

* Powershell generator fix 1 (#12)

* Add closing curly brace

* Fix duplicated '['

* Get FunctionsToExport using AST

Discussion: #5789

* add guid option to powershell generator

* add test files, remove docs

* fix array of items

* clean up powershell comment, update model/api test files
  • Loading branch information
wing328 authored Jun 20, 2017
1 parent c26b5a1 commit e53b3a0
Show file tree
Hide file tree
Showing 72 changed files with 4,237 additions and 0 deletions.
31 changes: 31 additions & 0 deletions bin/powershell-petstore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

SCRIPT="$0"

while [ -h "$SCRIPT" ] ; do
ls=$(ls -ld "$SCRIPT")
link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=$(dirname "$SCRIPT")/"$link"
fi
done

if [ ! -d "${APP_DIR}" ]; then
APP_DIR=$(dirname "$SCRIPT")/..
APP_DIR=$(cd "${APP_DIR}"; pwd)
fi

executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"

if [ ! -f "$executable" ]
then
mvn clean package
fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/swagger-codegen/src/main/resources/powershell -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l powershell -o samples/client/petstore/powershell_test --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5 $@"

java ${JAVA_OPTS} -jar ${executable} ${ags}
10 changes: 10 additions & 0 deletions bin/windows/powershell-petsstore.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar

If Not Exist %executable% (
mvn clean package
)

REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l powershell -o samples\client\petstore\powershell

java %JAVA_OPTS% -jar %executable% %ags%
Loading

0 comments on commit e53b3a0

Please sign in to comment.