Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Feb 4, 2020
1 parent abc1f8d commit 1623d8e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
15 changes: 13 additions & 2 deletions src/core/server/saved_objects/mappings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ export interface SavedObjectsMappingProperties {
/**
* Describe a {@link SavedObjectsTypeMappingDefinition | saved object type mapping} field.
*
* Please refer to {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html | elasticsearch documentation}
* For the mapping documentation
*
* @public
*/
export type SavedObjectsFieldMapping =
Expand All @@ -118,7 +121,11 @@ export interface IndexMappingMeta {
migrationMappingPropertyHashes?: { [k: string]: string };
}

/** @public */
/**
* See {@link SavedObjectsFieldMapping} for documentation.
*
* @public
*/
export interface SavedObjectsCoreFieldMapping {
type: string;
index?: boolean;
Expand All @@ -130,7 +137,11 @@ export interface SavedObjectsCoreFieldMapping {
};
}

/** @public */
/**
* See {@link SavedObjectsFieldMapping} for documentation.
*
* @public
*/
export interface SavedObjectsComplexFieldMapping {
dynamic?: string;
type?: string;
Expand Down
6 changes: 3 additions & 3 deletions src/core/server/saved_objects/serialization/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export class SavedObjectsSerializer {
const { type, namespace } = rawDoc._source;
const namespacePrefix =
namespace && !this.registry.isNamespaceAgnostic(type) ? `${namespace}:` : '';
return (
return Boolean(
type &&
rawDoc._id.startsWith(`${namespacePrefix}${type}:`) &&
rawDoc._source.hasOwnProperty(type)
rawDoc._id.startsWith(`${namespacePrefix}${type}:`) &&
rawDoc._source.hasOwnProperty(type)
);
}

Expand Down

0 comments on commit 1623d8e

Please sign in to comment.