Skip to content

Commit

Permalink
Make optional fields optional in MappingGenericProperty (#703)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Dommasch <[email protected]>
  • Loading branch information
alex-at-cascade committed Jan 30, 2024
1 parent 835ad4e commit 29c4d1d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
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`
### 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
10 changes: 10 additions & 0 deletions test/types/types.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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);

0 comments on commit 29c4d1d

Please sign in to comment.