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.js
CHANGED
|
@@ -714,9 +714,6 @@ function handleObjectType(type, ctx, typeNode) {
|
|
|
714
714
|
if (isMetalOrmGeneric) {
|
|
715
715
|
return {};
|
|
716
716
|
}
|
|
717
|
-
if (components.has(typeName)) {
|
|
718
|
-
return { $ref: `#/components/schemas/${typeName}` };
|
|
719
|
-
}
|
|
720
717
|
if (typeStack.has(type)) {
|
|
721
718
|
return { $ref: `#/components/schemas/${typeName}` };
|
|
722
719
|
}
|
|
@@ -728,6 +725,11 @@ function handleObjectType(type, ctx, typeNode) {
|
|
|
728
725
|
const existing = components.get(typeName);
|
|
729
726
|
if (!existing) {
|
|
730
727
|
components.set(typeName, schema);
|
|
728
|
+
} else {
|
|
729
|
+
const merged = mergeSchemasIfNeeded(existing, schema);
|
|
730
|
+
if (merged !== existing) {
|
|
731
|
+
components.set(typeName, merged);
|
|
732
|
+
}
|
|
731
733
|
}
|
|
732
734
|
return { $ref: `#/components/schemas/${typeName}` };
|
|
733
735
|
}
|
|
@@ -821,6 +823,96 @@ function getExplicitTypeNameFromNode4(typeNode) {
|
|
|
821
823
|
}
|
|
822
824
|
return null;
|
|
823
825
|
}
|
|
826
|
+
function mergeSchemasIfNeeded(existing, newSchema) {
|
|
827
|
+
if (existing.type === "array" && newSchema.type === "array") {
|
|
828
|
+
return mergeArraySchemas(existing, newSchema);
|
|
829
|
+
}
|
|
830
|
+
const result = { ...existing };
|
|
831
|
+
for (const [key, newValue] of Object.entries(newSchema)) {
|
|
832
|
+
if (key === "properties" && newValue) {
|
|
833
|
+
result.properties = mergePropertiesIfNeeded(existing.properties || {}, newValue);
|
|
834
|
+
} else if (key === "required" && newValue) {
|
|
835
|
+
result.required = mergeRequiredFields(existing.required || [], newValue);
|
|
836
|
+
} else if (!deepEqual(existing[key], newValue)) {
|
|
837
|
+
result[key] = newValue;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
return result;
|
|
841
|
+
}
|
|
842
|
+
function mergePropertiesIfNeeded(existing, newProps) {
|
|
843
|
+
const result = { ...existing };
|
|
844
|
+
for (const [propName, newPropSchema] of Object.entries(newProps)) {
|
|
845
|
+
const existingProp = existing[propName];
|
|
846
|
+
if (!existingProp) {
|
|
847
|
+
result[propName] = newPropSchema;
|
|
848
|
+
} else if (deepEqual(existingProp, newPropSchema)) {
|
|
849
|
+
continue;
|
|
850
|
+
} else {
|
|
851
|
+
result[propName] = mergePropertySchemas(existingProp, newPropSchema);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
return result;
|
|
855
|
+
}
|
|
856
|
+
function mergePropertySchemas(schema1, schema2) {
|
|
857
|
+
if (deepEqual(schema1, schema2)) {
|
|
858
|
+
return schema1;
|
|
859
|
+
}
|
|
860
|
+
if (schema1.type === "array" && schema2.type === "array") {
|
|
861
|
+
return mergeArraySchemas(schema1, schema2);
|
|
862
|
+
}
|
|
863
|
+
const existingOneOf = schema1.oneOf || schema1.anyOf;
|
|
864
|
+
const newOneOf = schema2.oneOf || schema2.anyOf;
|
|
865
|
+
if (existingOneOf) {
|
|
866
|
+
const mergedOneOf = [...existingOneOf];
|
|
867
|
+
if (newOneOf) {
|
|
868
|
+
for (const newItem of newOneOf) {
|
|
869
|
+
if (!mergedOneOf.some((item) => deepEqual(item, newItem))) {
|
|
870
|
+
mergedOneOf.push(newItem);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
} else if (!mergedOneOf.some((item) => deepEqual(item, schema2))) {
|
|
874
|
+
mergedOneOf.push(schema2);
|
|
875
|
+
}
|
|
876
|
+
return { ...schema1, oneOf: mergedOneOf };
|
|
877
|
+
}
|
|
878
|
+
return {
|
|
879
|
+
oneOf: [schema1, schema2]
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
function mergeArraySchemas(schema1, schema2) {
|
|
883
|
+
const result = { type: "array" };
|
|
884
|
+
if (schema1.uniqueItems || schema2.uniqueItems) {
|
|
885
|
+
result.uniqueItems = true;
|
|
886
|
+
}
|
|
887
|
+
if (schema1.items && schema2.items) {
|
|
888
|
+
result.items = mergePropertySchemas(schema1.items, schema2.items);
|
|
889
|
+
} else if (schema1.items) {
|
|
890
|
+
result.items = schema1.items;
|
|
891
|
+
} else if (schema2.items) {
|
|
892
|
+
result.items = schema2.items;
|
|
893
|
+
}
|
|
894
|
+
return result;
|
|
895
|
+
}
|
|
896
|
+
function mergeRequiredFields(existing, newFields) {
|
|
897
|
+
const merged = /* @__PURE__ */ new Set([...existing, ...newFields]);
|
|
898
|
+
return Array.from(merged);
|
|
899
|
+
}
|
|
900
|
+
function deepEqual(a, b) {
|
|
901
|
+
if (a === b) return true;
|
|
902
|
+
if (a == null || b == null) return false;
|
|
903
|
+
if (typeof a !== typeof b) return false;
|
|
904
|
+
if (typeof a === "object") {
|
|
905
|
+
const aKeys = Object.keys(a);
|
|
906
|
+
const bKeys = Object.keys(b);
|
|
907
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
908
|
+
for (const key of aKeys) {
|
|
909
|
+
if (!bKeys.includes(key)) return false;
|
|
910
|
+
if (!deepEqual(a[key], b[key])) return false;
|
|
911
|
+
}
|
|
912
|
+
return true;
|
|
913
|
+
}
|
|
914
|
+
return false;
|
|
915
|
+
}
|
|
824
916
|
var METAL_ORM_WRAPPER_NAMES = ["HasManyCollection", "ManyToManyCollection", "BelongsToReference", "HasOneReference"];
|
|
825
917
|
function findMetalOrmWrapper(type, checker) {
|
|
826
918
|
if (type.isIntersection()) {
|
|
@@ -872,7 +964,27 @@ function handleMetalOrmWrapper(type, ctx) {
|
|
|
872
964
|
const wrapperName = getWrapperTypeName(type, ctx.checker);
|
|
873
965
|
if (!wrapperName) return {};
|
|
874
966
|
const wrapperRel = { wrapper: wrapperName };
|
|
967
|
+
if (!targetType) {
|
|
968
|
+
return { "x-metal-orm-rel": wrapperRel };
|
|
969
|
+
}
|
|
875
970
|
if (wrapperName === "HasManyCollection" || wrapperName === "ManyToManyCollection") {
|
|
971
|
+
if (ctx.typeStack.has(targetType)) {
|
|
972
|
+
const items2 = {
|
|
973
|
+
type: "object",
|
|
974
|
+
properties: {
|
|
975
|
+
id: { type: "integer" }
|
|
976
|
+
},
|
|
977
|
+
required: ["id"]
|
|
978
|
+
};
|
|
979
|
+
if (wrapperName === "ManyToManyCollection" && typeArgs?.[1]) {
|
|
980
|
+
wrapperRel.pivot = typeArgs[1];
|
|
981
|
+
}
|
|
982
|
+
return {
|
|
983
|
+
type: "array",
|
|
984
|
+
items: items2,
|
|
985
|
+
"x-metal-orm-rel": wrapperRel
|
|
986
|
+
};
|
|
987
|
+
}
|
|
876
988
|
const items = targetType ? typeToJsonSchema(targetType, ctx) : {};
|
|
877
989
|
if (wrapperName === "ManyToManyCollection" && typeArgs?.[1]) {
|
|
878
990
|
wrapperRel.pivot = typeArgs[1];
|
|
@@ -883,9 +995,6 @@ function handleMetalOrmWrapper(type, ctx) {
|
|
|
883
995
|
"x-metal-orm-rel": wrapperRel
|
|
884
996
|
};
|
|
885
997
|
}
|
|
886
|
-
if (!targetType) {
|
|
887
|
-
return { "x-metal-orm-rel": wrapperRel };
|
|
888
|
-
}
|
|
889
998
|
if (wrapperName === "BelongsToReference" || wrapperName === "HasOneReference") {
|
|
890
999
|
return handleBelongsToReference(targetType, ctx, wrapperRel);
|
|
891
1000
|
}
|
|
@@ -896,7 +1005,7 @@ function handleMetalOrmWrapper(type, ctx) {
|
|
|
896
1005
|
};
|
|
897
1006
|
}
|
|
898
1007
|
function handleBelongsToReference(targetType, ctx, wrapperRel) {
|
|
899
|
-
const { components } = ctx;
|
|
1008
|
+
const { components, typeStack } = ctx;
|
|
900
1009
|
const targetSymbol = targetType.getSymbol();
|
|
901
1010
|
const typeName = targetSymbol?.getName();
|
|
902
1011
|
if (!typeName) {
|
|
@@ -913,6 +1022,20 @@ function handleBelongsToReference(targetType, ctx, wrapperRel) {
|
|
|
913
1022
|
"x-metal-orm-rel": wrapperRel
|
|
914
1023
|
};
|
|
915
1024
|
}
|
|
1025
|
+
if (typeStack.has(targetType)) {
|
|
1026
|
+
const circularRefSchema = {
|
|
1027
|
+
type: "object",
|
|
1028
|
+
properties: {
|
|
1029
|
+
id: { type: "integer" }
|
|
1030
|
+
},
|
|
1031
|
+
required: ["id"]
|
|
1032
|
+
};
|
|
1033
|
+
components.set(refSchemaName, circularRefSchema);
|
|
1034
|
+
return {
|
|
1035
|
+
$ref: `#/components/schemas/${refSchemaName}`,
|
|
1036
|
+
"x-metal-orm-rel": wrapperRel
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
916
1039
|
const refSchema = buildRefSchema(targetType, ctx);
|
|
917
1040
|
components.set(refSchemaName, refSchema);
|
|
918
1041
|
return {
|
|
@@ -1182,10 +1305,20 @@ function buildQueryParameters(operation, ctx, parameters) {
|
|
|
1182
1305
|
const { properties: queryObjProps, required: queryRequired } = resolveAndCollectObjectProps(querySchema, ctx.components);
|
|
1183
1306
|
for (const [propName, propSchema] of Object.entries(queryObjProps)) {
|
|
1184
1307
|
const isRequired = queryRequired.includes(propName);
|
|
1308
|
+
const isDeepObject = isDeepObjectSchema(propSchema, ctx);
|
|
1185
1309
|
const isObjectLike = isObjectLikeSchema(propSchema, ctx);
|
|
1186
1310
|
const serialization = determineQuerySerialization(propSchema.type);
|
|
1187
1311
|
const exampleValue = generateExampleValue(propSchema, propName);
|
|
1188
|
-
if (
|
|
1312
|
+
if (isDeepObject) {
|
|
1313
|
+
parameters.push({
|
|
1314
|
+
name: propName,
|
|
1315
|
+
in: "query",
|
|
1316
|
+
required: isRequired,
|
|
1317
|
+
style: "deepObject",
|
|
1318
|
+
explode: true,
|
|
1319
|
+
schema: propSchema.$ref ? { $ref: propSchema.$ref } : propSchema
|
|
1320
|
+
});
|
|
1321
|
+
} else if (isObjectLike) {
|
|
1189
1322
|
const schemaRef = propSchema.$ref || "#/components/schemas/InlineQueryParam";
|
|
1190
1323
|
parameters.push({
|
|
1191
1324
|
name: propName,
|
|
@@ -1240,8 +1373,18 @@ function buildQueryParameters(operation, ctx, parameters) {
|
|
|
1240
1373
|
paramSchema = mergeFragments(paramSchema, ...frags);
|
|
1241
1374
|
}
|
|
1242
1375
|
}
|
|
1376
|
+
const isDeepObject = isDeepObjectSchema(paramSchema, ctx);
|
|
1243
1377
|
const isObjectLike = isObjectLikeSchema(paramSchema, ctx);
|
|
1244
|
-
if (
|
|
1378
|
+
if (isDeepObject) {
|
|
1379
|
+
parameters.push({
|
|
1380
|
+
name: param.name,
|
|
1381
|
+
in: "query",
|
|
1382
|
+
required: !param.isOptional,
|
|
1383
|
+
style: "deepObject",
|
|
1384
|
+
explode: true,
|
|
1385
|
+
schema: paramSchema.$ref ? { $ref: paramSchema.$ref } : paramSchema
|
|
1386
|
+
});
|
|
1387
|
+
} else if (isObjectLike) {
|
|
1245
1388
|
const schemaRef = paramSchema.$ref || "#/components/schemas/InlineQueryParam";
|
|
1246
1389
|
const exampleValue = generateExampleValue(paramSchema, param.name);
|
|
1247
1390
|
parameters.push({
|
|
@@ -1343,6 +1486,23 @@ function parseExampleValue(description) {
|
|
|
1343
1486
|
}
|
|
1344
1487
|
return JSON.stringify({ key: "value" });
|
|
1345
1488
|
}
|
|
1489
|
+
function isDeepObjectSchema(schema, ctx) {
|
|
1490
|
+
const resolved = resolveSchemaRef(schema, ctx.components);
|
|
1491
|
+
if (resolved.type === "array") {
|
|
1492
|
+
return false;
|
|
1493
|
+
}
|
|
1494
|
+
if (resolved.type === "object" || resolved.properties || resolved.additionalProperties) {
|
|
1495
|
+
return true;
|
|
1496
|
+
}
|
|
1497
|
+
if (resolved.allOf) {
|
|
1498
|
+
for (const branch of resolved.allOf) {
|
|
1499
|
+
if (isDeepObjectSchema(branch, ctx)) {
|
|
1500
|
+
return true;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
return false;
|
|
1505
|
+
}
|
|
1346
1506
|
function isObjectLikeSchema(schema, ctx) {
|
|
1347
1507
|
const resolved = resolveSchemaRef(schema, ctx.components);
|
|
1348
1508
|
if (resolved.type === "object" || resolved.properties || resolved.additionalProperties) {
|
|
@@ -1693,6 +1853,23 @@ function resolveAndCollectObjectProps2(schema, components) {
|
|
|
1693
1853
|
processSchema(resolved);
|
|
1694
1854
|
return { properties, required };
|
|
1695
1855
|
}
|
|
1856
|
+
function isDeepObjectSchema2(schema, components) {
|
|
1857
|
+
const resolved = resolveSchemaRef2(schema, components);
|
|
1858
|
+
if (resolved.type === "array") {
|
|
1859
|
+
return false;
|
|
1860
|
+
}
|
|
1861
|
+
if (resolved.type === "object" || resolved.properties || resolved.additionalProperties) {
|
|
1862
|
+
return true;
|
|
1863
|
+
}
|
|
1864
|
+
if (resolved.allOf) {
|
|
1865
|
+
for (const branch of resolved.allOf) {
|
|
1866
|
+
if (isDeepObjectSchema2(branch, components)) {
|
|
1867
|
+
return true;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
return false;
|
|
1872
|
+
}
|
|
1696
1873
|
function isObjectLikeSchema2(schema, components) {
|
|
1697
1874
|
const resolved = resolveSchemaRef2(schema, components);
|
|
1698
1875
|
if (resolved.type === "object" || resolved.properties || resolved.additionalProperties) {
|
|
@@ -1789,6 +1966,7 @@ function buildQueryArgs(op, ctx, args) {
|
|
|
1789
1966
|
const { properties: queryObjProps, required: queryRequired } = resolveAndCollectObjectProps2(querySchema, ctx.components);
|
|
1790
1967
|
for (const [propName, propSchema] of Object.entries(queryObjProps)) {
|
|
1791
1968
|
const isRequired = queryRequired.includes(propName) ?? false;
|
|
1969
|
+
const isDeepObject = isDeepObjectSchema2(propSchema, ctx.components);
|
|
1792
1970
|
const isObjectLike = isObjectLikeSchema2(propSchema, ctx.components);
|
|
1793
1971
|
let schemaRef = propSchema.$ref;
|
|
1794
1972
|
if (!schemaRef) {
|
|
@@ -1800,7 +1978,8 @@ function buildQueryArgs(op, ctx, args) {
|
|
|
1800
1978
|
required: isRequired,
|
|
1801
1979
|
schemaRef,
|
|
1802
1980
|
schemaType: propSchema.type,
|
|
1803
|
-
|
|
1981
|
+
serialization: isDeepObject ? { style: "deepObject", explode: true } : void 0,
|
|
1982
|
+
content: !isDeepObject && isObjectLike ? "application/json" : void 0
|
|
1804
1983
|
});
|
|
1805
1984
|
}
|
|
1806
1985
|
}
|
|
@@ -1808,6 +1987,7 @@ function buildQueryArgs(op, ctx, args) {
|
|
|
1808
1987
|
const param = op.parameters[paramIndex];
|
|
1809
1988
|
if (param) {
|
|
1810
1989
|
const paramSchema = typeToJsonSchema(param.type, ctx);
|
|
1990
|
+
const isDeepObject = isDeepObjectSchema2(paramSchema, ctx.components);
|
|
1811
1991
|
const isObjectLike = isObjectLikeSchema2(paramSchema, ctx.components);
|
|
1812
1992
|
const schemaRef = paramSchema.$ref ?? "#/components/schemas/InlineQueryParam";
|
|
1813
1993
|
args.query.push({
|
|
@@ -1816,7 +1996,8 @@ function buildQueryArgs(op, ctx, args) {
|
|
|
1816
1996
|
required: !param.isOptional,
|
|
1817
1997
|
schemaRef,
|
|
1818
1998
|
schemaType: paramSchema.type,
|
|
1819
|
-
|
|
1999
|
+
serialization: isDeepObject ? { style: "deepObject", explode: true } : void 0,
|
|
2000
|
+
content: !isDeepObject && isObjectLike ? "application/json" : void 0
|
|
1820
2001
|
});
|
|
1821
2002
|
}
|
|
1822
2003
|
}
|