Skip to content

Commit

Permalink
add dynamic property to type definition (#58852) (#58886)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet authored Feb 28, 2020
1 parent 8ceec0f commit 30fca56
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [SavedObjectsTypeMappingDefinition](./kibana-plugin-server.savedobjectstypemappingdefinition.md) &gt; [dynamic](./kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md)

## SavedObjectsTypeMappingDefinition.dynamic property

The dynamic property of the mapping. either `false` or 'strict'. Defaults to strict

<b>Signature:</b>

```typescript
dynamic?: false | 'strict';
```
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ const typeDefinition: SavedObjectsTypeMappingDefinition = {

| Property | Type | Description |
| --- | --- | --- |
| [properties](./kibana-plugin-server.savedobjectstypemappingdefinition.properties.md) | <code>SavedObjectsMappingProperties</code> | |
| [dynamic](./kibana-plugin-server.savedobjectstypemappingdefinition.dynamic.md) | <code>false &#124; 'strict'</code> | The dynamic property of the mapping. either <code>false</code> or 'strict'. Defaults to strict |
| [properties](./kibana-plugin-server.savedobjectstypemappingdefinition.properties.md) | <code>SavedObjectsMappingProperties</code> | The underlying properties of the type mapping |

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## SavedObjectsTypeMappingDefinition.properties property

The underlying properties of the type mapping

<b>Signature:</b>

```typescript
Expand Down
3 changes: 3 additions & 0 deletions src/core/server/saved_objects/mappings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
* @public
*/
export interface SavedObjectsTypeMappingDefinition {
/** The dynamic property of the mapping. either `false` or 'strict'. Defaults to strict */
dynamic?: false | 'strict';
/** The underlying properties of the type mapping */
properties: SavedObjectsMappingProperties;
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { IndexMapping } from './../../mappings';
import { IndexMapping, SavedObjectsTypeMappingDefinitions } from './../../mappings';
import { buildActiveMappings, diffMappings } from './build_active_mappings';

describe('buildActiveMappings', () => {
Expand Down Expand Up @@ -49,6 +49,23 @@ describe('buildActiveMappings', () => {
);
});

test('handles the `dynamic` property of types', () => {
const typeMappings: SavedObjectsTypeMappingDefinitions = {
firstType: {
dynamic: 'strict',
properties: { field: { type: 'keyword' } },
},
secondType: {
dynamic: false,
properties: { field: { type: 'long' } },
},
thirdType: {
properties: { field: { type: 'text' } },
},
};
expect(buildActiveMappings(typeMappings)).toMatchSnapshot();
});

test('generated hashes are stable', () => {
const properties = {
aaa: { type: 'keyword', fields: { a: { type: 'keyword' }, b: { type: 'text' } } },
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ export interface SavedObjectsType {

// @public
export interface SavedObjectsTypeMappingDefinition {
// (undocumented)
dynamic?: false | 'strict';
properties: SavedObjectsMappingProperties;
}

Expand Down

0 comments on commit 30fca56

Please sign in to comment.