@@ -68,6 +68,8 @@ const csn = await cds.import.from.openapi(OpenAPI_JSON_file)
6868```
6969<br >
7070
71+ [ Learn more about OpenAPI to OData Mapping.] ( #openapi-to-cds-odata-csn-conversion-mapping ) {.learn-more}
72+
7173## cds.import.from.asyncapi() {.method}
7274
7375This API can be used to convert the AsyncAPI specification file (JSON) into CSN.
@@ -122,3 +124,32 @@ The following mapping is used during the import of an external service API, see
122124| _ Edm.DateTime<br >Precision : Second_ <sup >1</sup > | ` cds.DateTime ` + ` @odata.Type:'Edm.DateTime' ` + ` @odata.Precision:0 ` |
123125
124126<sup >1</sup > only OData V2
127+
128+ ## OpenAPI to CDS (OData CSN) Conversion Mapping
129+
130+ | ** OpenAPI** | ** OData Equivalent** |
131+ | ---------------------------------------------| --------------------------------------------------------------|
132+ | ` info.title ` | ` serviceName ` , ` @Core.Description ` |
133+ | ` info.version ` | ` @Core.SchemaVersion ` |
134+ | ` info.description ` | ` @Core.LongDescription ` |
135+ | ` paths.{path}.{method} ` | ` function ` (GET) or ` action ` (others) |
136+ | ` tags[0] ` | ` @Common.Label ` |
137+ | ` summary ` / ` description ` | ` @Core.Description ` , ` @Core.LongDescription ` |
138+ | ` parameters[].in ` | ` @openapi.in ` |
139+ | ` parameters[].name ` | Transformed param name + ` @openapi.name ` if needed |
140+ | ` parameters[].required ` | ` @openapi.required ` |
141+ | ` parameters[].style ` , ` explode ` , ` allowReserved ` | ` @openapi.style ` , ` @openapi.explode ` , ` @openapi.allowReserved ` |
142+ | ` parameters[].default ` | ` default: { val: ... } ` |
143+ | ` parameters[].description ` | ` @description ` |
144+ | ` requestBody.content.application/json.schema ` | ` params.body ` |
145+ | ` requestBody.$ref ` | Dereferenced and used |
146+ | ` responses["2XX"].content.application/json ` | ` returns ` |
147+ | ` $ref ` | ` type ` or ` includes ` |
148+ | ` components.schemas ` / ` definitions ` | Named ` types ` |
149+ | ` enum ` | ` enum ` , ` @assert.range ` |
150+ | ` format: date/time/uuid/binary ` | ` cds.Date ` , ` cds.Time ` , ` cds.Timestamp ` , ` cds.UUID ` , etc. |
151+ | ` pattern ` | ` @assert.format ` |
152+ | ` allOf ` , ` anyOf ` , ` oneOf ` | ` @openapi.allOf ` , ` @openapi.anyOf ` , ` @openapi.oneOf ` |
153+ | ` example ` / ` examples[0] ` | ` @Core.Example.Value ` |
154+ | ` type: object ` with ` properties ` | ` elements ` |
155+ | ` required ` (on properties) | ` @mandatory ` |
0 commit comments