Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !5629
An error occurred while fetching the assigned milestone of the selected merge_request.

[Powershell] refactor the client generator

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged William Cheng requested to merge github/fork/wing328/powershell-refactor into master 5 years ago
  • Overview 0
  • Commits 51
  • Pipelines 0
  • Changes 84

Created a new powershell-experimental client generator based on feedback from users. It has no dependency on the corresponding C# SDK.

(this generator may subject to breaking changes without further notices)

cc @beatcracker

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.
Compare
  • master (base)

and
  • latest version
    c976e547
    51 commits, 2 years ago

84 files
+ 6848
- 0

    Preferences

    File browser
    Compare changes
b‎in‎
open‎api3‎
powershell-experi‎mental-petstore.sh‎ +32 -0
powershell-‎config.json‎ +3 -0
do‎cs‎
gener‎ators‎
powershell-ex‎perimental.md‎ +212 -0
genera‎tors.md‎ +1 -0
modules/openap‎i-generator/src‎
ma‎in‎
java/org/openapitoo‎ls/codegen/languages‎
PowerShellExperiment‎alClientCodegen.java‎ +821 -0
reso‎urces‎
META-INF‎/services‎
org.openapitools.co‎degen.CodegenConfig‎ +1 -0
powershell-‎experimental‎
Build.ps1‎.mustache‎ +66 -0
Get-CommonPara‎meters.mustache‎ +15 -0
Org.OpenAPITool‎s.psm1.mustache‎ +20 -0
Out-DebugPara‎meter.mustache‎ +38 -0
README.‎mustache‎ +104 -0
about_Org.OpenAPIToo‎ls.help.txt.mustache‎ +27 -0
api.mu‎stache‎ +179 -0
api_clien‎t.mustache‎ +168 -0
api_doc.‎mustache‎ +87 -0
api_test‎.mustache‎ +15 -0
appveyor‎.mustache‎ +10 -0
configurati‎on.mustache‎ +114 -0
model.m‎ustache‎ +32 -0
model_doc‎.mustache‎ +30 -0
model_tes‎t.mustache‎ +14 -0
partial_hea‎der.mustache‎ +15 -0
test/resources‎/3_0/powershell‎
petsto‎re.yaml‎ +741 -0
samples/…/…/power‎shell-experimental‎
.openapi-‎generator‎
VER‎SION‎ +1 -0
do‎cs‎
ApiResp‎onse.md‎ +26 -0
Categ‎ory.md‎ +24 -0
InlineO‎bject.md‎ +24 -0
InlineOb‎ject1.md‎ +24 -0
Orde‎r.md‎ +32 -0
PSPet‎Api.md‎ +415 -0
PSStor‎eApi.md‎ +191 -0
PSUser‎Api.md‎ +403 -0
Pet‎.md‎ +32 -0
Tag‎.md‎ +24 -0
Use‎r.md‎ +36 -0
src/PSP‎etstore‎
A‎PI‎
PSPetA‎pi.ps1‎ +433 -0
PSStore‎Api.ps1‎ +190 -0
PSUser‎Api.ps1‎ +410 -0
Cli‎ent‎
PSConfigu‎ration.ps1‎ +120 -0
Mo‎del‎
ApiResp‎onse.ps1‎ +34 -0
Catego‎ry.ps1‎ +30 -0
InlineOb‎ject.ps1‎ +30 -0
InlineOb‎ject1.ps1‎ +30 -0
Orde‎r.ps1‎ +46 -0
Pet‎.ps1‎ +46 -0
Tag‎.ps1‎ +30 -0
User‎.ps1‎ +54 -0
Pri‎vate‎
Get-CommonPa‎rameters.ps1‎ +21 -0
Out-DebugPa‎rameter.ps1‎ +44 -0
PSApiCl‎ient.ps1‎ +174 -0
en‎-US‎
about_PSPets‎tore.help.txt‎ +19 -0
PSPetst‎ore.psd1‎ +133 -0
PSPetst‎ore.psm1‎ +26 -0
te‎sts‎
ApiRespons‎e.Tests.ps1‎ +16 -0
Category.‎Tests.ps1‎ +16 -0
Configurati‎on.Tests.ps1‎ +31 -0
InlineObjec‎t.Tests.ps1‎ +16 -0
InlineObjec‎t1.Tests.ps1‎ +16 -0
New-ApiRespo‎nse.Tests.ps1‎ +16 -0
New-Categor‎y.Tests.ps1‎ +16 -0
New-InlineObj‎ect.Tests.ps1‎ +16 -0
New-InlineObj‎ect1.Tests.ps1‎ +16 -0
New-Order‎.Tests.ps1‎ +16 -0
New-Pet.‎Tests.ps1‎ +16 -0
New-Tag.‎Tests.ps1‎ +16 -0
New-User.‎Tests.ps1‎ +16 -0
Order.T‎ests.ps1‎ +16 -0
PSPetApi.‎Tests.ps1‎ +73 -0
PSStoreApi‎.Tests.ps1‎ +41 -0
PSUserApi‎.Tests.ps1‎ +73 -0
Pet.Te‎sts.ps1‎ +16 -0
PetApi.T‎ests.ps1‎ +73 -0
Petstore.‎Tests.ps1‎ +63 -0
StoreApi.‎Tests.ps1‎ +41 -0
Tag.Te‎sts.ps1‎ +16 -0
User.Te‎sts.ps1‎ +16 -0
UserApi.‎Tests.ps1‎ +73 -0
plus‎.gif‎ +0 -0
.openapi-gen‎erator-ignore‎ +23 -0
Buil‎d.ps1‎ +72 -0
READ‎ME.md‎ +112 -0
Test‎1.ps1‎ +54 -0
appvey‎or.yml‎ +16 -0
plus‎.gif‎ +0 -0
bin/openapi3/powershell-experimental-petstore.sh 0 → 100755
+ 32
- 0
  • View file @ c976e547

  • Edit in single-file editor

  • Open in Web IDE

#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
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/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/powershell-experimental -i modules/openapi-generator/src/test/resources/3_0/powershell/petstore.yaml -g powershell-experimental -o samples/client/petstore/powershell-experimental --additional-properties packageGuid=a27b908d-2a20-467f-bc32-af6f3a654ac5,packageName=PSPetstore,apiNamePrefix=PS,packageVersion=0.1.2 -c ./bin/powershell-config.json $@"
java ${JAVA_OPTS} -jar ${executable} ${ags}
bin/powershell-config.json 0 → 100644
+ 3
- 0
  • View file @ c976e547

  • Edit in single-file editor

  • Open in Web IDE

{
"skipFormModel": true
}
docs/generators/powershell-experimental.md 0 → 100644
+ 212
- 0
  • View file @ c976e547

  • Edit in single-file editor

  • Open in Web IDE

---
title: Config Options for powershell-experimental
sidebar_label: powershell-experimental
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|apiNamePrefix|Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet => Pet.| |null|
|packageGuid|GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default.| |null|
|packageName|Client package name (e.g. org.openapitools.client).| |PSOpenAPITools|
|packageVersion|Package version (e.g. 0.1.2).| |0.1.2|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
|Array|java.util.List|
|ArrayList|java.util.ArrayList|
|BigDecimal|java.math.BigDecimal|
|Date|java.util.Date|
|DateTime|org.joda.time.*|
|File|java.io.File|
|HashMap|java.util.HashMap|
|List|java.util.*|
|LocalDate|org.joda.time.*|
|LocalDateTime|org.joda.time.*|
|LocalTime|org.joda.time.*|
|Map|java.util.Map|
|Set|java.util.*|
|Timestamp|java.sql.Timestamp|
|URI|java.net.URI|
|UUID|java.util.UUID|
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Boolean</li>
<li>Byte</li>
<li>Byte[]</li>
<li>Char</li>
<li>Decimal</li>
<li>Double</li>
<li>Guid</li>
<li>Int16</li>
<li>Int32</li>
<li>Int64</li>
<li>ProgressRecord</li>
<li>SByte</li>
<li>SecureString</li>
<li>Single</li>
<li>String</li>
<li>System.DateTime</li>
<li>System.IO.FileInfo</li>
<li>TimeSpan</li>
<li>UInt16</li>
<li>UInt32</li>
<li>UInt64</li>
<li>Uri</li>
<li>Version</li>
<li>XmlDocument</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>Begin</li>
<li>Break</li>
<li>Catch</li>
<li>Continue</li>
<li>Data</li>
<li>Do</li>
<li>Dynamicparam</li>
<li>Else</li>
<li>Elseif</li>
<li>End</li>
<li>Exit</li>
<li>Filter</li>
<li>Finally</li>
<li>For</li>
<li>Foreach</li>
<li>From</li>
<li>Function</li>
<li>If</li>
<li>In</li>
<li>Local</li>
<li>Param</li>
<li>Private</li>
<li>Process</li>
<li>Return</li>
<li>Switch</li>
<li>Throw</li>
<li>Trap</li>
<li>Try</li>
<li>Until</li>
<li>Where</li>
<li>While</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3
docs/generators.md
+ 1
- 0
  • View file @ c976e547

  • Edit in single-file editor

  • Open in Web IDE


@@ -46,6 +46,7 @@ The following generators are available:
* [perl](generators/perl.md)
* [php](generators/php.md)
* [powershell](generators/powershell.md)
* [powershell-experimental (beta)](generators/powershell-experimental.md)
* [python](generators/python.md)
* [python-experimental (experimental)](generators/python-experimental.md)
* [r](generators/r.md)
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellExperimentalClientCodegen.java 0 → 100644
+ 821
- 0
  • View file @ c976e547

  • Edit in single-file editor

  • Open in Web IDE

Files with large changes are collapsed by default.

0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference:
Source branch: github/fork/wing328/powershell-refactor

Menu

Explore Projects Groups Snippets