Skip to content

Commit

Permalink
support enum integers in powershell client (#12752)
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 authored Jul 1, 2022
1 parent d0a0b82 commit 4cf58f5
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ public String toEnumVarName(String name, String datatype) {
varName = varName.replaceAll("-", "MINUS_");
varName = varName.replaceAll("\\+", "PLUS_");
varName = varName.replaceAll("\\.", "_DOT_");
return varName;
return "NUMBER_" + varName;
}

// remove special character
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1740,26 +1740,26 @@ components:
- placed
- approved
- delivered
#OuterEnumInteger:
# type: integer
# enum:
# - 0
# - 1
# - 2
#OuterEnumDefaultValue:
# type: string
# enum:
# - placed
# - approved
# - delivered
# default: placed
#OuterEnumIntegerDefaultValue:
# type: integer
# enum:
# - 0
# - 1
# - 2
# default: 0
OuterEnumInteger:
type: integer
enum:
- 0
- 1
- 2
OuterEnumDefaultValue:
type: string
enum:
- placed
- approved
- delivered
default: placed
OuterEnumIntegerDefaultValue:
type: integer
enum:
- 0
- 1
- 2
default: 0
OuterComposite:
type: object
properties:
Expand Down
6 changes: 6 additions & 0 deletions samples/client/petstore/powershell/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ docs/ObjectWithDeprecatedFields.md
docs/Order.md
docs/OuterComposite.md
docs/OuterEnum.md
docs/OuterEnumDefaultValue.md
docs/OuterEnumInteger.md
docs/OuterEnumIntegerDefaultValue.md
docs/PSAnotherFakeApi.md
docs/PSDefaultApi.md
docs/PSFakeApi.md
Expand Down Expand Up @@ -139,6 +142,9 @@ src/PSPetstore/Model/ObjectWithDeprecatedFields.ps1
src/PSPetstore/Model/Order.ps1
src/PSPetstore/Model/OuterComposite.ps1
src/PSPetstore/Model/OuterEnum.ps1
src/PSPetstore/Model/OuterEnumDefaultValue.ps1
src/PSPetstore/Model/OuterEnumInteger.ps1
src/PSPetstore/Model/OuterEnumIntegerDefaultValue.ps1
src/PSPetstore/Model/ParentPet.ps1
src/PSPetstore/Model/Pet.ps1
src/PSPetstore/Model/PetWithRequiredTags.ps1
Expand Down
3 changes: 3 additions & 0 deletions samples/client/petstore/powershell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ Class | Method | HTTP request | Description
- [PSPetstore/Model.Order](docs/Order.md)
- [PSPetstore/Model.OuterComposite](docs/OuterComposite.md)
- [PSPetstore/Model.OuterEnum](docs/OuterEnum.md)
- [PSPetstore/Model.OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
- [PSPetstore/Model.OuterEnumInteger](docs/OuterEnumInteger.md)
- [PSPetstore/Model.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
- [PSPetstore/Model.ParentPet](docs/ParentPet.md)
- [PSPetstore/Model.Pet](docs/Pet.md)
- [PSPetstore/Model.PetWithRequiredTags](docs/PetWithRequiredTags.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# OpenAPI Petstore
# This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: "" \
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS
Enum OuterEnumDefaultValue.
.DESCRIPTION
No description available.
#>

enum OuterEnumDefaultValue {
# enum value: "placed"
placed
# enum value: "approved"
approved
# enum value: "delivered"
delivered
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# OpenAPI Petstore
# This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: "" \
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS
Enum OuterEnumInteger.
.DESCRIPTION
No description available.
#>

enum OuterEnumInteger {
# enum value: "0"
NUMBER_0
# enum value: "1"
NUMBER_1
# enum value: "2"
NUMBER_2
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# OpenAPI Petstore
# This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: "" \
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS
Enum OuterEnumIntegerDefaultValue.
.DESCRIPTION
No description available.
#>

enum OuterEnumIntegerDefaultValue {
# enum value: "0"
NUMBER_0
# enum value: "1"
NUMBER_1
# enum value: "2"
NUMBER_2
}

0 comments on commit 4cf58f5

Please sign in to comment.