Skip to content

[Typescript] Enum types#18531

Merged
macjohnny merged 8 commits intoOpenAPITools:8.0.xfrom
ksvirkou-hubspot:feature/enumType
May 21, 2024
Merged

[Typescript] Enum types#18531
macjohnny merged 8 commits intoOpenAPITools:8.0.xfrom
ksvirkou-hubspot:feature/enumType

Conversation

@ksvirkou-hubspot
Copy link
Contributor

@ksvirkou-hubspot ksvirkou-hubspot commented Apr 29, 2024

#14569

Added enumType generator argument:

  • stringUnion - "available" | "pending" | "sold"
  • enum - { Available = 'available', Pending = 'pending', Sold = 'sold' }

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh ./bin/configs/*.yaml
    ./bin/utils/export_docs_generators.sh
    
    (For Windows users, please run the script in Git BASH)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.1.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@ksvirkou-hubspot
Copy link
Contributor Author

Copy link
Contributor

@bodograumann bodograumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work.

I would have given a bit more details in the help:

|enumType|Specify the enum type which should be used in the client code.|<dl><dt>**stringUnion**</dt><dd>Union of literal string types</dd><dt>**enum**</dt><dd>Typescript's [string enums](https://www.typescriptlang.org/docs/handbook/enums.html#string-enums)</dd></dl>|stringUnion|

But I realized, that doing this in the java-generated cli help as well would be more difficult, so I think it's fine as-is.

@ksvirkou-hubspot
Copy link
Contributor Author

Nice work.

I would have given a bit more details in the help:

|enumType|Specify the enum type which should be used in the client code.|<dl><dt>**stringUnion**</dt><dd>Union of literal string types</dd><dt>**enum**</dt><dd>Typescript's [string enums](https://www.typescriptlang.org/docs/handbook/enums.html#string-enums)</dd></dl>|stringUnion|

But I realized, that doing this in the java-generated cli help as well would be more difficult, so I think it's fine as-is.

Done

@ksvirkou-hubspot
Copy link
Contributor Author

@bodograumann
Could you merge it, please?

@bodograumann
Copy link
Contributor

Sorry, I don't have any elevated access here 😉 @ksvirkou-hubspot. Maybe @TiFu or @wing328 can.

|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
|enumPropertyNamingReplaceSpecialChar|Set to true to replace '-' and '+' symbols with 'minus_' and 'plus_' in enum of type string| |false|
|enumType|Specify the enum type which should be used in the client code.|<dl><dt>**stringUnion**</dt><dd>Union of literal string types</dd><dt>**enum**</dt><dd>Typescript's [string enums](https://www.typescriptlang.org/docs/handbook/enums.html#string-enums)</dd></dl>|stringUnion|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please default to enum for backwards compatibility

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rational here was that a breaking change was (kind of accidentally) introduced in #14663.
So this pr fixes that.
Personally I would be ok with either solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah i see. well i guess i would still lean towards making enum the default, since 7.0.0 was released a while ago

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done it
Could you check it, please?

@macjohnny macjohnny merged commit bfc784e into OpenAPITools:8.0.x May 21, 2024
@ksvirkou-hubspot ksvirkou-hubspot deleted the feature/enumType branch May 21, 2024 14:50
@plabok
Copy link

plabok commented May 29, 2024

import { createConfig, http } from "wagmi";
import { mainnet, sepolia } from "wagmi/chains";
import { metaMask } from "wagmi/connectors";

export const config = createConfig({
chains: [mainnet, sepolia],
connectors: [
metaMask({
dappMetadata: {
name: "Example Wagmi dapp",
},
}),
],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
});

@wing328 wing328 added this to the 7.7.0 milestone Jun 30, 2024
@bodograumann
Copy link
Contributor

Unfortunately this was only merged into the 8.0.x branch, @wing328 .

CreeJee added a commit to portone-io/openapi-generator that referenced this pull request Oct 15, 2025
openapi-generator 8에 들어가게되는 OpenAPITools#18531 를 채리픽 합니다.
CreeJee added a commit to portone-io/openapi-generator that referenced this pull request Oct 17, 2025
openapi-generator 8에 들어가게되는 OpenAPITools#18531 를 채리픽 합니다.
CreeJee added a commit to portone-io/openapi-generator that referenced this pull request Oct 19, 2025
openapi-generator 8에 들어가게되는 OpenAPITools#18531 를 채리픽 합니다.
CreeJee added a commit to portone-io/openapi-generator that referenced this pull request Oct 19, 2025
openapi-generator 8에 들어가게되는 OpenAPITools#18531 를 채리픽 합니다.
CreeJee added a commit to portone-io/openapi-generator that referenced this pull request Oct 20, 2025
* feat(openapi): bfc784e

openapi-generator 8에 들어가게되는 OpenAPITools#18531 를 채리픽 합니다.

* fix(typescript-client): TypeScript Client 의 codegen 이 'from' 을 예약어 취급해서 제네래이션을 막는 버그 수정

* chore: example update

* chore: docsgen 누락 수정

* fix: 기본값수정

* chore: test 누락 수정

* fix: whatwg-fetch 의존성 제거

full-context: 현제 니즈에서는 whatwg-fetch 만을 포함할수 있는 상황도 아니며 재품 기준에서 처리하기 어려움

* fix(openapi-typescript): auth methods configuration 타입젠이 잘못된 securitySchemes 를 만나면 타입의 값이 비어버리는 버그 픽스

* chore: update diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants