Skip to content

Commit 00973cc

Browse files
authored
Fix generator for HEAD request boolean response type (#1006)
* Fix generator for HEAD request boolean response type (#1005) Signed-off-by: Xavier Fournet <[email protected]>
1 parent be85743 commit 00973cc

12 files changed

+43
-20
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
44

5+
56
## [Unreleased]
67
### Added
78
### Dependencies
@@ -11,6 +12,10 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
1112
### Fixed
1213
### Security
1314

15+
## [3.5.1]
16+
### Fixed
17+
- Api Generator: fix HEAD request boolean response type ([#1006](https://github.com/opensearch-project/opensearch-js/pull/1006))
18+
1419
## [3.5.0]
1520
### Added
1621
### Dependencies

api/_core/exists.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ export interface Exists_Request extends Global.Params {
3434
version_type?: Common.VersionType;
3535
}
3636

37-
export type Exists_Response = boolean
37+
export interface Exists_Response extends ApiResponse {
38+
body: Exists_ResponseBody;
39+
}
3840

39-
export type Exists_ResponseBody = Record<string, any>
41+
export type Exists_ResponseBody = boolean
4042

api/_core/existsSource.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ export interface ExistsSource_Request extends Global.Params {
3333
version_type?: Common.VersionType;
3434
}
3535

36-
export type ExistsSource_Response = boolean
36+
export interface ExistsSource_Response extends ApiResponse {
37+
body: ExistsSource_ResponseBody;
38+
}
3739

38-
export type ExistsSource_ResponseBody = Record<string, any>
40+
export type ExistsSource_ResponseBody = boolean
3941

api/_core/ping.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import * as Global from '../_types/_global'
1919

2020
export type Ping_Request = Global.Params & Record<string, any>
2121

22-
export type Ping_Response = boolean
22+
export interface Ping_Response extends ApiResponse {
23+
body: Ping_ResponseBody;
24+
}
2325

24-
export type Ping_ResponseBody = Record<string, any>
26+
export type Ping_ResponseBody = boolean
2527

api/cluster/existsComponentTemplate.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export interface Cluster_ExistsComponentTemplate_Request extends Global.Params {
2525
name: Common.Name;
2626
}
2727

28-
export type Cluster_ExistsComponentTemplate_Response = boolean
28+
export interface Cluster_ExistsComponentTemplate_Response extends ApiResponse {
29+
body: Cluster_ExistsComponentTemplate_ResponseBody;
30+
}
2931

30-
export type Cluster_ExistsComponentTemplate_ResponseBody = Record<string, any>
32+
export type Cluster_ExistsComponentTemplate_ResponseBody = boolean
3133

api/indices/exists.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export interface Indices_Exists_Request extends Global.Params {
2929
local?: boolean;
3030
}
3131

32-
export type Indices_Exists_Response = boolean
32+
export interface Indices_Exists_Response extends ApiResponse {
33+
body: Indices_Exists_ResponseBody;
34+
}
3335

34-
export type Indices_Exists_ResponseBody = Record<string, any>
36+
export type Indices_Exists_ResponseBody = boolean
3537

api/indices/existsAlias.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export interface Indices_ExistsAlias_Request extends Global.Params {
2727
name: Common.Names;
2828
}
2929

30-
export type Indices_ExistsAlias_Response = boolean
30+
export interface Indices_ExistsAlias_Response extends ApiResponse {
31+
body: Indices_ExistsAlias_ResponseBody;
32+
}
3133

32-
export type Indices_ExistsAlias_ResponseBody = Record<string, any>
34+
export type Indices_ExistsAlias_ResponseBody = boolean
3335

api/indices/existsIndexTemplate.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export interface Indices_ExistsIndexTemplate_Request extends Global.Params {
2626
name: Common.Name;
2727
}
2828

29-
export type Indices_ExistsIndexTemplate_Response = boolean
29+
export interface Indices_ExistsIndexTemplate_Response extends ApiResponse {
30+
body: Indices_ExistsIndexTemplate_ResponseBody;
31+
}
3032

31-
export type Indices_ExistsIndexTemplate_ResponseBody = Record<string, any>
33+
export type Indices_ExistsIndexTemplate_ResponseBody = boolean
3234

api/indices/existsTemplate.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export interface Indices_ExistsTemplate_Request extends Global.Params {
2626
name: Common.Names;
2727
}
2828

29-
export type Indices_ExistsTemplate_Response = boolean
29+
export interface Indices_ExistsTemplate_Response extends ApiResponse {
30+
body: Indices_ExistsTemplate_ResponseBody;
31+
}
3032

31-
export type Indices_ExistsTemplate_ResponseBody = Record<string, any>
33+
export type Indices_ExistsTemplate_ResponseBody = boolean
3234

api/ism/existsPolicy.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ export interface Ism_ExistsPolicy_Request extends Global.Params {
2121
policy_id: string;
2222
}
2323

24-
export type Ism_ExistsPolicy_Response = boolean
24+
export interface Ism_ExistsPolicy_Response extends ApiResponse {
25+
body: Ism_ExistsPolicy_ResponseBody;
26+
}
2527

26-
export type Ism_ExistsPolicy_ResponseBody = any
28+
export type Ism_ExistsPolicy_ResponseBody = boolean
2729

api_generator/src/renderers/render_types/FunctionTypesContainer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ export default class FunctionTypesContainer extends TypesContainer {
5353
}
5454

5555
#build_response (): Schema {
56-
if (this._func.http_verbs.has('HEAD')) return { type: 'boolean' }
5756
const schema = { properties: { body: { $ref: this.create_ref('response_body') } }, required: ['body'] }
5857
return { allOf: [schema, { $ref: 'ApiResponse' }] }
5958
}
6059

6160
#build_response_body (): Schema {
61+
if (this._func.http_verbs.has('HEAD')) return { type: 'boolean' }
6262
const body = this._func.response_body
6363
if (body == null) return { type: 'object' }
6464
if (body.ref_obj != null) return body.ref_obj

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"LICENSE.txt"
3737
],
3838
"homepage": "https://www.opensearch.org/",
39-
"version": "3.5.0",
39+
"version": "3.5.1",
4040
"versionCanary": "7.10.0-canary.6",
4141
"keywords": [
4242
"opensearch",

0 commit comments

Comments
 (0)