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

add dynamic property to type definition #58852

Merged
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
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