From 71e74f63b3727f14a448743d0a2a2e5e170f7f14 Mon Sep 17 00:00:00 2001 From: Miron Balcerzak Date: Sat, 16 Nov 2024 21:42:18 +0100 Subject: [PATCH] orval/core - ignore "readonly" props --- packages/core/src/getters/object.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/getters/object.ts b/packages/core/src/getters/object.ts index 01e3f1d77..b5e8ae2db 100644 --- a/packages/core/src/getters/object.ts +++ b/packages/core/src/getters/object.ts @@ -123,7 +123,9 @@ export const getObject = ({ acc.hasReadonlyProps ||= isReadOnly || false; acc.imports.push(...resolvedValue.imports); - acc.factoryMethodValue += `\n ${getKey(key)}: ${resolvedValue.factoryMethodValue},`; + if (!isReadOnly || isRequired) { + acc.factoryMethodValue += `\n ${getKey(key)}: ${resolvedValue.factoryMethodValue},`; + } acc.value += `\n ${doc ? `${doc} ` : ''}${ isReadOnly && !context.output.override.suppressReadonlyModifier ? 'readonly '