From dd7d1740ca7b47a5a2c95d18bb5a70f0fa879d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 14 Aug 2026 12:31:40 +0200 Subject: [PATCH] refactor(components): update nullable types to use oneOf for better clarity This change improves the schema definitions by replacing nullable types with oneOf, allowing for clearer API documentation and validation. --- documentation/OpenApi/openapi.yaml | 55 ++++++++++++++++++------------ 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/documentation/OpenApi/openapi.yaml b/documentation/OpenApi/openapi.yaml index f333c2c..b6d7dc1 100644 --- a/documentation/OpenApi/openapi.yaml +++ b/documentation/OpenApi/openapi.yaml @@ -769,18 +769,21 @@ components: preparationAdvices: type: string tips: - type: string - nullable: true + type: + - string + - 'null' example: Servir chaud sellFamilly: - type: string - nullable: true + type: + - string + - 'null' example: Volaille ingredients: $ref: '#/components/schemas/IncoIngredients' portions: - $ref: '#/components/schemas/IncoPortionAmount' - nullable: true + oneOf: + - $ref: '#/components/schemas/IncoPortionAmount' + - type: 'null' allergens: type: array items: @@ -790,29 +793,35 @@ components: isSeasonal: type: boolean weight: - $ref: '#/components/schemas/IncoWeight' - nullable: true + oneOf: + - $ref: '#/components/schemas/IncoWeight' + - type: 'null' nutriscore: - $ref: '#/components/schemas/IncoNutriscore' - nullable: true + oneOf: + - $ref: '#/components/schemas/IncoNutriscore' + - type: 'null' storageCondition: - $ref: '#/components/schemas/IncoStorageCondition' - nullable: true + oneOf: + - $ref: '#/components/schemas/IncoStorageCondition' + - type: 'null' additives: type: array items: $ref: '#/components/schemas/IncoAdditive' compo: - type: string - nullable: true + type: + - string + - 'null' pattern: '^\d{1,}$' createdAt: - type: string - nullable: true + type: + - string + - 'null' format: date-time updatedAt: - type: string - nullable: true + type: + - string + - 'null' format: date-time IncoWeight: @@ -966,12 +975,14 @@ components: type: string example: Poulet RĂ´ti Classe A createdAt: - type: string - nullable: true + type: + - string + - 'null' format: date-time updatedAt: - type: string - nullable: true + type: + - string + - 'null' format: date-time IncoCompo: