Skip to content

Commit

Permalink
Make optional fields optional in MappingGenericProperty (#703) (#708)
Browse files Browse the repository at this point in the history
Signed-off-by: alex-at-cascade <alex.dommasch@cascadeenergy.com>
  • Loading branch information
alex-at-cascade authored Feb 6, 2024
1 parent 4f241f2 commit c67d82f
Show file tree
Hide file tree
Showing 3 changed files with 32 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` ([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);

0 comments on commit c67d82f

Please sign in to comment.