Skip to content
Draft
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 36 additions & 36 deletions packages/documentation/src/app/overview/compatibility/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -244,42 +244,42 @@ openapi specification / json schema validation specifications.

Most notable exception is `readOnly` / `writeOnly` which are currently ignored, planned to be addressed prior to v1.

| Attribute | Supported | Notes |
|:---------------------|:---------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------|
| title | __N/A__ | |
| multipleOf | ✅ | Applies to `type: number` |
| maximum | ✅ | Applies to `type: number` |
| exclusiveMaximum | ✅ | Applies to `type: number` |
| minimum | ✅ | Applies to `type: number` |
| exclusiveMinimum | ✅ | Applies to `type: number` |
| maxLength | ✅ | Applies to `type: string` |
| minLength | ✅ | Applies to `type: string` |
| pattern | ✅ | Support for `type: string` |
| maxItems | ✅ | Applies to `type: array` |
| minItems | ✅ | Applies to `type: array` |
| uniqueItems | ✅ | Applies to `type: array` |
| maxProperties | 🚫 | Not yet supported |
| minProperties | 🚫 | Not yet supported |
| required | ✅ | Controls whether `undefined` is allowed for each value in `properties` |
| enum | ✅ | Applies to `type: number`, `type: string` and `type: boolean` |
| type | ✅ | |
| not | 🚫 | Not yet supported |
| allOf | ✅ | Produces a intersection type like `A & B` |
| oneOf | ✅ | Produces a union type like `A \| B` |
| anyOf | ✅ | Produces a union type like `A \| B` |
| items | ✅ | Applies to `type: array` |
| properties | ✅ | Applies to `type: object` |
| additionalProperties | ✅ | Fairly comprehensive support, produces `Record<string, T>` or `unknown`/`any` (dependent on [`--ts-allow-any`](../reference/cli-options#--ts-allow-any)) |
| format | ✅/🚧 | Limited support for format `email` and `date-time` |
| default | ✅ | |
| nullable | ✅ | Also supports `type: null` as an alternative |
| discriminator | 🚫 | Ignored. Union / Intersection types are usd based on `anyOf` / `allOf` / `oneOf`. |
| readOnly | 🚫 | Not yet supported |
| writeOnly | 🚫 | Not yet supported |
| example | __N/A__ | Ignored |
| externalDocs | __N/A__ | Ignored |
| deprecated | 🚫 | Not yet supported |
| xml | 🚫 | Not yet supported |
| Attribute | Supported | Notes |
|:---------------------|:---------:|:---------------------------------------------------------------------------------------------------------------------------|
| title | __N/A__ | |
| multipleOf | ✅ | Applies to `type: number` |
| maximum | ✅ | Applies to `type: number` |
| exclusiveMaximum | ✅ | Applies to `type: number` |
| minimum | ✅ | Applies to `type: number` |
| exclusiveMinimum | ✅ | Applies to `type: number` |
| maxLength | ✅ | Applies to `type: string` |
| minLength | ✅ | Applies to `type: string` |
| pattern | ✅ | Support for `type: string` |
| maxItems | ✅ | Applies to `type: array` |
| minItems | ✅ | Applies to `type: array` |
| uniqueItems | ✅ | Applies to `type: array` |
| maxProperties | 🚫 | Not yet supported |
| minProperties | 🚫 | Not yet supported |
| required | ✅ | Controls whether `undefined` is allowed for each value in `properties` |
| enum | ✅ | Applies to `type: number`, `type: string` and `type: boolean` |
| type | ✅ | |
| not | 🚫 | Not yet supported |
| allOf | ✅ | Produces a intersection type like `A & B` |
| oneOf | ✅ | Produces a union type like `A \| B` |
| anyOf | ✅ | Produces a union type like `A \| B` |
| items | ✅ | Applies to `type: array` |
| properties | ✅ | Applies to `type: object` |
| additionalProperties | ✅ | Produces `Record<string, T>` or `unknown`/`any` (dependent on [`--ts-allow-any`](../reference/cli-options#--ts-allow-any)) |
| format | ✅/🚧 | Limited support for format `binary`, `email` and `date-time` |
| default | ✅ | |
| nullable | ✅ | Also supports `type: null` as an alternative |
| discriminator | 🚫 | Ignored. Union / Intersection types are usd based on `anyOf` / `allOf` / `oneOf`. |
| readOnly | 🚫 | Not yet supported |
| writeOnly | 🚫 | Not yet supported |
| example | __N/A__ | Ignored |
| externalDocs | __N/A__ | Ignored |
| deprecated | 🚫 | Not yet supported |
| xml | 🚫 | Not yet supported |

### Encoding Object
| Attribute | Supported | Notes |
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-code-generator/src/core/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Input implements ISchemaProvider {
private loader: OpenapiLoader,
readonly config: InputConfig,
private readonly syntheticNameGenerator: SyntheticNameGenerator = defaultSyntheticNameGenerator,
private readonly schemaNormalizer = new SchemaNormalizer(config),
private readonly schemaNormalizer = new SchemaNormalizer(config, this),
private readonly parameterNormalizer = new ParameterNormalizer(
loader,
schemaNormalizer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {beforeEach, describe, expect, it, jest} from "@jest/globals"
import {FakeSchemaProvider} from "../../test/fake-schema-provider.ts"
import {irFixture as ir} from "../../test/ir-model.fixtures.test-utils.ts"
import type {OpenapiLoader} from "../loaders/openapi-loader.ts"
import type {Parameter} from "../openapi-types.ts"
Expand All @@ -8,6 +9,7 @@ import {SchemaNormalizer} from "./schema-normalizer.ts"

describe("ParameterNormalizer", () => {
let loader: jest.Mocked<OpenapiLoader>
let fakeSchemaProvider: FakeSchemaProvider
let schemaNormalizer: SchemaNormalizer
let parameterNormalizer: ParameterNormalizer

Expand All @@ -18,10 +20,15 @@ describe("ParameterNormalizer", () => {
addVirtualType: jest.fn(),
} as unknown as jest.Mocked<OpenapiLoader>

schemaNormalizer = new SchemaNormalizer({
extractInlineSchemas: true,
enumExtensibility: "open",
})
fakeSchemaProvider = new FakeSchemaProvider()

schemaNormalizer = new SchemaNormalizer(
{
extractInlineSchemas: true,
enumExtensibility: "open",
},
fakeSchemaProvider,
)

parameterNormalizer = new ParameterNormalizer(
loader,
Expand Down
Loading