Skip to content

Commit 7362d34

Browse files
Make optional fields optional in MappingGenericProperty (#703)
Signed-off-by: Alex Dommasch <alex.dommasch@cascadeenergy.com>
1 parent 835ad4e commit 7362d34

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
1414
### Deprecated
1515
### Removed
1616
### Fixed
17+
- Make optional fields optional in `MappingGenericProperty` ([708](https://github.com/opensearch-project/opensearch-js/pull/708))
1718
### Security
1819

1920
## [2.5.0]

api/types.d.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -3907,17 +3907,17 @@ export interface MappingFloatRangeProperty extends MappingRangePropertyBase {
39073907
}
39083908

39093909
export interface MappingGenericProperty extends MappingDocValuesPropertyBase {
3910-
analyzer: string;
3911-
boost: double;
3912-
fielddata: IndicesStringFielddata;
3913-
ignore_malformed: boolean;
3914-
index: boolean;
3915-
index_options: MappingIndexOptions;
3916-
norms: boolean;
3917-
null_value: string;
3918-
position_increment_gap: integer;
3919-
search_analyzer: string;
3920-
term_vector: MappingTermVectorOption;
3910+
analyzer?: string;
3911+
boost?: double;
3912+
fielddata?: IndicesStringFielddata;
3913+
ignore_malformed?: boolean;
3914+
index?: boolean;
3915+
index_options?: MappingIndexOptions;
3916+
norms?: boolean;
3917+
null_value?: string;
3918+
position_increment_gap?: integer;
3919+
search_analyzer?: string;
3920+
term_vector?: MappingTermVectorOption;
39213921
type: string;
39223922
}
39233923

test/types/types.test-d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { expectAssignable } from 'tsd';
2+
import { MappingProperty } from '../../api/types';
3+
4+
// https://github.com/opensearch-project/opensearch-js/issues/703
5+
// only manifested when value is in a variable, so the following would *not* catch it:
6+
//
7+
// expectAssignable<MappingProperty>({ type: 'date' });
8+
9+
const x = { type: 'date' };
10+
expectAssignable<MappingProperty>(x);

0 commit comments

Comments
 (0)