[PS] better code format, vendor extension naming (#6778)

* better code format, extension

* show php version

* set php version to 7.2.15
This commit is contained in:
William Cheng 2020-06-25 18:09:44 +08:00 committed by GitHub
parent 13fe079901
commit 36930fe5cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 31 additions and 30 deletions

View File

@ -89,7 +89,8 @@ before_install:
#- sudo apt-get update #- sudo apt-get update
#- sudo apt-get install dart #- sudo apt-get install dart
# switch to php7 # switch to php7
- phpenv global 7.3 - phpenv versions
- phpenv global 7.2.15
- php -v - php -v
# install perl module # install perl module
#- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) #- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)

View File

@ -932,7 +932,7 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo
// Mark the last readonly false property // Mark the last readonly false property
if(this.discardReadOnly && lastWritableProperty != null) { if(this.discardReadOnly && lastWritableProperty != null) {
lastWritableProperty.vendorExtensions.put("x-lastWritable", true); lastWritableProperty.vendorExtensions.put("x-powershell-last-writable", true);
model.allVars.set(model.allVars.indexOf(lastWritableProperty), lastWritableProperty); model.allVars.set(model.allVars.indexOf(lastWritableProperty), lastWritableProperty);
} }

View File

@ -41,7 +41,7 @@ function Initialize-{{{apiNamePrefix}}}{{{classname}}} {
{{/isEnum}} {{/isEnum}}
[{{vendorExtensions.x-powershell-data-type}}] [{{vendorExtensions.x-powershell-data-type}}]
{{=<% %>=}} {{=<% %>=}}
${<%name%>}<%^vendorExtensions.x-lastWritable%>,<%/vendorExtensions.x-lastWritable%> ${<%name%>}<%^vendorExtensions.x-powershell-last-writable%>,<%/vendorExtensions.x-powershell-last-writable%>
<%={{ }}=%> <%={{ }}=%>
{{/isReadOnly}} {{/isReadOnly}}
{{/allVars}} {{/allVars}}
@ -118,15 +118,15 @@ function Initialize-{{{apiNamePrefix}}}{{{classname}}} {
{{/minItems}} {{/minItems}}
{{/hasValidation}} {{/hasValidation}}
{{/vars}} {{/vars}}
$PSO = [PSCustomObject]@{ $PSO = [PSCustomObject]@{
{{=<< >>=}} {{=<< >>=}}
<<#allVars>> <<#allVars>>
"<<baseName>>" = ${<<name>>} "<<baseName>>" = ${<<name>>}
<</allVars>> <</allVars>>
<<={{ }}=>> <<={{ }}=>>
} }
{{/discardReadOnly}} {{/discardReadOnly}}
{{#discardReadOnly}} {{#discardReadOnly}}
{{#vars}} {{#vars}}

View File

@ -43,13 +43,13 @@ function Initialize-PSApiResponse {
'Creating PSCustomObject: PSPetstore => PSApiResponse' | Write-Debug 'Creating PSCustomObject: PSPetstore => PSApiResponse' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{ $PSO = [PSCustomObject]@{
"code" = ${Code} "code" = ${Code}
"type" = ${Type} "type" = ${Type}
"message" = ${Message} "message" = ${Message}
} }
return $PSO return $PSO
} }

View File

@ -39,12 +39,12 @@ function Initialize-PSCategory {
'Creating PSCustomObject: PSPetstore => PSCategory' | Write-Debug 'Creating PSCustomObject: PSPetstore => PSCategory' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{ $PSO = [PSCustomObject]@{
"id" = ${Id} "id" = ${Id}
"name" = ${Name} "name" = ${Name}
} }
return $PSO return $PSO
} }

View File

@ -38,12 +38,12 @@ function Initialize-PSInlineObject {
'Creating PSCustomObject: PSPetstore => PSInlineObject' | Write-Debug 'Creating PSCustomObject: PSPetstore => PSInlineObject' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{ $PSO = [PSCustomObject]@{
"name" = ${Name} "name" = ${Name}
"status" = ${Status} "status" = ${Status}
} }
return $PSO return $PSO
} }

View File

@ -38,12 +38,12 @@ function Initialize-PSInlineObject1 {
'Creating PSCustomObject: PSPetstore => PSInlineObject1' | Write-Debug 'Creating PSCustomObject: PSPetstore => PSInlineObject1' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{ $PSO = [PSCustomObject]@{
"additionalMetadata" = ${AdditionalMetadata} "additionalMetadata" = ${AdditionalMetadata}
"file" = ${File} "file" = ${File}
} }
return $PSO return $PSO
} }

View File

@ -59,8 +59,8 @@ function Initialize-PSOrder {
'Creating PSCustomObject: PSPetstore => PSOrder' | Write-Debug 'Creating PSCustomObject: PSPetstore => PSOrder' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{ $PSO = [PSCustomObject]@{
"id" = ${Id} "id" = ${Id}
"petId" = ${PetId} "petId" = ${PetId}
"quantity" = ${Quantity} "quantity" = ${Quantity}
@ -68,7 +68,7 @@ function Initialize-PSOrder {
"status" = ${Status} "status" = ${Status}
"complete" = ${Complete} "complete" = ${Complete}
} }
return $PSO return $PSO
} }

View File

@ -67,8 +67,8 @@ function Initialize-PSPet {
throw "invalid value for 'PhotoUrls', 'PhotoUrls' cannot be null." throw "invalid value for 'PhotoUrls', 'PhotoUrls' cannot be null."
} }
$PSO = [PSCustomObject]@{ $PSO = [PSCustomObject]@{
"id" = ${Id} "id" = ${Id}
"category" = ${Category} "category" = ${Category}
"name" = ${Name} "name" = ${Name}
@ -76,7 +76,7 @@ function Initialize-PSPet {
"tags" = ${Tags} "tags" = ${Tags}
"status" = ${Status} "status" = ${Status}
} }
return $PSO return $PSO
} }

View File

@ -38,12 +38,12 @@ function Initialize-PSTag {
'Creating PSCustomObject: PSPetstore => PSTag' | Write-Debug 'Creating PSCustomObject: PSPetstore => PSTag' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{ $PSO = [PSCustomObject]@{
"id" = ${Id} "id" = ${Id}
"name" = ${Name} "name" = ${Name}
} }
return $PSO return $PSO
} }

View File

@ -69,8 +69,8 @@ function Initialize-PSUser {
'Creating PSCustomObject: PSPetstore => PSUser' | Write-Debug 'Creating PSCustomObject: PSPetstore => PSUser' | Write-Debug
$PSBoundParameters | Out-DebugParameter | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug
$PSO = [PSCustomObject]@{ $PSO = [PSCustomObject]@{
"id" = ${Id} "id" = ${Id}
"username" = ${Username} "username" = ${Username}
"firstName" = ${FirstName} "firstName" = ${FirstName}
@ -80,7 +80,7 @@ function Initialize-PSUser {
"phone" = ${Phone} "phone" = ${Phone}
"userStatus" = ${UserStatus} "userStatus" = ${UserStatus}
} }
return $PSO return $PSO
} }