Skip to content

Commit

Permalink
fix(cli): api v2 configuration supports disabling titles as schema na…
Browse files Browse the repository at this point in the history
…mes (#4704)
  • Loading branch information
dsinghvi authored Sep 19, 2024
1 parent dd98790 commit 5677789
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions packages/cli/cli/versions.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
- changelogEntry:
- summary: |
The API V2 configuration now supports disabling using titles as schema
names. You may want to disable this flag if your OpenAPI adds the same
title to multiple schemas.
```
api:
specs:
- openapi: /path/to/openapi
settings:
use-title-as-schema-name: false
```
type: fix
irVersion: 53
version: 0.42.11

- changelogEntry:
- summary: |
Previously, the OpenAPI converter would bring over `title` on every
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ async function parseApiConfigurationV2Schema({
overrides: spec.overrides,
audiences: [],
settings: {
shouldUseTitleAsName: undefined,
shouldUseTitleAsName: spec.settings?.["title-as-schema-name"],
shouldUseUndiscriminatedUnionsWithLiterals: undefined,
asyncApiMessageNaming: undefined,
shouldUseOptionalAdditionalProperties: spec.settings?.["optional-additional-properties"] ?? true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { RawSchemas } from "@fern-api/fern-definition-schema";
/*********** OpenAPI Spec ***********/

export const OpenAPISettingsSchema = z.strictObject({
"title-as-schema-name": z.optional(z.boolean()),
"optional-additional-properties": z.optional(z.boolean())
});

Expand All @@ -21,6 +22,7 @@ export type OpenAPISpecSchema = z.infer<typeof OpenAPISpecSchema>;
/*********** AsyncAPI Spec ***********/

export const AsyncAPISettingsSchema = z.strictObject({
"title-as-schema-name": z.optional(z.boolean()),
"optional-additional-properties": z.optional(z.boolean())
});

Expand Down

0 comments on commit 5677789

Please sign in to comment.