Skip to content

Commit

Permalink
Fixed Generator: TypesFileRenderer (#878)
Browse files Browse the repository at this point in the history
- Handle edge case where allOf comprises only named schemas.
- Imported objects are now sorted alphabetically instead of by order of reference.

Signed-off-by: Theo Truong <[email protected]>
  • Loading branch information
nhtruong authored Sep 24, 2024
1 parent 0bde007 commit f4f7758
Show file tree
Hide file tree
Showing 292 changed files with 3,277 additions and 684 deletions.
104 changes: 104 additions & 0 deletions api/OpenSearchAPI.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,15 @@ export default class OpenSearchAPI {
create (params: API.FlowFramework_Create_Request, callback: callbackFn<API.FlowFramework_Create_Response>): TransportRequestCallback;
create (params: API.FlowFramework_Create_Request, options: TransportRequestOptions, callback: callbackFn<API.FlowFramework_Create_Response>): TransportRequestCallback;

search (params: API.FlowFramework_Search_Request, options?: TransportRequestOptions): TransportRequestPromise<API.FlowFramework_Search_Response>;
search (params: API.FlowFramework_Search_Request, callback: callbackFn<API.FlowFramework_Search_Response>): TransportRequestCallback;
search (params: API.FlowFramework_Search_Request, options: TransportRequestOptions, callback: callbackFn<API.FlowFramework_Search_Response>): TransportRequestCallback;

getSteps (params?: API.FlowFramework_GetSteps_Request, options?: TransportRequestOptions): TransportRequestPromise<API.FlowFramework_GetSteps_Response>;
getSteps (callback: callbackFn<API.FlowFramework_GetSteps_Response>): TransportRequestCallback;
getSteps (params: API.FlowFramework_GetSteps_Request, callback: callbackFn<API.FlowFramework_GetSteps_Response>): TransportRequestCallback;
getSteps (params: API.FlowFramework_GetSteps_Request, options: TransportRequestOptions, callback: callbackFn<API.FlowFramework_GetSteps_Response>): TransportRequestCallback;

delete (params: API.FlowFramework_Delete_Request, options?: TransportRequestOptions): TransportRequestPromise<API.FlowFramework_Delete_Response>;
delete (params: API.FlowFramework_Delete_Request, callback: callbackFn<API.FlowFramework_Delete_Response>): TransportRequestCallback;
delete (params: API.FlowFramework_Delete_Request, options: TransportRequestOptions, callback: callbackFn<API.FlowFramework_Delete_Response>): TransportRequestCallback;
Expand All @@ -312,6 +321,22 @@ export default class OpenSearchAPI {
update (params: API.FlowFramework_Update_Request, callback: callbackFn<API.FlowFramework_Update_Response>): TransportRequestCallback;
update (params: API.FlowFramework_Update_Request, options: TransportRequestOptions, callback: callbackFn<API.FlowFramework_Update_Response>): TransportRequestCallback;

deprovision (params: API.FlowFramework_Deprovision_Request, options?: TransportRequestOptions): TransportRequestPromise<API.FlowFramework_Deprovision_Response>;
deprovision (params: API.FlowFramework_Deprovision_Request, callback: callbackFn<API.FlowFramework_Deprovision_Response>): TransportRequestCallback;
deprovision (params: API.FlowFramework_Deprovision_Request, options: TransportRequestOptions, callback: callbackFn<API.FlowFramework_Deprovision_Response>): TransportRequestCallback;

provision (params: API.FlowFramework_Provision_Request, options?: TransportRequestOptions): TransportRequestPromise<API.FlowFramework_Provision_Response>;
provision (params: API.FlowFramework_Provision_Request, callback: callbackFn<API.FlowFramework_Provision_Response>): TransportRequestCallback;
provision (params: API.FlowFramework_Provision_Request, options: TransportRequestOptions, callback: callbackFn<API.FlowFramework_Provision_Response>): TransportRequestCallback;

getStatus (params: API.FlowFramework_GetStatus_Request, options?: TransportRequestOptions): TransportRequestPromise<API.FlowFramework_GetStatus_Response>;
getStatus (params: API.FlowFramework_GetStatus_Request, callback: callbackFn<API.FlowFramework_GetStatus_Response>): TransportRequestCallback;
getStatus (params: API.FlowFramework_GetStatus_Request, options: TransportRequestOptions, callback: callbackFn<API.FlowFramework_GetStatus_Response>): TransportRequestCallback;

searchState (params: API.FlowFramework_SearchState_Request, options?: TransportRequestOptions): TransportRequestPromise<API.FlowFramework_SearchState_Response>;
searchState (params: API.FlowFramework_SearchState_Request, callback: callbackFn<API.FlowFramework_SearchState_Response>): TransportRequestCallback;
searchState (params: API.FlowFramework_SearchState_Request, options: TransportRequestOptions, callback: callbackFn<API.FlowFramework_SearchState_Response>): TransportRequestCallback;

};

indices: {
Expand Down Expand Up @@ -555,6 +580,63 @@ export default class OpenSearchAPI {

};

ism: {
addPolicy (params?: API.Ism_AddPolicy_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_AddPolicy_Response>;
addPolicy (callback: callbackFn<API.Ism_AddPolicy_Response>): TransportRequestCallback;
addPolicy (params: API.Ism_AddPolicy_Request, callback: callbackFn<API.Ism_AddPolicy_Response>): TransportRequestCallback;
addPolicy (params: API.Ism_AddPolicy_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_AddPolicy_Response>): TransportRequestCallback;

changePolicy (params?: API.Ism_ChangePolicy_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_ChangePolicy_Response>;
changePolicy (callback: callbackFn<API.Ism_ChangePolicy_Response>): TransportRequestCallback;
changePolicy (params: API.Ism_ChangePolicy_Request, callback: callbackFn<API.Ism_ChangePolicy_Response>): TransportRequestCallback;
changePolicy (params: API.Ism_ChangePolicy_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_ChangePolicy_Response>): TransportRequestCallback;

explainPolicy (params?: API.Ism_ExplainPolicy_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_ExplainPolicy_Response>;
explainPolicy (callback: callbackFn<API.Ism_ExplainPolicy_Response>): TransportRequestCallback;
explainPolicy (params: API.Ism_ExplainPolicy_Request, callback: callbackFn<API.Ism_ExplainPolicy_Response>): TransportRequestCallback;
explainPolicy (params: API.Ism_ExplainPolicy_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_ExplainPolicy_Response>): TransportRequestCallback;

getPolicies (params?: API.Ism_GetPolicies_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_GetPolicies_Response>;
getPolicies (callback: callbackFn<API.Ism_GetPolicies_Response>): TransportRequestCallback;
getPolicies (params: API.Ism_GetPolicies_Request, callback: callbackFn<API.Ism_GetPolicies_Response>): TransportRequestCallback;
getPolicies (params: API.Ism_GetPolicies_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_GetPolicies_Response>): TransportRequestCallback;

putPolicies (params: API.Ism_PutPolicies_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_PutPolicies_Response>;
putPolicies (params: API.Ism_PutPolicies_Request, callback: callbackFn<API.Ism_PutPolicies_Response>): TransportRequestCallback;
putPolicies (params: API.Ism_PutPolicies_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_PutPolicies_Response>): TransportRequestCallback;

deletePolicy (params: API.Ism_DeletePolicy_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_DeletePolicy_Response>;
deletePolicy (params: API.Ism_DeletePolicy_Request, callback: callbackFn<API.Ism_DeletePolicy_Response>): TransportRequestCallback;
deletePolicy (params: API.Ism_DeletePolicy_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_DeletePolicy_Response>): TransportRequestCallback;

getPolicy (params: API.Ism_GetPolicy_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_GetPolicy_Response>;
getPolicy (params: API.Ism_GetPolicy_Request, callback: callbackFn<API.Ism_GetPolicy_Response>): TransportRequestCallback;
getPolicy (params: API.Ism_GetPolicy_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_GetPolicy_Response>): TransportRequestCallback;

existsPolicy (params: API.Ism_ExistsPolicy_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_ExistsPolicy_Response>;
existsPolicy (params: API.Ism_ExistsPolicy_Request, callback: callbackFn<API.Ism_ExistsPolicy_Response>): TransportRequestCallback;
existsPolicy (params: API.Ism_ExistsPolicy_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_ExistsPolicy_Response>): TransportRequestCallback;

putPolicy (params: API.Ism_PutPolicy_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_PutPolicy_Response>;
putPolicy (params: API.Ism_PutPolicy_Request, callback: callbackFn<API.Ism_PutPolicy_Response>): TransportRequestCallback;
putPolicy (params: API.Ism_PutPolicy_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_PutPolicy_Response>): TransportRequestCallback;

removePolicy (params?: API.Ism_RemovePolicy_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_RemovePolicy_Response>;
removePolicy (callback: callbackFn<API.Ism_RemovePolicy_Response>): TransportRequestCallback;
removePolicy (params: API.Ism_RemovePolicy_Request, callback: callbackFn<API.Ism_RemovePolicy_Response>): TransportRequestCallback;
removePolicy (params: API.Ism_RemovePolicy_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_RemovePolicy_Response>): TransportRequestCallback;

retryIndex (params?: API.Ism_RetryIndex_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_RetryIndex_Response>;
retryIndex (callback: callbackFn<API.Ism_RetryIndex_Response>): TransportRequestCallback;
retryIndex (params: API.Ism_RetryIndex_Request, callback: callbackFn<API.Ism_RetryIndex_Response>): TransportRequestCallback;
retryIndex (params: API.Ism_RetryIndex_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_RetryIndex_Response>): TransportRequestCallback;

refreshSearchAnalyzers (params: API.Ism_RefreshSearchAnalyzers_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ism_RefreshSearchAnalyzers_Response>;
refreshSearchAnalyzers (params: API.Ism_RefreshSearchAnalyzers_Request, callback: callbackFn<API.Ism_RefreshSearchAnalyzers_Response>): TransportRequestCallback;
refreshSearchAnalyzers (params: API.Ism_RefreshSearchAnalyzers_Request, options: TransportRequestOptions, callback: callbackFn<API.Ism_RefreshSearchAnalyzers_Response>): TransportRequestCallback;

};

knn: {
stats (params?: API.Knn_Stats_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Knn_Stats_Response>;
stats (callback: callbackFn<API.Knn_Stats_Response>): TransportRequestCallback;
Expand Down Expand Up @@ -585,6 +667,24 @@ export default class OpenSearchAPI {
};

ml: {
registerAgents (params?: API.Ml_RegisterAgents_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_RegisterAgents_Response>;
registerAgents (callback: callbackFn<API.Ml_RegisterAgents_Response>): TransportRequestCallback;
registerAgents (params: API.Ml_RegisterAgents_Request, callback: callbackFn<API.Ml_RegisterAgents_Response>): TransportRequestCallback;
registerAgents (params: API.Ml_RegisterAgents_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_RegisterAgents_Response>): TransportRequestCallback;

deleteAgent (params: API.Ml_DeleteAgent_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_DeleteAgent_Response>;
deleteAgent (params: API.Ml_DeleteAgent_Request, callback: callbackFn<API.Ml_DeleteAgent_Response>): TransportRequestCallback;
deleteAgent (params: API.Ml_DeleteAgent_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_DeleteAgent_Response>): TransportRequestCallback;

createConnector (params?: API.Ml_CreateConnector_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_CreateConnector_Response>;
createConnector (callback: callbackFn<API.Ml_CreateConnector_Response>): TransportRequestCallback;
createConnector (params: API.Ml_CreateConnector_Request, callback: callbackFn<API.Ml_CreateConnector_Response>): TransportRequestCallback;
createConnector (params: API.Ml_CreateConnector_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_CreateConnector_Response>): TransportRequestCallback;

deleteConnector (params: API.Ml_DeleteConnector_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_DeleteConnector_Response>;
deleteConnector (params: API.Ml_DeleteConnector_Request, callback: callbackFn<API.Ml_DeleteConnector_Response>): TransportRequestCallback;
deleteConnector (params: API.Ml_DeleteConnector_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_DeleteConnector_Response>): TransportRequestCallback;

registerModelGroup (params?: API.Ml_RegisterModelGroup_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_RegisterModelGroup_Response>;
registerModelGroup (callback: callbackFn<API.Ml_RegisterModelGroup_Response>): TransportRequestCallback;
registerModelGroup (params: API.Ml_RegisterModelGroup_Request, callback: callbackFn<API.Ml_RegisterModelGroup_Response>): TransportRequestCallback;
Expand Down Expand Up @@ -1123,6 +1223,10 @@ export default class OpenSearchAPI {
createUserLegacy (params: API.Security_CreateUserLegacy_Request, callback: callbackFn<API.Security_CreateUserLegacy_Response>): TransportRequestCallback;
createUserLegacy (params: API.Security_CreateUserLegacy_Request, options: TransportRequestOptions, callback: callbackFn<API.Security_CreateUserLegacy_Response>): TransportRequestCallback;

generateUserTokenLegacy (params: API.Security_GenerateUserTokenLegacy_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Security_GenerateUserTokenLegacy_Response>;
generateUserTokenLegacy (params: API.Security_GenerateUserTokenLegacy_Request, callback: callbackFn<API.Security_GenerateUserTokenLegacy_Response>): TransportRequestCallback;
generateUserTokenLegacy (params: API.Security_GenerateUserTokenLegacy_Request, options: TransportRequestOptions, callback: callbackFn<API.Security_GenerateUserTokenLegacy_Response>): TransportRequestCallback;

validate (params?: API.Security_Validate_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Security_Validate_Response>;
validate (callback: callbackFn<API.Security_Validate_Response>): TransportRequestCallback;
validate (params: API.Security_Validate_Request, callback: callbackFn<API.Security_Validate_Response>): TransportRequestCallback;
Expand Down
2 changes: 2 additions & 0 deletions api/OpenSearchAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class OpenSearchAPI {
http: new(require('./http/_api'))(this),
indices: new(require('./indices/_api'))(this),
ingest: new(require('./ingest/_api'))(this),
ism: new(require('./ism/_api'))(this),
knn: new(require('./knn/_api'))(this),
ml: new(require('./ml/_api'))(this),
nodes: new(require('./nodes/_api'))(this),
Expand Down Expand Up @@ -152,6 +153,7 @@ class OpenSearchAPI {
http: { get() { return this[kApiModules].http } },
indices: { get() { return this[kApiModules].indices } },
ingest: { get() { return this[kApiModules].ingest } },
ism: { get() { return this[kApiModules].ism } },
knn: { get() { return this[kApiModules].knn } },
ml: { get() { return this[kApiModules].ml } },
nodes: { get() { return this[kApiModules].nodes } },
Expand Down
4 changes: 2 additions & 2 deletions api/_core/bulk.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/

import { ApiResponse } from '../../lib/Transport'
import * as Global from '../_types/_global'
import * as Core_Search from '../_types/_core.search'
import * as Common from '../_types/_common'
import * as Core_Bulk from '../_types/_core.bulk'
import * as Core_Search from '../_types/_core.search'
import * as Global from '../_types/_global'

export interface Bulk_Request extends Global.Params {
_source?: Core_Search.SourceConfigParam;
Expand Down
2 changes: 1 addition & 1 deletion api/_core/clearScroll.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import { ApiResponse } from '../../lib/Transport'
import * as Global from '../_types/_global'
import * as Common from '../_types/_common'
import * as Global from '../_types/_global'

export interface ClearScroll_Request extends Global.Params {
body?: ClearScroll_RequestBody;
Expand Down
4 changes: 2 additions & 2 deletions api/_core/count.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/

import { ApiResponse } from '../../lib/Transport'
import * as Global from '../_types/_global'
import * as Common_QueryDsl from '../_types/_common.query_dsl'
import * as Common from '../_types/_common'
import * as Common_QueryDsl from '../_types/_common.query_dsl'
import * as Global from '../_types/_global'

export interface Count_Request extends Global.Params {
allow_no_indices?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion api/_core/create.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import { ApiResponse } from '../../lib/Transport'
import * as Global from '../_types/_global'
import * as Common from '../_types/_common'
import * as Global from '../_types/_global'

export interface Create_Request extends Global.Params {
body: Create_RequestBody;
Expand Down
4 changes: 2 additions & 2 deletions api/_core/createPit.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
*/

import { ApiResponse } from '../../lib/Transport'
import * as Global from '../_types/_global'
import * as Common from '../_types/_common'
import * as Core_Common from '../_types/_core._common'
import * as Global from '../_types/_global'

export interface CreatePit_Request extends Global.Params {
allow_partial_pit_creation?: boolean;
expand_wildcards?: Common.ExpandWildcards;
index: string[];
keep_alive?: Common.Duration;
preference?: string;
routing?: string[];
routing?: Common.Routing;
}

export interface CreatePit_Response extends ApiResponse {
Expand Down
2 changes: 1 addition & 1 deletion api/_core/createPit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const { normalizeArguments, parsePathParam, handleMissingParam } = require('../u
* @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {string} [params.keep_alive] - Specify the keep alive for point in time.
* @param {string} [params.preference=random] - Specify the node or shard the operation should be performed on.
* @param {array} [params.routing] - Comma-separated list of specific routing values.
* @param {string} [params.routing] - Comma-separated list of specific routing values.
* @param {array} params.index - Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices.
*
* @param {TransportRequestOptions} [options] - Options for {@link Transport#request}
Expand Down
2 changes: 1 addition & 1 deletion api/_core/delete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import { ApiResponse } from '../../lib/Transport'
import * as Global from '../_types/_global'
import * as Common from '../_types/_common'
import * as Global from '../_types/_global'

export interface Delete_Request extends Global.Params {
id: Common.Id;
Expand Down
2 changes: 1 addition & 1 deletion api/_core/deleteAllPits.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import { ApiResponse } from '../../lib/Transport'
import * as Global from '../_types/_global'
import * as Core_Common from '../_types/_core._common'
import * as Global from '../_types/_global'

export type DeleteAllPits_Request = Global.Params & Record<string, any>

Expand Down
19 changes: 2 additions & 17 deletions api/_core/deleteByQuery.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/

import { ApiResponse } from '../../lib/Transport'
import * as Global from '../_types/_global'
import * as Common from '../_types/_common'
import * as Common_QueryDsl from '../_types/_common.query_dsl'
import * as Global from '../_types/_global'

export interface DeleteByQuery_Request extends Global.Params {
_source?: string[];
Expand Down Expand Up @@ -67,22 +67,7 @@ export interface DeleteByQuery_Response extends ApiResponse {
body: DeleteByQuery_ResponseBody;
}

export interface DeleteByQuery_ResponseBody {
batches?: number;
deleted?: number;
failures?: Common.BulkIndexByScrollFailure[];
noops?: number;
requests_per_second?: number;
retries?: Common.Retries;
slice_id?: number;
export type DeleteByQuery_ResponseBody = Common.BulkByScrollResponseBase | {
task?: Common.TaskId;
throttled?: Common.Duration;
throttled_millis?: Common.DurationValueUnitMillis;
throttled_until?: Common.Duration;
throttled_until_millis?: Common.DurationValueUnitMillis;
timed_out?: boolean;
took?: Common.DurationValueUnitMillis;
total?: number;
version_conflicts?: number;
}

Loading

0 comments on commit f4f7758

Please sign in to comment.