File tree Expand file tree Collapse file tree 3 files changed +10
-37
lines changed Expand file tree Collapse file tree 3 files changed +10
-37
lines changed Original file line number Diff line number Diff line change 1
1
import type { OperationParameter } from '../../../client/interfaces/OperationParameter' ;
2
2
3
3
export function sortByRequired ( a : OperationParameter , b : OperationParameter ) : number {
4
- const aIsRequiredWithoutDefaultValue = a . isRequired && a . default === undefined ;
5
- const bIsRequiredWithoutDefaultValue = b . isRequired && b . default === undefined ;
6
- const aIsRequiredWithDefaultValue = a . isRequired && a . default !== undefined ;
7
- const bIsRequiredWithDefaultValue = b . isRequired && b . default !== undefined ;
8
- const aIsOptionalWithDefaultValue = ! a . isRequired && a . default !== undefined ;
9
- const bIsOptionalWithDefaultValue = ! b . isRequired && b . default !== undefined ;
10
- const aIsOptionalWithoutDefaultValue = ! a . isRequired && a . default === undefined ;
11
- const bIsOptionalWithoutDefaultValue = ! b . isRequired && b . default === undefined ;
12
-
13
- if ( aIsRequiredWithoutDefaultValue && ! bIsRequiredWithoutDefaultValue ) return - 1 ;
14
- if ( bIsRequiredWithoutDefaultValue && ! aIsRequiredWithoutDefaultValue ) return 1 ;
15
- if ( aIsRequiredWithDefaultValue && ! bIsRequiredWithDefaultValue ) return - 1 ;
16
- if ( bIsRequiredWithDefaultValue && ! aIsRequiredWithDefaultValue ) return 1 ;
17
- if ( aIsOptionalWithDefaultValue && ! bIsOptionalWithDefaultValue ) return - 1 ;
18
- if ( bIsOptionalWithDefaultValue && ! aIsOptionalWithDefaultValue ) return 1 ;
19
- if ( aIsOptionalWithoutDefaultValue && ! bIsOptionalWithoutDefaultValue ) return - 1 ;
20
- if ( bIsOptionalWithoutDefaultValue && ! aIsOptionalWithoutDefaultValue ) return 1 ;
21
-
4
+ const aNeedsValue = a . isRequired && a . default === undefined ;
5
+ const bNeedsValue = b . isRequired && b . default === undefined ;
6
+ if ( aNeedsValue && ! bNeedsValue ) return - 1 ;
7
+ if ( bNeedsValue && ! aNeedsValue ) return 1 ;
22
8
return 0 ;
23
9
}
Original file line number Diff line number Diff line change 1
1
import type { OperationParameter } from '../../../client/interfaces/OperationParameter' ;
2
2
3
3
export function sortByRequired ( a : OperationParameter , b : OperationParameter ) : number {
4
- const aIsRequiredWithoutDefaultValue = a . isRequired && a . default === undefined ;
5
- const bIsRequiredWithoutDefaultValue = b . isRequired && b . default === undefined ;
6
- const aIsRequiredWithDefaultValue = a . isRequired && a . default !== undefined ;
7
- const bIsRequiredWithDefaultValue = b . isRequired && b . default !== undefined ;
8
- const aIsOptionalWithDefaultValue = ! a . isRequired && a . default !== undefined ;
9
- const bIsOptionalWithDefaultValue = ! b . isRequired && b . default !== undefined ;
10
- const aIsOptionalWithoutDefaultValue = ! a . isRequired && a . default === undefined ;
11
- const bIsOptionalWithoutDefaultValue = ! b . isRequired && b . default === undefined ;
12
-
13
- if ( aIsRequiredWithoutDefaultValue && ! bIsRequiredWithoutDefaultValue ) return - 1 ;
14
- if ( bIsRequiredWithoutDefaultValue && ! aIsRequiredWithoutDefaultValue ) return 1 ;
15
- if ( aIsRequiredWithDefaultValue && ! bIsRequiredWithDefaultValue ) return - 1 ;
16
- if ( bIsRequiredWithDefaultValue && ! aIsRequiredWithDefaultValue ) return 1 ;
17
- if ( aIsOptionalWithDefaultValue && ! bIsOptionalWithDefaultValue ) return - 1 ;
18
- if ( bIsOptionalWithDefaultValue && ! aIsOptionalWithDefaultValue ) return 1 ;
19
- if ( aIsOptionalWithoutDefaultValue && ! bIsOptionalWithoutDefaultValue ) return - 1 ;
20
- if ( bIsOptionalWithoutDefaultValue && ! aIsOptionalWithoutDefaultValue ) return 1 ;
21
-
4
+ const aNeedsValue = a . isRequired && a . default === undefined ;
5
+ const bNeedsValue = b . isRequired && b . default === undefined ;
6
+ if ( aNeedsValue && ! bNeedsValue ) return - 1 ;
7
+ if ( bNeedsValue && ! aNeedsValue ) return 1 ;
22
8
return 0 ;
23
9
}
Original file line number Diff line number Diff line change @@ -3,12 +3,13 @@ async function getHeaders(options: ApiRequestOptions, formData?: FormData): Prom
3
3
const username = await resolve(options, OpenAPI.USERNAME);
4
4
const password = await resolve(options, OpenAPI.PASSWORD);
5
5
const additionalHeaders = await resolve(options, OpenAPI.HEADERS);
6
+ const formHeaders = typeof formData?.getHeaders === 'function' && formData?.getHeaders() || {}
6
7
7
8
const headers = Object.entries({
8
9
Accept: 'application/json',
9
10
...additionalHeaders,
10
11
...options.headers,
11
- ...formData?.getHeaders()
12
+ ...formHeaders,
12
13
})
13
14
.filter(([key, value]) => isDefined(value))
14
15
.reduce((headers, [key, value]) => ({
You can’t perform that action at this time.
0 commit comments