Skip to content

Commit

Permalink
Add option to configure generated schema item suffix (#1104)
Browse files Browse the repository at this point in the history
* Add option to configure generated schema item suffix

* Pass item suffix through other relevant functions

* Reset all changes

* Add itemSuffix to schema config
  • Loading branch information
dawsonbooth authored Dec 14, 2023
1 parent 92b0179 commit 1423d08
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/getters/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const getArray = ({
if (schema.items) {
const resolvedObject = resolveObject({
schema: schema.items,
propName: name + 'Item',
propName: name + context.override.components.schemas.itemSuffix,
context,
});
return {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export type NormalizedOverrideOutput = {
components: {
schemas: {
suffix: string;
itemSuffix: string;
};
responses: {
suffix: string;
Expand Down Expand Up @@ -285,6 +286,7 @@ export type OverrideOutput = {
components?: {
schemas?: {
suffix?: string;
itemSuffix?: string;
};
responses?: {
suffix?: string;
Expand Down
2 changes: 2 additions & 0 deletions packages/orval/src/utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ export const normalizeOptions = async (
components: {
schemas: {
suffix: RefComponentSuffix.schemas,
itemSuffix:
outputOptions.override?.components?.schemas?.itemSuffix ?? 'Item',
...(outputOptions.override?.components?.schemas ?? {}),
},
responses: {
Expand Down

0 comments on commit 1423d08

Please sign in to comment.