Repository navigation
fix(typescript-fetch): add samples for not enum #25135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2c38b19
649e1c8
f05e76d
28507bf
fef4f81
253efd4
998828a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| generatorName: typescript-fetch | ||
| outputDir: samples/client/petstore/typescript-fetch/builds/oneOf-not-enum | ||
| inputSpec: modules/openapi-generator/src/test/resources/3_1/typescript-fetch/oneof-not-enum.yaml | ||
| templateDir: modules/openapi-generator/src/main/resources/typescript-fetch | ||
| additionalProperties: | ||
| npmVersion: 1.0.0 | ||
| npmName: '@openapitools/typescript-fetch-petstore' | ||
| npmRepository: https://skimdb.npmjs.com/registry |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| wwwroot/*.js | ||
| node_modules | ||
| typings | ||
| dist |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| README.md |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # OpenAPI Generator Ignore | ||
| # Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
|
||
| # Use this file to prevent files from being overwritten by the generator. | ||
| # The patterns follow closely to .gitignore or .dockerignore. | ||
|
|
||
| # As an example, the C# client generator defines ApiClient.cs. | ||
| # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
| #ApiClient.cs | ||
|
|
||
| # You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
| #foo/*/qux | ||
| # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
|
||
| # You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
| #foo/**/qux | ||
| # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
|
||
| # You can also negate patterns with an exclamation (!). | ||
| # For example, you can ignore all files in a docs folder with the file extension .md: | ||
| #docs/*.md | ||
| # Then explicitly reverse the ignore rule for a single file: | ||
| #!docs/README.md |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| .gitignore | ||
| .npmignore | ||
| README.md | ||
| docs/Known.md | ||
| docs/MixedExcluded.md | ||
| docs/MultipleExcluded.md | ||
| docs/NullableExcluded.md | ||
| docs/Other.md | ||
| docs/SanitizedExcluded.md | ||
| docs/TaggedUnion.md | ||
| package.json | ||
| src/index.ts | ||
| src/models/Known.ts | ||
| src/models/MixedExcluded.ts | ||
| src/models/MultipleExcluded.ts | ||
| src/models/NullableExcluded.ts | ||
| src/models/Other.ts | ||
| src/models/SanitizedExcluded.ts | ||
| src/models/TaggedUnion.ts | ||
| src/models/index.ts | ||
| src/runtime.ts | ||
| tsconfig.esm.json | ||
| tsconfig.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 7.26.0-SNAPSHOT |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # @openapitools/typescript-fetch-petstore@1.0.0 | ||
|
|
||
| A TypeScript SDK client for the localhost API. | ||
|
|
||
| ## Usage | ||
|
|
||
| First, install the SDK from npm. | ||
|
|
||
| ```bash | ||
| npm install @openapitools/typescript-fetch-petstore --save | ||
| ``` | ||
|
|
||
| Next, try it out. | ||
|
|
||
|
|
||
|
|
||
| ## Documentation | ||
|
|
||
| ### API Endpoints | ||
|
|
||
| All URIs are relative to *http://localhost* | ||
|
|
||
| | Class | Method | HTTP request | Description | ||
| | ----- | ------ | ------------ | ------------- | ||
|
|
||
|
|
||
| ### Models | ||
|
|
||
| - [Known](docs/Known.md) | ||
| - [MixedExcluded](docs/MixedExcluded.md) | ||
| - [MultipleExcluded](docs/MultipleExcluded.md) | ||
| - [NullableExcluded](docs/NullableExcluded.md) | ||
| - [Other](docs/Other.md) | ||
| - [SanitizedExcluded](docs/SanitizedExcluded.md) | ||
| - [TaggedUnion](docs/TaggedUnion.md) | ||
|
|
||
| ### Authorization | ||
|
|
||
| Endpoints do not require authorization. | ||
|
|
||
|
|
||
| ## About | ||
|
|
||
| This TypeScript SDK client supports the [Fetch API](https://fetch.spec.whatwg.org/) | ||
| and is automatically generated by the | ||
| [OpenAPI Generator](https://openapi-generator.tech) project: | ||
|
|
||
| - API version: `1.0.0` | ||
| - Package version: `1.0.0` | ||
| - Generator version: `7.26.0-SNAPSHOT` | ||
| - Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen` | ||
|
|
||
| The generated npm module supports the following: | ||
|
|
||
| - Environments | ||
| * Node.js | ||
| * Webpack | ||
| * Browserify | ||
| - Language levels | ||
| * ES5 - you must have a Promises/A+ library installed | ||
| * ES6 | ||
| - Module systems | ||
| * CommonJS | ||
| * ES6 module system | ||
|
|
||
|
|
||
| ## Development | ||
|
|
||
| ### Building | ||
|
|
||
| To build the TypeScript source code, you need to have Node.js and npm installed. | ||
| After cloning the repository, navigate to the project directory and run: | ||
|
|
||
| ```bash | ||
| npm install | ||
| npm run build | ||
| ``` | ||
|
|
||
| ### Publishing | ||
|
|
||
| Once you've built the package, you can publish it to npm: | ||
|
|
||
| ```bash | ||
| npm publish | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| []() |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||
|
|
||||||
| # Known | ||||||
|
|
||||||
|
|
||||||
| ## Properties | ||||||
|
|
||||||
| Name | Type | ||||||
| ------------ | ------------- | ||||||
| `kind` | string | ||||||
|
|
||||||
| ## Example | ||||||
|
|
||||||
| ```typescript | ||||||
| import type { Known } from '@openapitools/typescript-fetch-petstore' | ||||||
|
|
||||||
| // TODO: Update the object below with actual values | ||||||
| const example = { | ||||||
| "kind": null, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This example fails Prompt for AI agents
Suggested change
|
||||||
| } satisfies Known | ||||||
|
|
||||||
| console.log(example) | ||||||
|
|
||||||
| // Convert the instance to a JSON string | ||||||
| const exampleJSON: string = JSON.stringify(example) | ||||||
| console.log(exampleJSON) | ||||||
|
|
||||||
| // Parse the JSON string back to an object | ||||||
| const exampleParsed = JSON.parse(exampleJSON) as Known | ||||||
| console.log(exampleParsed) | ||||||
| ``` | ||||||
|
|
||||||
| [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||
|
|
||||||
| # MixedExcluded | ||||||
|
|
||||||
|
|
||||||
| ## Properties | ||||||
|
|
||||||
| Name | Type | ||||||
| ------------ | ------------- | ||||||
| `kind` | string | ||||||
|
|
||||||
| ## Example | ||||||
|
|
||||||
| ```typescript | ||||||
| import type { MixedExcluded } from '@openapitools/typescript-fetch-petstore' | ||||||
|
|
||||||
| // TODO: Update the object below with actual values | ||||||
| const example = { | ||||||
| "kind": null, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Prompt for AI agents
Suggested change
|
||||||
| } satisfies MixedExcluded | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: This example requires TypeScript 4.9 syntax, but the generated package allows TypeScript Prompt for AI agents |
||||||
|
|
||||||
| console.log(example) | ||||||
|
|
||||||
| // Convert the instance to a JSON string | ||||||
| const exampleJSON: string = JSON.stringify(example) | ||||||
| console.log(exampleJSON) | ||||||
|
|
||||||
| // Parse the JSON string back to an object | ||||||
| const exampleParsed = JSON.parse(exampleJSON) as MixedExcluded | ||||||
| console.log(exampleParsed) | ||||||
| ``` | ||||||
|
|
||||||
| [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||
|
|
||||||
| # MultipleExcluded | ||||||
|
|
||||||
|
|
||||||
| ## Properties | ||||||
|
|
||||||
| Name | Type | ||||||
| ------------ | ------------- | ||||||
| `kind` | string | ||||||
|
|
||||||
| ## Example | ||||||
|
|
||||||
| ```typescript | ||||||
| import type { MultipleExcluded } from '@openapitools/typescript-fetch-petstore' | ||||||
|
|
||||||
| // TODO: Update the object below with actual values | ||||||
| const example = { | ||||||
| "kind": null, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This example assigns Prompt for AI agents
Suggested change
|
||||||
| } satisfies MultipleExcluded | ||||||
|
|
||||||
| console.log(example) | ||||||
|
|
||||||
| // Convert the instance to a JSON string | ||||||
| const exampleJSON: string = JSON.stringify(example) | ||||||
| console.log(exampleJSON) | ||||||
|
|
||||||
| // Parse the JSON string back to an object | ||||||
| const exampleParsed = JSON.parse(exampleJSON) as MultipleExcluded | ||||||
| console.log(exampleParsed) | ||||||
| ``` | ||||||
|
|
||||||
| [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||
|
|
||||||
| # NullableExcluded | ||||||
|
|
||||||
|
|
||||||
| ## Properties | ||||||
|
|
||||||
| Name | Type | ||||||
| ------------ | ------------- | ||||||
| `kind` | string | ||||||
|
|
||||||
| ## Example | ||||||
|
|
||||||
| ```typescript | ||||||
| import type { NullableExcluded } from '@openapitools/typescript-fetch-petstore' | ||||||
|
|
||||||
| // TODO: Update the object below with actual values | ||||||
| const example = { | ||||||
| "kind": null, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This example uses a value that Prompt for AI agents
Suggested change
|
||||||
| } satisfies NullableExcluded | ||||||
|
|
||||||
| console.log(example) | ||||||
|
|
||||||
| // Convert the instance to a JSON string | ||||||
| const exampleJSON: string = JSON.stringify(example) | ||||||
| console.log(exampleJSON) | ||||||
|
|
||||||
| // Parse the JSON string back to an object | ||||||
| const exampleParsed = JSON.parse(exampleJSON) as NullableExcluded | ||||||
| console.log(exampleParsed) | ||||||
| ``` | ||||||
|
|
||||||
| [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||
|
|
||||||
| # Other | ||||||
|
|
||||||
|
|
||||||
| ## Properties | ||||||
|
|
||||||
| Name | Type | ||||||
| ------------ | ------------- | ||||||
| `kind` | string | ||||||
|
|
||||||
| ## Example | ||||||
|
|
||||||
| ```typescript | ||||||
| import type { Other } from '@openapitools/typescript-fetch-petstore' | ||||||
|
|
||||||
| // TODO: Update the object below with actual values | ||||||
| const example = { | ||||||
| "kind": null, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This example does not satisfy Prompt for AI agents
Suggested change
|
||||||
| } satisfies Other | ||||||
|
|
||||||
| console.log(example) | ||||||
|
|
||||||
| // Convert the instance to a JSON string | ||||||
| const exampleJSON: string = JSON.stringify(example) | ||||||
| console.log(exampleJSON) | ||||||
|
|
||||||
| // Parse the JSON string back to an object | ||||||
| const exampleParsed = JSON.parse(exampleJSON) as Other | ||||||
| console.log(exampleParsed) | ||||||
| ``` | ||||||
|
|
||||||
| [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
|
|
||
| # SanitizedExcluded | ||
|
|
||
|
|
||
| ## Properties | ||
|
|
||
| Name | Type | ||
| ------------ | ------------- | ||
| `filePath` | string | ||
|
|
||
| ## Example | ||
|
|
||
| ```typescript | ||
| import type { SanitizedExcluded } from '@openapitools/typescript-fetch-petstore' | ||
|
|
||
| // TODO: Update the object below with actual values | ||
| const example = { | ||
| "filePath": null, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: This example does not type-check because Prompt for AI agents |
||
| } satisfies SanitizedExcluded | ||
|
|
||
| console.log(example) | ||
|
|
||
| // Convert the instance to a JSON string | ||
| const exampleJSON: string = JSON.stringify(example) | ||
| console.log(exampleJSON) | ||
|
|
||
| // Parse the JSON string back to an object | ||
| const exampleParsed = JSON.parse(exampleJSON) as SanitizedExcluded | ||
| console.log(exampleParsed) | ||
| ``` | ||
|
|
||
| [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: These lines document a
Kindfield andSetKindNil/UnsetKindmethods onEnumNullUnion, but neither exists in the generated code. The source spec (modules/openapi-generator/src/test/resources/3_1/go/oneof-not-enum.yaml) definesEnumNullUnionas aoneOfofNullableEnumandNullableExcludedEnum— there is nokindproperty — and the committedmodel_enum_null_union.goonly hasNullableEnum/NullableExcludedEnumfields plus aNullableEnumNullUnionwrapper, with noGetKind/SetKind/SetKindNil/UnsetKindmethods. The "update go" commit (253efd4) regenerated this doc against a stale/different spec, so the committed sample now documents APIs that do not compile. Regenerate the sample docs from the current spec soEnumNullUnion.mddocuments the actual oneOf members.Prompt for AI agents