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

Make optional fields optional in MappingGenericProperty (#703) #708

Merged
merged 1 commit into from
Feb 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Deprecated
### Removed
### Fixed
- Make optional fields optional in `MappingGenericProperty` ([708](https://github.com/opensearch-project/opensearch-js/pull/708))
### Security

## [2.5.0]
Expand Down
22 changes: 11 additions & 11 deletions api/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3907,17 +3907,17 @@ export interface MappingFloatRangeProperty extends MappingRangePropertyBase {
}

export interface MappingGenericProperty extends MappingDocValuesPropertyBase {
analyzer: string;
boost: double;
fielddata: IndicesStringFielddata;
ignore_malformed: boolean;
index: boolean;
index_options: MappingIndexOptions;
norms: boolean;
null_value: string;
position_increment_gap: integer;
search_analyzer: string;
term_vector: MappingTermVectorOption;
analyzer?: string;
boost?: double;
fielddata?: IndicesStringFielddata;
ignore_malformed?: boolean;
index?: boolean;
index_options?: MappingIndexOptions;
norms?: boolean;
null_value?: string;
position_increment_gap?: integer;
search_analyzer?: string;
term_vector?: MappingTermVectorOption;
type: string;
}

Expand Down
20 changes: 20 additions & 0 deletions test/types/types.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/

import { expectAssignable } from 'tsd';
import { MappingProperty } from '../../api/types';

// https://github.com/opensearch-project/opensearch-js/issues/703
// only manifested when value is in a variable, so the following would *not* catch it:
//
// expectAssignable<MappingProperty>({ type: 'date' });

const x = { type: 'date' };
expectAssignable<MappingProperty>(x);
Loading