-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): docs generation now preserves original model schema names. (#…
…5255) * fix(cli): docs generation now preserves original model schema names. * chore: update changelog * Add test cases & refine `getSchemaName`. * Update versions.yml. --------- Co-authored-by: eyw520 <eyw520@users.noreply.github.com>
- Loading branch information
Showing
28 changed files
with
43,312 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 13 additions & 5 deletions
18
packages/cli/api-importers/openapi/openapi-ir-parser/src/schema/utils/getSchemaName.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
import { camelCase, upperFirst } from "lodash-es"; | ||
import { replaceStartingNumber } from "./replaceStartingNumber"; | ||
|
||
export function getGeneratedTypeName(breadcrumbs: string[]): string { | ||
const underscoreDelimeted = breadcrumbs.join("_"); | ||
const name = upperFirst(camelCase(underscoreDelimeted)); | ||
export function getGeneratedTypeName(breadcrumbs: string[], useOriginalSchemaIds: boolean): string { | ||
const processedTokens = breadcrumbs.map((token) => { | ||
if (/^[^a-zA-Z0-9]+$/.test(token)) { | ||
return token; | ||
} else { | ||
return upperFirst(camelCase(token)); | ||
} | ||
}); | ||
|
||
const name = processedTokens.join(""); | ||
|
||
if (/^\d/.test(name)) { | ||
return replaceStartingNumber(name) ?? name; | ||
} | ||
return name; | ||
} | ||
|
||
export function getGeneratedPropertyName(breadcrumbs: string[]): string { | ||
const underscoreDelimeted = breadcrumbs.join("_"); | ||
return camelCase(underscoreDelimeted); | ||
const underscoreDelimited = breadcrumbs.join("_"); | ||
return camelCase(underscoreDelimited); | ||
} |
Oops, something went wrong.