adorn-api 1.0.13 → 1.0.15
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/adapter/express/auth.d.ts +8 -0
- package/dist/adapter/express/auth.d.ts.map +1 -1
- package/dist/adapter/express/bootstrap.d.ts +14 -1
- package/dist/adapter/express/bootstrap.d.ts.map +1 -1
- package/dist/adapter/express/coercion.d.ts +81 -1
- package/dist/adapter/express/coercion.d.ts.map +1 -1
- package/dist/adapter/express/index.d.ts +1 -0
- package/dist/adapter/express/index.d.ts.map +1 -1
- package/dist/adapter/express/merge.d.ts +17 -0
- package/dist/adapter/express/merge.d.ts.map +1 -1
- package/dist/adapter/express/openapi.d.ts +55 -0
- package/dist/adapter/express/openapi.d.ts.map +1 -1
- package/dist/adapter/express/router.d.ts +6 -0
- package/dist/adapter/express/router.d.ts.map +1 -1
- package/dist/adapter/express/swagger.d.ts +6 -0
- package/dist/adapter/express/swagger.d.ts.map +1 -1
- package/dist/adapter/express/types.d.ts +39 -0
- package/dist/adapter/express/types.d.ts.map +1 -1
- package/dist/adapter/express/validation.d.ts +19 -2
- package/dist/adapter/express/validation.d.ts.map +1 -1
- package/dist/cli.cjs +192 -11
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +192 -11
- package/dist/cli.js.map +1 -1
- package/dist/compiler/analyze/index.d.ts +5 -0
- package/dist/compiler/analyze/index.d.ts.map +1 -0
- package/dist/compiler/analyze/scanControllers.d.ts +52 -0
- package/dist/compiler/analyze/scanControllers.d.ts.map +1 -1
- package/dist/compiler/cache/isStale.d.ts +26 -0
- package/dist/compiler/cache/isStale.d.ts.map +1 -1
- package/dist/compiler/cache/loadArtifacts.d.ts +36 -0
- package/dist/compiler/cache/loadArtifacts.d.ts.map +1 -1
- package/dist/compiler/cache/schema.d.ts +14 -0
- package/dist/compiler/cache/schema.d.ts.map +1 -1
- package/dist/compiler/cache/writeCache.d.ts +6 -0
- package/dist/compiler/cache/writeCache.d.ts.map +1 -1
- package/dist/compiler/gems.d.ts +75 -0
- package/dist/compiler/gems.d.ts.map +1 -0
- package/dist/compiler/generator/index.d.ts +7 -0
- package/dist/compiler/generator/index.d.ts.map +1 -0
- package/dist/compiler/generator/manifest.d.ts +23 -0
- package/dist/compiler/generator/manifest.d.ts.map +1 -0
- package/dist/compiler/generator/openapi.d.ts +118 -0
- package/dist/compiler/generator/openapi.d.ts.map +1 -0
- package/dist/compiler/graph/builder.d.ts +24 -0
- package/dist/compiler/graph/builder.d.ts.map +1 -0
- package/dist/compiler/graph/index.d.ts +7 -0
- package/dist/compiler/graph/index.d.ts.map +1 -0
- package/dist/compiler/graph/schemaGraph.d.ts +67 -0
- package/dist/compiler/graph/schemaGraph.d.ts.map +1 -0
- package/dist/compiler/graph/types.d.ts +203 -0
- package/dist/compiler/graph/types.d.ts.map +1 -0
- package/dist/compiler/index.d.ts +12 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/ir/index.d.ts +7 -0
- package/dist/compiler/ir/index.d.ts.map +1 -0
- package/dist/compiler/ir/pipeline.d.ts +82 -0
- package/dist/compiler/ir/pipeline.d.ts.map +1 -0
- package/dist/compiler/ir/stages.d.ts +40 -0
- package/dist/compiler/ir/stages.d.ts.map +1 -0
- package/dist/compiler/ir/visitor.d.ts +98 -0
- package/dist/compiler/ir/visitor.d.ts.map +1 -0
- package/dist/compiler/manifest/emit.d.ts +14 -0
- package/dist/compiler/manifest/emit.d.ts.map +1 -1
- package/dist/compiler/manifest/format.d.ts +42 -0
- package/dist/compiler/manifest/format.d.ts.map +1 -1
- package/dist/compiler/manifest/index.d.ts +6 -0
- package/dist/compiler/manifest/index.d.ts.map +1 -0
- package/dist/compiler/runner/createProgram.d.ts +16 -0
- package/dist/compiler/runner/createProgram.d.ts.map +1 -1
- package/dist/compiler/runner/index.d.ts +5 -0
- package/dist/compiler/runner/index.d.ts.map +1 -0
- package/dist/compiler/schema/extractAnnotations.d.ts +47 -0
- package/dist/compiler/schema/extractAnnotations.d.ts.map +1 -1
- package/dist/compiler/schema/index.d.ts +6 -0
- package/dist/compiler/schema/index.d.ts.map +1 -0
- package/dist/compiler/schema/intersectionHandler.d.ts +37 -0
- package/dist/compiler/schema/intersectionHandler.d.ts.map +1 -1
- package/dist/compiler/schema/objectHandler.d.ts +86 -0
- package/dist/compiler/schema/objectHandler.d.ts.map +1 -1
- package/dist/compiler/schema/openapi.d.ts +15 -0
- package/dist/compiler/schema/openapi.d.ts.map +1 -1
- package/dist/compiler/schema/parameters.d.ts +72 -0
- package/dist/compiler/schema/parameters.d.ts.map +1 -1
- package/dist/compiler/schema/primitives.d.ts +58 -0
- package/dist/compiler/schema/primitives.d.ts.map +1 -1
- package/dist/compiler/schema/typeToJsonSchema.d.ts +20 -0
- package/dist/compiler/schema/typeToJsonSchema.d.ts.map +1 -1
- package/dist/compiler/schema/types.d.ts +15 -0
- package/dist/compiler/schema/types.d.ts.map +1 -1
- package/dist/compiler/schema/unionHandler.d.ts +60 -0
- package/dist/compiler/schema/unionHandler.d.ts.map +1 -1
- package/dist/compiler/transform/dedup.d.ts +35 -0
- package/dist/compiler/transform/dedup.d.ts.map +1 -0
- package/dist/compiler/transform/flatten.d.ts +50 -0
- package/dist/compiler/transform/flatten.d.ts.map +1 -0
- package/dist/compiler/transform/index.d.ts +7 -0
- package/dist/compiler/transform/index.d.ts.map +1 -0
- package/dist/compiler/transform/inline.d.ts +46 -0
- package/dist/compiler/transform/inline.d.ts.map +1 -0
- package/dist/compiler/validation/emitPrecompiledValidators.d.ts +16 -0
- package/dist/compiler/validation/emitPrecompiledValidators.d.ts.map +1 -1
- package/dist/compiler/validation/index.d.ts +5 -0
- package/dist/compiler/validation/index.d.ts.map +1 -0
- package/dist/decorators/Auth.d.ts +17 -0
- package/dist/decorators/Auth.d.ts.map +1 -1
- package/dist/decorators/Controller.d.ts +15 -0
- package/dist/decorators/Controller.d.ts.map +1 -1
- package/dist/decorators/Public.d.ts +13 -0
- package/dist/decorators/Public.d.ts.map +1 -1
- package/dist/decorators/Use.d.ts +18 -0
- package/dist/decorators/Use.d.ts.map +1 -1
- package/dist/decorators/methods.d.ts +20 -0
- package/dist/decorators/methods.d.ts.map +1 -1
- package/dist/express.cjs +71 -11
- package/dist/express.cjs.map +1 -1
- package/dist/express.d.ts +1 -0
- package/dist/express.d.ts.map +1 -1
- package/dist/express.js +71 -11
- package/dist/express.js.map +1 -1
- package/dist/index.cjs +160 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -2
- package/dist/index.js.map +1 -1
- package/dist/metal/applyListQuery.d.ts +73 -0
- package/dist/metal/applyListQuery.d.ts.map +1 -1
- package/dist/metal/index.cjs.map +1 -1
- package/dist/metal/index.d.ts +4 -0
- package/dist/metal/index.d.ts.map +1 -1
- package/dist/metal/index.js.map +1 -1
- package/dist/metal/listQuery.d.ts +19 -0
- package/dist/metal/listQuery.d.ts.map +1 -1
- package/dist/metal/queryOptions.d.ts +8 -0
- package/dist/metal/queryOptions.d.ts.map +1 -1
- package/dist/metal/readMetalBag.d.ts +36 -0
- package/dist/metal/readMetalBag.d.ts.map +1 -1
- package/dist/metal/registerMetalEntities.d.ts +20 -0
- package/dist/metal/registerMetalEntities.d.ts.map +1 -1
- package/dist/metal/schemaFromEntity.d.ts +30 -0
- package/dist/metal/schemaFromEntity.d.ts.map +1 -1
- package/dist/metal/searchWhere.d.ts +39 -0
- package/dist/metal/searchWhere.d.ts.map +1 -1
- package/dist/metal/symbolMetadata.d.ts +6 -0
- package/dist/metal/symbolMetadata.d.ts.map +1 -1
- package/dist/runtime/auth/runtime.d.ts +155 -6
- package/dist/runtime/auth/runtime.d.ts.map +1 -1
- package/dist/runtime/metadata/bucket.d.ts +1 -2
- package/dist/runtime/metadata/bucket.d.ts.map +1 -1
- package/dist/runtime/metadata/key.d.ts +1 -1
- package/dist/runtime/metadata/key.d.ts.map +1 -1
- package/dist/runtime/metadata/read.d.ts +1 -2
- package/dist/runtime/metadata/read.d.ts.map +1 -1
- package/dist/runtime/metadata/types.d.ts +74 -0
- package/dist/runtime/metadata/types.d.ts.map +1 -1
- package/dist/runtime/polyfill.d.ts +1 -1
- package/dist/runtime/polyfill.d.ts.map +1 -1
- package/dist/runtime/upload.d.ts +37 -0
- package/dist/runtime/upload.d.ts.map +1 -1
- package/dist/runtime/validation/ajv.d.ts +100 -0
- package/dist/runtime/validation/ajv.d.ts.map +1 -1
- package/dist/runtime/validation/index.d.ts +9 -0
- package/dist/runtime/validation/index.d.ts.map +1 -1
- package/dist/scripts/adorn-example.cjs +238 -6
- package/dist/scripts/adorn-example.cjs.map +1 -1
- package/dist/utils/port.d.ts +9 -0
- package/dist/utils/port.d.ts.map +1 -0
- package/package.json +3 -1
package/dist/cli.cjs
CHANGED
|
@@ -731,9 +731,6 @@ function handleObjectType(type, ctx, typeNode) {
|
|
|
731
731
|
if (isMetalOrmGeneric) {
|
|
732
732
|
return {};
|
|
733
733
|
}
|
|
734
|
-
if (components.has(typeName)) {
|
|
735
|
-
return { $ref: `#/components/schemas/${typeName}` };
|
|
736
|
-
}
|
|
737
734
|
if (typeStack.has(type)) {
|
|
738
735
|
return { $ref: `#/components/schemas/${typeName}` };
|
|
739
736
|
}
|
|
@@ -745,6 +742,11 @@ function handleObjectType(type, ctx, typeNode) {
|
|
|
745
742
|
const existing = components.get(typeName);
|
|
746
743
|
if (!existing) {
|
|
747
744
|
components.set(typeName, schema);
|
|
745
|
+
} else {
|
|
746
|
+
const merged = mergeSchemasIfNeeded(existing, schema);
|
|
747
|
+
if (merged !== existing) {
|
|
748
|
+
components.set(typeName, merged);
|
|
749
|
+
}
|
|
748
750
|
}
|
|
749
751
|
return { $ref: `#/components/schemas/${typeName}` };
|
|
750
752
|
}
|
|
@@ -838,6 +840,96 @@ function getExplicitTypeNameFromNode4(typeNode) {
|
|
|
838
840
|
}
|
|
839
841
|
return null;
|
|
840
842
|
}
|
|
843
|
+
function mergeSchemasIfNeeded(existing, newSchema) {
|
|
844
|
+
if (existing.type === "array" && newSchema.type === "array") {
|
|
845
|
+
return mergeArraySchemas(existing, newSchema);
|
|
846
|
+
}
|
|
847
|
+
const result = { ...existing };
|
|
848
|
+
for (const [key, newValue] of Object.entries(newSchema)) {
|
|
849
|
+
if (key === "properties" && newValue) {
|
|
850
|
+
result.properties = mergePropertiesIfNeeded(existing.properties || {}, newValue);
|
|
851
|
+
} else if (key === "required" && newValue) {
|
|
852
|
+
result.required = mergeRequiredFields(existing.required || [], newValue);
|
|
853
|
+
} else if (!deepEqual(existing[key], newValue)) {
|
|
854
|
+
result[key] = newValue;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
return result;
|
|
858
|
+
}
|
|
859
|
+
function mergePropertiesIfNeeded(existing, newProps) {
|
|
860
|
+
const result = { ...existing };
|
|
861
|
+
for (const [propName, newPropSchema] of Object.entries(newProps)) {
|
|
862
|
+
const existingProp = existing[propName];
|
|
863
|
+
if (!existingProp) {
|
|
864
|
+
result[propName] = newPropSchema;
|
|
865
|
+
} else if (deepEqual(existingProp, newPropSchema)) {
|
|
866
|
+
continue;
|
|
867
|
+
} else {
|
|
868
|
+
result[propName] = mergePropertySchemas(existingProp, newPropSchema);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
return result;
|
|
872
|
+
}
|
|
873
|
+
function mergePropertySchemas(schema1, schema2) {
|
|
874
|
+
if (deepEqual(schema1, schema2)) {
|
|
875
|
+
return schema1;
|
|
876
|
+
}
|
|
877
|
+
if (schema1.type === "array" && schema2.type === "array") {
|
|
878
|
+
return mergeArraySchemas(schema1, schema2);
|
|
879
|
+
}
|
|
880
|
+
const existingOneOf = schema1.oneOf || schema1.anyOf;
|
|
881
|
+
const newOneOf = schema2.oneOf || schema2.anyOf;
|
|
882
|
+
if (existingOneOf) {
|
|
883
|
+
const mergedOneOf = [...existingOneOf];
|
|
884
|
+
if (newOneOf) {
|
|
885
|
+
for (const newItem of newOneOf) {
|
|
886
|
+
if (!mergedOneOf.some((item) => deepEqual(item, newItem))) {
|
|
887
|
+
mergedOneOf.push(newItem);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
} else if (!mergedOneOf.some((item) => deepEqual(item, schema2))) {
|
|
891
|
+
mergedOneOf.push(schema2);
|
|
892
|
+
}
|
|
893
|
+
return { ...schema1, oneOf: mergedOneOf };
|
|
894
|
+
}
|
|
895
|
+
return {
|
|
896
|
+
oneOf: [schema1, schema2]
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
function mergeArraySchemas(schema1, schema2) {
|
|
900
|
+
const result = { type: "array" };
|
|
901
|
+
if (schema1.uniqueItems || schema2.uniqueItems) {
|
|
902
|
+
result.uniqueItems = true;
|
|
903
|
+
}
|
|
904
|
+
if (schema1.items && schema2.items) {
|
|
905
|
+
result.items = mergePropertySchemas(schema1.items, schema2.items);
|
|
906
|
+
} else if (schema1.items) {
|
|
907
|
+
result.items = schema1.items;
|
|
908
|
+
} else if (schema2.items) {
|
|
909
|
+
result.items = schema2.items;
|
|
910
|
+
}
|
|
911
|
+
return result;
|
|
912
|
+
}
|
|
913
|
+
function mergeRequiredFields(existing, newFields) {
|
|
914
|
+
const merged = /* @__PURE__ */ new Set([...existing, ...newFields]);
|
|
915
|
+
return Array.from(merged);
|
|
916
|
+
}
|
|
917
|
+
function deepEqual(a, b) {
|
|
918
|
+
if (a === b) return true;
|
|
919
|
+
if (a == null || b == null) return false;
|
|
920
|
+
if (typeof a !== typeof b) return false;
|
|
921
|
+
if (typeof a === "object") {
|
|
922
|
+
const aKeys = Object.keys(a);
|
|
923
|
+
const bKeys = Object.keys(b);
|
|
924
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
925
|
+
for (const key of aKeys) {
|
|
926
|
+
if (!bKeys.includes(key)) return false;
|
|
927
|
+
if (!deepEqual(a[key], b[key])) return false;
|
|
928
|
+
}
|
|
929
|
+
return true;
|
|
930
|
+
}
|
|
931
|
+
return false;
|
|
932
|
+
}
|
|
841
933
|
var METAL_ORM_WRAPPER_NAMES = ["HasManyCollection", "ManyToManyCollection", "BelongsToReference", "HasOneReference"];
|
|
842
934
|
function findMetalOrmWrapper(type, checker) {
|
|
843
935
|
if (type.isIntersection()) {
|
|
@@ -889,7 +981,27 @@ function handleMetalOrmWrapper(type, ctx) {
|
|
|
889
981
|
const wrapperName = getWrapperTypeName(type, ctx.checker);
|
|
890
982
|
if (!wrapperName) return {};
|
|
891
983
|
const wrapperRel = { wrapper: wrapperName };
|
|
984
|
+
if (!targetType) {
|
|
985
|
+
return { "x-metal-orm-rel": wrapperRel };
|
|
986
|
+
}
|
|
892
987
|
if (wrapperName === "HasManyCollection" || wrapperName === "ManyToManyCollection") {
|
|
988
|
+
if (ctx.typeStack.has(targetType)) {
|
|
989
|
+
const items2 = {
|
|
990
|
+
type: "object",
|
|
991
|
+
properties: {
|
|
992
|
+
id: { type: "integer" }
|
|
993
|
+
},
|
|
994
|
+
required: ["id"]
|
|
995
|
+
};
|
|
996
|
+
if (wrapperName === "ManyToManyCollection" && typeArgs?.[1]) {
|
|
997
|
+
wrapperRel.pivot = typeArgs[1];
|
|
998
|
+
}
|
|
999
|
+
return {
|
|
1000
|
+
type: "array",
|
|
1001
|
+
items: items2,
|
|
1002
|
+
"x-metal-orm-rel": wrapperRel
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
893
1005
|
const items = targetType ? typeToJsonSchema(targetType, ctx) : {};
|
|
894
1006
|
if (wrapperName === "ManyToManyCollection" && typeArgs?.[1]) {
|
|
895
1007
|
wrapperRel.pivot = typeArgs[1];
|
|
@@ -900,9 +1012,6 @@ function handleMetalOrmWrapper(type, ctx) {
|
|
|
900
1012
|
"x-metal-orm-rel": wrapperRel
|
|
901
1013
|
};
|
|
902
1014
|
}
|
|
903
|
-
if (!targetType) {
|
|
904
|
-
return { "x-metal-orm-rel": wrapperRel };
|
|
905
|
-
}
|
|
906
1015
|
if (wrapperName === "BelongsToReference" || wrapperName === "HasOneReference") {
|
|
907
1016
|
return handleBelongsToReference(targetType, ctx, wrapperRel);
|
|
908
1017
|
}
|
|
@@ -913,7 +1022,7 @@ function handleMetalOrmWrapper(type, ctx) {
|
|
|
913
1022
|
};
|
|
914
1023
|
}
|
|
915
1024
|
function handleBelongsToReference(targetType, ctx, wrapperRel) {
|
|
916
|
-
const { components } = ctx;
|
|
1025
|
+
const { components, typeStack } = ctx;
|
|
917
1026
|
const targetSymbol = targetType.getSymbol();
|
|
918
1027
|
const typeName = targetSymbol?.getName();
|
|
919
1028
|
if (!typeName) {
|
|
@@ -930,6 +1039,20 @@ function handleBelongsToReference(targetType, ctx, wrapperRel) {
|
|
|
930
1039
|
"x-metal-orm-rel": wrapperRel
|
|
931
1040
|
};
|
|
932
1041
|
}
|
|
1042
|
+
if (typeStack.has(targetType)) {
|
|
1043
|
+
const circularRefSchema = {
|
|
1044
|
+
type: "object",
|
|
1045
|
+
properties: {
|
|
1046
|
+
id: { type: "integer" }
|
|
1047
|
+
},
|
|
1048
|
+
required: ["id"]
|
|
1049
|
+
};
|
|
1050
|
+
components.set(refSchemaName, circularRefSchema);
|
|
1051
|
+
return {
|
|
1052
|
+
$ref: `#/components/schemas/${refSchemaName}`,
|
|
1053
|
+
"x-metal-orm-rel": wrapperRel
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
933
1056
|
const refSchema = buildRefSchema(targetType, ctx);
|
|
934
1057
|
components.set(refSchemaName, refSchema);
|
|
935
1058
|
return {
|
|
@@ -1199,10 +1322,20 @@ function buildQueryParameters(operation, ctx, parameters) {
|
|
|
1199
1322
|
const { properties: queryObjProps, required: queryRequired } = resolveAndCollectObjectProps(querySchema, ctx.components);
|
|
1200
1323
|
for (const [propName, propSchema] of Object.entries(queryObjProps)) {
|
|
1201
1324
|
const isRequired = queryRequired.includes(propName);
|
|
1325
|
+
const isDeepObject = isDeepObjectSchema(propSchema, ctx);
|
|
1202
1326
|
const isObjectLike = isObjectLikeSchema(propSchema, ctx);
|
|
1203
1327
|
const serialization = determineQuerySerialization(propSchema.type);
|
|
1204
1328
|
const exampleValue = generateExampleValue(propSchema, propName);
|
|
1205
|
-
if (
|
|
1329
|
+
if (isDeepObject) {
|
|
1330
|
+
parameters.push({
|
|
1331
|
+
name: propName,
|
|
1332
|
+
in: "query",
|
|
1333
|
+
required: isRequired,
|
|
1334
|
+
style: "deepObject",
|
|
1335
|
+
explode: true,
|
|
1336
|
+
schema: propSchema.$ref ? { $ref: propSchema.$ref } : propSchema
|
|
1337
|
+
});
|
|
1338
|
+
} else if (isObjectLike) {
|
|
1206
1339
|
const schemaRef = propSchema.$ref || "#/components/schemas/InlineQueryParam";
|
|
1207
1340
|
parameters.push({
|
|
1208
1341
|
name: propName,
|
|
@@ -1257,8 +1390,18 @@ function buildQueryParameters(operation, ctx, parameters) {
|
|
|
1257
1390
|
paramSchema = mergeFragments(paramSchema, ...frags);
|
|
1258
1391
|
}
|
|
1259
1392
|
}
|
|
1393
|
+
const isDeepObject = isDeepObjectSchema(paramSchema, ctx);
|
|
1260
1394
|
const isObjectLike = isObjectLikeSchema(paramSchema, ctx);
|
|
1261
|
-
if (
|
|
1395
|
+
if (isDeepObject) {
|
|
1396
|
+
parameters.push({
|
|
1397
|
+
name: param.name,
|
|
1398
|
+
in: "query",
|
|
1399
|
+
required: !param.isOptional,
|
|
1400
|
+
style: "deepObject",
|
|
1401
|
+
explode: true,
|
|
1402
|
+
schema: paramSchema.$ref ? { $ref: paramSchema.$ref } : paramSchema
|
|
1403
|
+
});
|
|
1404
|
+
} else if (isObjectLike) {
|
|
1262
1405
|
const schemaRef = paramSchema.$ref || "#/components/schemas/InlineQueryParam";
|
|
1263
1406
|
const exampleValue = generateExampleValue(paramSchema, param.name);
|
|
1264
1407
|
parameters.push({
|
|
@@ -1360,6 +1503,23 @@ function parseExampleValue(description) {
|
|
|
1360
1503
|
}
|
|
1361
1504
|
return JSON.stringify({ key: "value" });
|
|
1362
1505
|
}
|
|
1506
|
+
function isDeepObjectSchema(schema, ctx) {
|
|
1507
|
+
const resolved = resolveSchemaRef(schema, ctx.components);
|
|
1508
|
+
if (resolved.type === "array") {
|
|
1509
|
+
return false;
|
|
1510
|
+
}
|
|
1511
|
+
if (resolved.type === "object" || resolved.properties || resolved.additionalProperties) {
|
|
1512
|
+
return true;
|
|
1513
|
+
}
|
|
1514
|
+
if (resolved.allOf) {
|
|
1515
|
+
for (const branch of resolved.allOf) {
|
|
1516
|
+
if (isDeepObjectSchema(branch, ctx)) {
|
|
1517
|
+
return true;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
return false;
|
|
1522
|
+
}
|
|
1363
1523
|
function isObjectLikeSchema(schema, ctx) {
|
|
1364
1524
|
const resolved = resolveSchemaRef(schema, ctx.components);
|
|
1365
1525
|
if (resolved.type === "object" || resolved.properties || resolved.additionalProperties) {
|
|
@@ -1710,6 +1870,23 @@ function resolveAndCollectObjectProps2(schema, components) {
|
|
|
1710
1870
|
processSchema(resolved);
|
|
1711
1871
|
return { properties, required };
|
|
1712
1872
|
}
|
|
1873
|
+
function isDeepObjectSchema2(schema, components) {
|
|
1874
|
+
const resolved = resolveSchemaRef2(schema, components);
|
|
1875
|
+
if (resolved.type === "array") {
|
|
1876
|
+
return false;
|
|
1877
|
+
}
|
|
1878
|
+
if (resolved.type === "object" || resolved.properties || resolved.additionalProperties) {
|
|
1879
|
+
return true;
|
|
1880
|
+
}
|
|
1881
|
+
if (resolved.allOf) {
|
|
1882
|
+
for (const branch of resolved.allOf) {
|
|
1883
|
+
if (isDeepObjectSchema2(branch, components)) {
|
|
1884
|
+
return true;
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
return false;
|
|
1889
|
+
}
|
|
1713
1890
|
function isObjectLikeSchema2(schema, components) {
|
|
1714
1891
|
const resolved = resolveSchemaRef2(schema, components);
|
|
1715
1892
|
if (resolved.type === "object" || resolved.properties || resolved.additionalProperties) {
|
|
@@ -1806,6 +1983,7 @@ function buildQueryArgs(op, ctx, args) {
|
|
|
1806
1983
|
const { properties: queryObjProps, required: queryRequired } = resolveAndCollectObjectProps2(querySchema, ctx.components);
|
|
1807
1984
|
for (const [propName, propSchema] of Object.entries(queryObjProps)) {
|
|
1808
1985
|
const isRequired = queryRequired.includes(propName) ?? false;
|
|
1986
|
+
const isDeepObject = isDeepObjectSchema2(propSchema, ctx.components);
|
|
1809
1987
|
const isObjectLike = isObjectLikeSchema2(propSchema, ctx.components);
|
|
1810
1988
|
let schemaRef = propSchema.$ref;
|
|
1811
1989
|
if (!schemaRef) {
|
|
@@ -1817,7 +1995,8 @@ function buildQueryArgs(op, ctx, args) {
|
|
|
1817
1995
|
required: isRequired,
|
|
1818
1996
|
schemaRef,
|
|
1819
1997
|
schemaType: propSchema.type,
|
|
1820
|
-
|
|
1998
|
+
serialization: isDeepObject ? { style: "deepObject", explode: true } : void 0,
|
|
1999
|
+
content: !isDeepObject && isObjectLike ? "application/json" : void 0
|
|
1821
2000
|
});
|
|
1822
2001
|
}
|
|
1823
2002
|
}
|
|
@@ -1825,6 +2004,7 @@ function buildQueryArgs(op, ctx, args) {
|
|
|
1825
2004
|
const param = op.parameters[paramIndex];
|
|
1826
2005
|
if (param) {
|
|
1827
2006
|
const paramSchema = typeToJsonSchema(param.type, ctx);
|
|
2007
|
+
const isDeepObject = isDeepObjectSchema2(paramSchema, ctx.components);
|
|
1828
2008
|
const isObjectLike = isObjectLikeSchema2(paramSchema, ctx.components);
|
|
1829
2009
|
const schemaRef = paramSchema.$ref ?? "#/components/schemas/InlineQueryParam";
|
|
1830
2010
|
args.query.push({
|
|
@@ -1833,7 +2013,8 @@ function buildQueryArgs(op, ctx, args) {
|
|
|
1833
2013
|
required: !param.isOptional,
|
|
1834
2014
|
schemaRef,
|
|
1835
2015
|
schemaType: paramSchema.type,
|
|
1836
|
-
|
|
2016
|
+
serialization: isDeepObject ? { style: "deepObject", explode: true } : void 0,
|
|
2017
|
+
content: !isDeepObject && isObjectLike ? "application/json" : void 0
|
|
1837
2018
|
});
|
|
1838
2019
|
}
|
|
1839
2020
|
}
|