Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh onfido-node after onfido-openapi-spec update (06aaa9b) #117

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4.0
7.5.0
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## v3.0.0 3rd May 2024
## v3.0.0 6th May 2024

- Make library auto-generated and based on [Onfido OpenAPI spec](https://github.com/onfido/onfido-openapi-spec)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Webhook events payload needs to be verified before it can be accessed. Library a

## Contributing

This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) - version: 7.4.0; therefore all the contributions, except tests files, should target [Onfido OpenAPI specification repository](https://github.com/onfido/onfido-openapi-spec/tree/master) instead of this repository.
This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) - version: 7.5.0; therefore all the contributions, except tests files, should target [Onfido OpenAPI specification repository](https://github.com/onfido/onfido-openapi-spec/tree/master) instead of this repository.

For contributions to the tests instead, please follow the steps below:

Expand Down
10 changes: 5 additions & 5 deletions api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9312,7 +9312,7 @@ export interface WorkflowRun {
* @type {Array<string>}
* @memberof WorkflowRun
*/
'tags'?: Array<string>;
'tags'?: Array<string> | null;
/**
*
* @type {WorkflowRunSharedLink}
Expand Down Expand Up @@ -9411,7 +9411,7 @@ export interface WorkflowRunBuilder {
* @type {Array<string>}
* @memberof WorkflowRunBuilder
*/
'tags'?: Array<string>;
'tags'?: Array<string> | null;
/**
*
* @type {WorkflowRunSharedLink}
Expand Down Expand Up @@ -9555,7 +9555,7 @@ export interface WorkflowRunShared {
* @type {Array<string>}
* @memberof WorkflowRunShared
*/
'tags'?: Array<string>;
'tags'?: Array<string> | null;
/**
*
* @type {WorkflowRunSharedLink}
Expand Down Expand Up @@ -11989,7 +11989,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
}

if (validateImageQuality !== undefined) {
localVarFormParams.append('validate_image_quality', validateImageQuality as any);
localVarFormParams.append('validate_image_quality', String(validateImageQuality) as any);
}

if (location !== undefined) {
Expand Down Expand Up @@ -12092,7 +12092,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
}

if (advancedValidation !== undefined) {
localVarFormParams.append('advanced_validation', advancedValidation as any);
localVarFormParams.append('advanced_validation', String(advancedValidation) as any);
DavidMealha-Onfido marked this conversation as resolved.
Show resolved Hide resolved
}


Expand Down
42 changes: 41 additions & 1 deletion common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,50 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
? JSON.stringify(value !== undefined ? convertMapsAndSetsToPlain(value) : {})
: (value || "");
}

function convertMapsAndSetsToPlain(value: any): any {
if (typeof Set === "undefined") return value;
if (typeof Map === "undefined") return value;
if (typeof value !== "object" || !value) {
return value;
}
if (value instanceof Set) {
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
}
if (value instanceof Map) {
const entries: Array<[string, any]> = [];
value.forEach((value: any, key: any) => {
entries.push([key, convertMapsAndSetsToPlain(value)])
});
return objectFromEntries(entries);
}
if (Array.isArray(value)) {
return value.map(it => convertMapsAndSetsToPlain(it));
}
return objectFromEntries(objectEntries(value)
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
}

/**
* Ponyfill for Object.entries
*/
function objectEntries(object: Record<string, any>): Array<[string, any]> {
return Object.keys(object).map(key => [key, object[key]]);
}

/**
* Ponyfill for Object.fromEntries
*/
function objectFromEntries(entries: any): Record<string, any> {
return [...entries].reduce((object, [key, val]) => {
object[key] = val;
return object;
}, {});
}

/**
*
* @export
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions test/resources/live-photos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ it("uploads a live photo", async () => {
expect(photo.data).toEqual(getExpectedLivePhoto(exampleLivePhoto));
});

// [SKIP] Need to cast advancedValidation parameter to String in default-api.ts:2578:
// localVarFormParams.append('advanced_validation', String(advancedValidation as any));
it.skip("uploads a live photo without advanced validation", async () => {
it("uploads a live photo without advanced validation", async () => {
const anotherPhoto = await uploadLivePhoto(applicant, false);

expect(anotherPhoto.data).toEqual(getExpectedLivePhoto(exampleLivePhoto));
Expand Down
Loading