Skip to content

Commit

Permalink
feat: added highlight options to search API definition (#1819)
Browse files Browse the repository at this point in the history
* feat: added highlight options to search API definition

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>

* typed dict, does this ever stop or do I have to make it any?

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>

* HighlightOptions schema

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>

* highlight options per resource granularity

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>

* expand range of amundsen-common

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>

* remove ignore

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>

* remove ignore

Signed-off-by: Allison Suarez Miranda <asuarezmiranda@lyft.com>
  • Loading branch information
allisonsuarez authored Apr 26, 2022
1 parent 242c8db commit 23582bd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
17 changes: 15 additions & 2 deletions common/amundsen_common/models/search.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import List, Optional, Dict
from typing import Any, List, Optional, Dict

import attr

from marshmallow3_annotations.ext.attrs import AttrsSchema


@attr.s(auto_attribs=True, kw_only=True)
class HighlightOptions:
enable_highlight: bool = False


class HighlightOptionsSchema(AttrsSchema):
class Meta:
target = HighlightOptions
register_as_scheme = True


@attr.s(auto_attribs=True, kw_only=True)
class Filter:
name: str
Expand All @@ -28,6 +39,8 @@ class SearchRequest:
page_index: Optional[int] = 0
results_per_page: Optional[int] = 10
filters: List[Filter] = []
# highlight options are defined per resource
highlight_options: Optional[Dict[str, HighlightOptions]]


class SearchRequestSchema(AttrsSchema):
Expand All @@ -41,7 +54,7 @@ class SearchResponse:
msg: str
page_index: int
results_per_page: int
results: Dict # type: ignore
results: Dict[str, Any]
status_code: int


Expand Down
2 changes: 1 addition & 1 deletion common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from setuptools import find_packages, setup

__version__ = '0.26.2'
__version__ = '0.27.0'


requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements-dev.txt')
Expand Down
2 changes: 1 addition & 1 deletion requirements-common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# It is recommended to always pin the exact version (not range) - otherwise common upgrade won't trigger unit tests
# on all repositories reyling on this file and any issues that arise from common upgrade might be missed.
amundsen-common>=0.26.0,<0.27.0
amundsen-common>=0.26.0,<=0.27.0
attrs>=19.1.0
boto3==1.17.23
click==7.0
Expand Down

0 comments on commit 23582bd

Please sign in to comment.