Skip to content

Commit 1423d08

Browse files
authoredDec 14, 2023
Add option to configure generated schema item suffix (#1104)
* Add option to configure generated schema item suffix * Pass item suffix through other relevant functions * Reset all changes * Add itemSuffix to schema config
1 parent 92b0179 commit 1423d08

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed
 

‎packages/core/src/getters/array.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const getArray = ({
2020
if (schema.items) {
2121
const resolvedObject = resolveObject({
2222
schema: schema.items,
23-
propName: name + 'Item',
23+
propName: name + context.override.components.schemas.itemSuffix,
2424
context,
2525
});
2626
return {

‎packages/core/src/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export type NormalizedOverrideOutput = {
7979
components: {
8080
schemas: {
8181
suffix: string;
82+
itemSuffix: string;
8283
};
8384
responses: {
8485
suffix: string;
@@ -285,6 +286,7 @@ export type OverrideOutput = {
285286
components?: {
286287
schemas?: {
287288
suffix?: string;
289+
itemSuffix?: string;
288290
};
289291
responses?: {
290292
suffix?: string;

‎packages/orval/src/utils/options.ts

+2
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ export const normalizeOptions = async (
182182
components: {
183183
schemas: {
184184
suffix: RefComponentSuffix.schemas,
185+
itemSuffix:
186+
outputOptions.override?.components?.schemas?.itemSuffix ?? 'Item',
185187
...(outputOptions.override?.components?.schemas ?? {}),
186188
},
187189
responses: {

0 commit comments

Comments
 (0)
Please sign in to comment.