Skip to content

Commit 809cd14

Browse files
committed
fix: Mark fields in AiExtractResponse and Event with additionalProperties (box/box-openapi#556)
1 parent ad468c9 commit 809cd14

File tree

3 files changed

+65
-33
lines changed

3 files changed

+65
-33
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "504b5a7", "specHash": "1ed059a", "version": "0.1.0" }
1+
{ "engineHash": "504b5a7", "specHash": "62fdfd1", "version": "0.1.0" }

src/sdk-gen/schemas/aiExtractResponse.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,36 @@ import { sdIsNumber } from '../serialization/json';
66
import { sdIsString } from '../serialization/json';
77
import { sdIsList } from '../serialization/json';
88
import { sdIsMap } from '../serialization/json';
9-
export interface AiExtractResponse {
10-
readonly rawData?: SerializedData;
11-
}
9+
export type AiExtractResponse = {
10+
readonly [key: string]: any;
11+
};
1212
export function serializeAiExtractResponse(
1313
val: AiExtractResponse
1414
): SerializedData {
15-
return {};
15+
return Object.fromEntries(
16+
Object.entries(val).map(([k, v]: [string, any]) => [
17+
k,
18+
(function (v: any): any {
19+
return v;
20+
})(v),
21+
])
22+
) as {
23+
readonly [key: string]: any;
24+
};
1625
}
1726
export function deserializeAiExtractResponse(
1827
val: SerializedData
1928
): AiExtractResponse {
20-
if (!sdIsMap(val)) {
21-
throw new BoxSdkError({
22-
message: 'Expecting a map for "AiExtractResponse"',
23-
});
24-
}
25-
return {} satisfies AiExtractResponse;
29+
return sdIsMap(val)
30+
? (Object.fromEntries(
31+
Object.entries(val).map(([k, v]: [string, any]) => [
32+
k,
33+
(function (v: any): any {
34+
return v;
35+
})(v),
36+
])
37+
) as {
38+
readonly [key: string]: any;
39+
})
40+
: {};
2641
}

src/sdk-gen/schemas/event.ts

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ export type EventEventTypeField =
176176
| 'WATERMARK_LABEL_CREATE'
177177
| 'WATERMARK_LABEL_DELETE'
178178
| string;
179-
export interface EventAdditionalDetailsField {
180-
readonly rawData?: SerializedData;
181-
}
182179
export interface Event {
183180
/**
184181
* The value will always be `event`. */
@@ -206,7 +203,9 @@ export interface Event {
206203
* information to correlate an event to external KeySafe logs. Not all events
207204
* have an `additional_details` object. This object is only available in the
208205
* Enterprise Events. */
209-
readonly additionalDetails?: EventAdditionalDetailsField;
206+
readonly additionalDetails?: {
207+
readonly [key: string]: any;
208+
};
210209
readonly rawData?: SerializedData;
211210
}
212211
export function serializeEventEventTypeField(
@@ -645,21 +644,6 @@ export function deserializeEventEventTypeField(
645644
}
646645
throw new BoxSdkError({ message: "Can't deserialize EventEventTypeField" });
647646
}
648-
export function serializeEventAdditionalDetailsField(
649-
val: EventAdditionalDetailsField
650-
): SerializedData {
651-
return {};
652-
}
653-
export function deserializeEventAdditionalDetailsField(
654-
val: SerializedData
655-
): EventAdditionalDetailsField {
656-
if (!sdIsMap(val)) {
657-
throw new BoxSdkError({
658-
message: 'Expecting a map for "EventAdditionalDetailsField"',
659-
});
660-
}
661-
return {} satisfies EventAdditionalDetailsField;
662-
}
663647
export function serializeEvent(val: Event): SerializedData {
664648
return {
665649
['type']: val.type,
@@ -688,7 +672,18 @@ export function serializeEvent(val: Event): SerializedData {
688672
['additional_details']:
689673
val.additionalDetails == void 0
690674
? val.additionalDetails
691-
: serializeEventAdditionalDetailsField(val.additionalDetails),
675+
: (Object.fromEntries(
676+
Object.entries(val.additionalDetails).map(
677+
([k, v]: [string, any]) => [
678+
k,
679+
(function (v: any): any {
680+
return v;
681+
})(v),
682+
]
683+
)
684+
) as {
685+
readonly [key: string]: any;
686+
}),
692687
};
693688
}
694689
export function deserializeEvent(val: SerializedData): Event {
@@ -737,10 +732,32 @@ export function deserializeEvent(val: SerializedData): Event {
737732
val.session_id == void 0 ? void 0 : val.session_id;
738733
const source: undefined | EventSourceResource =
739734
val.source == void 0 ? void 0 : deserializeEventSourceResource(val.source);
740-
const additionalDetails: undefined | EventAdditionalDetailsField =
735+
if (!(val.additional_details == void 0) && !sdIsMap(val.additional_details)) {
736+
throw new BoxSdkError({
737+
message: 'Expecting object for "additional_details" of type "Event"',
738+
});
739+
}
740+
const additionalDetails:
741+
| undefined
742+
| {
743+
readonly [key: string]: any;
744+
} =
741745
val.additional_details == void 0
742746
? void 0
743-
: deserializeEventAdditionalDetailsField(val.additional_details);
747+
: sdIsMap(val.additional_details)
748+
? (Object.fromEntries(
749+
Object.entries(val.additional_details).map(
750+
([k, v]: [string, any]) => [
751+
k,
752+
(function (v: any): any {
753+
return v;
754+
})(v),
755+
]
756+
)
757+
) as {
758+
readonly [key: string]: any;
759+
})
760+
: {};
744761
return {
745762
type: type,
746763
createdAt: createdAt,

0 commit comments

Comments
 (0)