Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions bin/configs/typescript-fetch-oneof-not-enum.yaml
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
12 changes: 11 additions & 1 deletion samples/client/others/go/oneof-not-enum/docs/EnumNullUnion.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Kind** | Pointer to **string** | | [optional]
**Kind** | Pointer to **NullableString** | | [optional]

Copy link
Copy Markdown
Contributor

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 Kind field and SetKindNil/UnsetKind methods on EnumNullUnion, but neither exists in the generated code. The source spec (modules/openapi-generator/src/test/resources/3_1/go/oneof-not-enum.yaml) defines EnumNullUnion as a oneOf of NullableEnum and NullableExcludedEnum — there is no kind property — and the committed model_enum_null_union.go only has NullableEnum/NullableExcludedEnum fields plus a NullableEnumNullUnion wrapper, with no GetKind/SetKind/SetKindNil/UnsetKind methods. 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 so EnumNullUnion.md documents the actual oneOf members.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/others/go/oneof-not-enum/docs/EnumNullUnion.md, line 7:

<comment>These lines document a `Kind` field and `SetKindNil`/`UnsetKind` methods on `EnumNullUnion`, but neither exists in the generated code. The source spec (`modules/openapi-generator/src/test/resources/3_1/go/oneof-not-enum.yaml`) defines `EnumNullUnion` as a `oneOf` of `NullableEnum` and `NullableExcludedEnum` — there is no `kind` property — and the committed `model_enum_null_union.go` only has `NullableEnum`/`NullableExcludedEnum` fields plus a `NullableEnumNullUnion` wrapper, with no `GetKind`/`SetKind`/`SetKindNil`/`UnsetKind` methods. The "update go" commit (253efd49) 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 so `EnumNullUnion.md` documents the actual oneOf members.</comment>

<file context>
@@ -4,7 +4,7 @@
 Name | Type | Description | Notes
 ------------ | ------------- | ------------- | -------------
-**Kind** | Pointer to **string** |  | [optional] 
+**Kind** | Pointer to **NullableString** |  | [optional] 
 
 ## Methods
</file context>


## Methods

Expand Down Expand Up @@ -50,6 +50,16 @@ SetKind sets Kind field to given value.

HasKind returns a boolean if a field has been set.

### SetKindNil

`func (o *EnumNullUnion) SetKindNil(b bool)`

SetKindNil sets the value for Kind to be an explicit nil

### UnsetKind
`func (o *EnumNullUnion) UnsetKind()`

UnsetKind ensures that no value is present for Kind, not even an explicit nil

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This example fails satisfies Known with strictNullChecks enabled: Known.kind is the literal type 'known', but this assigns null. Use "known" so the documented snippet type-checks.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/typescript-fetch/builds/oneOf-not-enum/docs/Known.md, line 18:

<comment>This example fails `satisfies Known` with `strictNullChecks` enabled: `Known.kind` is the literal type `'known'`, but this assigns `null`. Use `"known"` so the documented snippet type-checks.</comment>

<file context>
@@ -0,0 +1,34 @@
+
+// TODO: Update the object below with actual values
+const example = {
+  "kind": null,
+} satisfies Known
+
</file context>
Suggested change
"kind": null,
"kind": "known",

} 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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: MixedExcluded.kind is kind?: string, so this example fails under strictNullChecks because null is not assignable. Use an allowed string or omit the optional property.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/typescript-fetch/builds/oneOf-not-enum/docs/MixedExcluded.md, line 18:

<comment>`MixedExcluded.kind` is `kind?: string`, so this example fails under `strictNullChecks` because `null` is not assignable. Use an allowed string or omit the optional property.</comment>

<file context>
@@ -0,0 +1,34 @@
+
+// TODO: Update the object below with actual values
+const example = {
+  "kind": null,
+} satisfies MixedExcluded
+
</file context>
Suggested change
"kind": null,
"kind": "other",

} satisfies MixedExcluded

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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 ^4.0. Replace satisfies with a type annotation so users on TypeScript 4.0–4.8 can compile the example.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/typescript-fetch/builds/oneOf-not-enum/docs/MixedExcluded.md, line 19:

<comment>This example requires TypeScript 4.9 syntax, but the generated package allows TypeScript `^4.0`. Replace `satisfies` with a type annotation so users on TypeScript 4.0–4.8 can compile the example.</comment>

<file context>
@@ -0,0 +1,34 @@
+// TODO: Update the object below with actual values
+const example = {
+  "kind": null,
+} satisfies MixedExcluded
+
+console.log(example)
</file context>


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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This example assigns null to kind, but MultipleExcluded.kind is an optional string, so the snippet fails under strictNullChecks; use an allowed string such as "other".

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/typescript-fetch/builds/oneOf-not-enum/docs/MultipleExcluded.md, line 18:

<comment>This example assigns `null` to `kind`, but `MultipleExcluded.kind` is an optional `string`, so the snippet fails under `strictNullChecks`; use an allowed string such as `"other"`.</comment>

<file context>
@@ -0,0 +1,34 @@
+
+// TODO: Update the object below with actual values
+const example = {
+  "kind": null,
+} satisfies MultipleExcluded
+
</file context>
Suggested change
"kind": null,
"kind": "other",

} 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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This example uses a value that instanceOfNullableExcluded rejects; use an allowed value such as "other" so the documented instance passes the guard.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/typescript-fetch/builds/oneOf-not-enum/docs/NullableExcluded.md, line 18:

<comment>This example uses a value that `instanceOfNullableExcluded` rejects; use an allowed value such as `"other"` so the documented instance passes the guard.</comment>

<file context>
@@ -0,0 +1,34 @@
+
+// TODO: Update the object below with actual values
+const example = {
+  "kind": null,
+} satisfies NullableExcluded
+
</file context>
Suggested change
"kind": null,
"kind": "other",

} 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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This example does not satisfy Other when strictNullChecks is enabled because kind is declared as string. Use a valid string value such as "other".

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/typescript-fetch/builds/oneOf-not-enum/docs/Other.md, line 18:

<comment>This example does not satisfy `Other` when `strictNullChecks` is enabled because `kind` is declared as `string`. Use a valid string value such as `"other"`.</comment>

<file context>
@@ -0,0 +1,34 @@
+
+// TODO: Update the object below with actual values
+const example = {
+  "kind": null,
+} satisfies Other
+
</file context>
Suggested change
"kind": null,
"kind": "other",

} 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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This example does not type-check because filePath is declared as string. Use a valid string value, such as "".

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/typescript-fetch/builds/oneOf-not-enum/docs/SanitizedExcluded.md, line 18:

<comment>This example does not type-check because `filePath` is declared as `string`. Use a valid string value, such as `""`.</comment>

<file context>
@@ -0,0 +1,34 @@
+
+// TODO: Update the object below with actual values
+const example = {
+  "filePath": null,
+} satisfies SanitizedExcluded
+
</file context>

} 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)


Loading
Loading