@voxgig/apidef 8.33.2 → 8.33.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/parse.d.ts +2 -1
- package/dist/parse.js +41 -1
- package/dist/parse.js.map +1 -1
- package/dist/resolved.js +4 -2
- package/dist/resolved.js.map +1 -1
- package/dist/transform/args.js +1 -1
- package/dist/transform/args.js.map +1 -1
- package/dist/transform/entity.js +1 -1
- package/dist/transform/entity.js.map +1 -1
- package/dist/transform/field.js +3 -2
- package/dist/transform/field.js.map +1 -1
- package/dist/transform/top.js +8 -0
- package/dist/transform/top.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utility.d.ts +3 -1
- package/dist/utility.js +29 -0
- package/dist/utility.js.map +1 -1
- package/package.json +1 -1
- package/src/parse.ts +41 -1
- package/src/resolved.ts +5 -2
- package/src/transform/args.ts +2 -1
- package/src/transform/entity.ts +2 -2
- package/src/transform/field.ts +3 -2
- package/src/transform/top.ts +10 -1
- package/src/utility.ts +30 -0
package/src/utility.ts
CHANGED
|
@@ -2773,7 +2773,37 @@ function firstSentence(text: string): string {
|
|
|
2773
2773
|
}
|
|
2774
2774
|
|
|
2775
2775
|
|
|
2776
|
+
// The identity OpenAPI gives a parameter: its location and name.
|
|
2777
|
+
function paramKey(param: any): string | undefined {
|
|
2778
|
+
if (null == param || 'object' !== typeof param || 'string' !== typeof param.in || 'string' !== typeof param.name) return undefined
|
|
2779
|
+
return param.in + '\u0000' + ('header' === param.in ? param.name.toLowerCase() : param.name)
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2782
|
+
|
|
2783
|
+
// A route's parameters: the path item's, each replaced by the operation's own
|
|
2784
|
+
// declaration of the same location and name, then the operation's others.
|
|
2785
|
+
function routeParams(pathItem: any, op: any): any[] {
|
|
2786
|
+
const own: any[] = Array.isArray(op?.parameters) ? op.parameters : []
|
|
2787
|
+
const byKey = new Map<string, any>()
|
|
2788
|
+
for (const param of own) {
|
|
2789
|
+
const key = paramKey(param)
|
|
2790
|
+
if (null != key && !byKey.has(key)) byKey.set(key, param)
|
|
2791
|
+
}
|
|
2792
|
+
const used = new Set<any>()
|
|
2793
|
+
const shared = (Array.isArray(pathItem?.parameters) ? pathItem.parameters : []).map((param: any) => {
|
|
2794
|
+
const key = paramKey(param)
|
|
2795
|
+
const mine = null == key ? undefined : byKey.get(key)
|
|
2796
|
+
if (null == mine) return param
|
|
2797
|
+
used.add(mine)
|
|
2798
|
+
return mine
|
|
2799
|
+
})
|
|
2800
|
+
return [...shared, ...own.filter((param) => !used.has(param))]
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
|
|
2776
2804
|
export {
|
|
2805
|
+
paramKey,
|
|
2806
|
+
routeParams,
|
|
2777
2807
|
bodyRequestTransform,
|
|
2778
2808
|
nom,
|
|
2779
2809
|
getdlog,
|