openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[Typescript] Enum types

Open ksvirkou-hubspot opened this issue 1 year ago • 4 comments

https://github.com/OpenAPITools/openapi-generator/issues/14569

Added enumType generator argument:

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

PR checklist

  • [x] Read the contribution guidelines.
  • [x] 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.
  • [x] 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.
  • [x] 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)
  • [x] 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 avatar Apr 29 '24 08:04 ksvirkou-hubspot

@bodograumann @TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx @macjohnny @topce @akehir @petejohansonxo @amakhrov @davidgamero @mkusaka

ksvirkou-hubspot avatar Apr 29 '24 09:04 ksvirkou-hubspot

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 avatar Apr 29 '24 15:04 ksvirkou-hubspot

@bodograumann Could you merge it, please?

ksvirkou-hubspot avatar Apr 30 '24 06:04 ksvirkou-hubspot

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

bodograumann avatar Apr 30 '24 06:04 bodograumann

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(), }, });

plabok avatar May 29 '24 01:05 plabok

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

bodograumann avatar Jul 02 '24 13:07 bodograumann