From ff535a0e292b499c040fff43b0bafe30727950c1 Mon Sep 17 00:00:00 2001 From: lnash94 Date: Tue, 19 Nov 2024 13:54:16 +0530 Subject: [PATCH] Update spec with the new all of changes --- docs/ballerina-to-oas/spec/spec.md | 49 +++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/docs/ballerina-to-oas/spec/spec.md b/docs/ballerina-to-oas/spec/spec.md index b8c36ad6b..56d8a7d3b 100644 --- a/docs/ballerina-to-oas/spec/spec.md +++ b/docs/ballerina-to-oas/spec/spec.md @@ -1185,7 +1185,9 @@ oneOf: -> **Note:** If any field in the record type has a `jsondata:Name` annotation, the name specified in the annotation will be used as the schema name. +> **Note:** +> 1. If any field in the record type has a `jsondata:Name` annotation, the name specified in the annotation will be +> used as the schema name. > > Ballerina record type: > ```ballerina @@ -1214,6 +1216,51 @@ oneOf: > type: string > additionalProperties: false > ``` +> 2. If we have a record defined in a separate package, for example, packageA: +> ```ballerina +> type RecA record {| +> int a = 10; +> string c = "c"; +>|}; +> +> ``` +> and it is included in packageB: +>```ballerina +> type RecB record {| +> *packageA:RecA; +> string b = "c"; +>|}; +>``` +> In the OpenAPI Specification (OAS) mapping for `RecB`, the default value access API cannot retrieve default values +> from another package. To address this, we generate all the fields explicitly for `RecB` to ensure accessibility. +> ```yaml +> RecA: +> type: object +> properties: +> a: +> type: integer +> default: 10 +> c: +> type: string +> default: c +> additionalProperties: false +> RecB: +> type: object +> allOf: +> - $ref: '#/components/schemas/RecA' +> - required: +> - b +> type: object +> properties: +> b: +> type: integer +> format: int64 +> a: +> type: integer +> c: +> type: string +> additionalProperties: false +``` ### Ballerina constraints mapping to type schema