From f6f3f794023dd85a3320d2dd3a396c2a8598630a Mon Sep 17 00:00:00 2001 From: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:25:45 +1000 Subject: [PATCH] openapi3 import: handle path level descriptions (#939) --- .../bundles/assets/import_openapi_cli.arraiz | Bin 28596 -> 28691 bytes pkg/importer/openapi/simplify_oapi.arrai | 28 ++++++++++++++---- .../tests/openapi3/params-for-all.sysl | 2 +- .../tests/openapi3/params-for-all.yaml | 3 +- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/internal/bundles/assets/import_openapi_cli.arraiz b/internal/bundles/assets/import_openapi_cli.arraiz index 00d29b5ed7f648b0c35c9c2739580618a7e6764a..a7d7a6823f71141e724891ec452982c0f521da1e 100644 GIT binary patch delta 6523 zcmV->8HDDv-vN{00kG;he|=kX<2IJ?d;f})lB-32Vd!sOnb_UgTxwH0lTLMdX0|F$ z*^~%b=%xS$gzQ$y+TXr~gFA1M`Z7~fJ9w~p0dRnWbH^c66A4KnNVQ#(4Dvir;R-G< z_xDt;w~KtqH?+ zz0@t*%Zt6Oez;3B@B=SEiY+mNYAL&~$**c)QoJee5lndxfBSh;N`LG0I=%?s`NK|_@zZv}a(|`ZvhXU3mt7-y@8VQr2#toc7Q_6Ll zfn1Xvtjh-ijUY=>5w;{Cwl#r-Cbbkwmnx5_|(CLWGi4SQV%Q$|Q%fu7Nj1l#+4=eDRhnWeb#<2Dw3G z2ig_f@Uo#u5~@PT18^1HCP|^Hrs>zN_J)Xi;(JnqzFBZ7`39?~vgE7+{S5Z*sVe(J zp{AKd4{wX;77QRpT1hGeqZFc71H$3_j8*-h%HS!0 z3KCXsNTGX4=IUmiW<@5-=u>n1@*4K<$j$&d zWRrc|7I1ktVMrP z3X%2Ke=LLjA?-E$`dRN$qKP7ryh#-n%&n%iG=-~c$X`B`^_Bn^6%mUawSFhVy(;KJZbg}5W+n7@Q?e+qEgwt%F_UuK}OT{yI>$;HD_GCB|% zNjSW`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BGc1l{-)N{c*p;Gi67bj1^@v6|4>T@2)yeh zyMPz~0MT-j!5bX2@=_EV3cTwjyMPz~0MT-j5N?J7c~X-x9VU}7BoUL(ZZrZ*S(7mx xCX+BE36nH$H3H{elQA6?lYnnX0-9ozF&!0?fNvC&K4S`#{cjKkWN82Z001ChpKSmD diff --git a/pkg/importer/openapi/simplify_oapi.arrai b/pkg/importer/openapi/simplify_oapi.arrai index 0755207b9..ac1d1ee34 100644 --- a/pkg/importer/openapi/simplify_oapi.arrai +++ b/pkg/importer/openapi/simplify_oapi.arrai @@ -26,7 +26,6 @@ let singleSyslStrTag = \tag {'patterns': (a: (elt: [(s: tag)]))}; let schemaSyslTag = \tag {syslAttrs: singleSyslStrTag(tag)}; # FIXME: handle content type on paths, they have precedence rule (e.g. text/* > text/plain) -# FIXME: handle non verbs in path # simplifiedParams moves top level parameters from a path and move it into all operation objects in a path. let simplifiedParams = \oapi @@ -50,12 +49,31 @@ let simplifiedParams = \oapi (nested(top) +> nested(bottom)) => .@value orderby ., } ; + let mergeDesc = \top \bottom + cond { + bottom = '': top, + _: bottom, + } + ; oapi +> { - 'paths': oapi('paths')?:{} >> cond . { - {'parameters': top, ...verbs}: verbs >> . +> {'parameters': (a: mergeParams(top.a, .('parameters')?.a?:{}))}, - _: ., - } + 'paths': oapi('paths')?:{} >> + cond . { + {'parameters': commonParams, ...verbs}: + verbs => cond { + .@ <: httpVerbs: (:.@, @value: .@value +> {'parameters': (a: mergeParams(commonParams.a, .@value('parameters')?.a?:{}))}), + _: ., + }, + _: ., + } >> + cond . { + {'description': commonDesc, ...verbs}: + verbs => cond { + .@ <: httpVerbs: (:.@, @value: .@value +> {'description': (s: mergeDesc(commonDesc.s, .@value('description')?.s?:''))}), + _: ., + }, + _: ., + } where .@ !<: {'parameters', 'description'} } ; diff --git a/pkg/importer/tests/openapi3/params-for-all.sysl b/pkg/importer/tests/openapi3/params-for-all.sysl index 85c97f3c3..fd35b71f4 100755 --- a/pkg/importer/tests/openapi3/params-for-all.sysl +++ b/pkg/importer/tests/openapi3/params-for-all.sysl @@ -12,5 +12,5 @@ TestApp "Params For All Operations": | has existing parameters return 200 POST?name=string?&special%2Dcharacter=string?: - | Empty parameters + | Common description return 200 diff --git a/pkg/importer/tests/openapi3/params-for-all.yaml b/pkg/importer/tests/openapi3/params-for-all.yaml index a7a7d4086..b43aacf78 100644 --- a/pkg/importer/tests/openapi3/params-for-all.yaml +++ b/pkg/importer/tests/openapi3/params-for-all.yaml @@ -3,6 +3,7 @@ info: title: Params For All Operations paths: /param/{id}: + description: Common description parameters: - $ref: "#/components/parameters/name" - name: id @@ -14,7 +15,7 @@ paths: type: string in: query post: - description: Empty parameters + # no parameters or description responses: "200": description: "OK"