Skip to content

Commit

Permalink
Publish hidden resources docs (#2501)
Browse files Browse the repository at this point in the history
  • Loading branch information
javitonino authored Sep 27, 2024
1 parent c68cfd6 commit a1a6972
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion nucliadb/src/nucliadb/search/api/v1/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ async def find_knowledgebox(
with_synonyms: bool = fastapi_query(SearchParamDefaults.with_synonyms),
autofilter: bool = fastapi_query(SearchParamDefaults.autofilter),
security_groups: list[str] = fastapi_query(SearchParamDefaults.security_groups),
show_hidden: bool = fastapi_query(SearchParamDefaults.show_hidden, include_in_schema=False),
show_hidden: bool = fastapi_query(SearchParamDefaults.show_hidden),
reranker: Reranker = fastapi_query(SearchParamDefaults.reranker),
x_ndb_client: NucliaDBClientType = Header(NucliaDBClientType.API),
x_nucliadb_user: str = Header(""),
Expand Down
4 changes: 2 additions & 2 deletions nucliadb/src/nucliadb/search/api/v1/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ async def search_knowledgebox(
with_synonyms: bool = fastapi_query(SearchParamDefaults.with_synonyms),
autofilter: bool = fastapi_query(SearchParamDefaults.autofilter),
security_groups: list[str] = fastapi_query(SearchParamDefaults.security_groups),
show_hidden: bool = fastapi_query(SearchParamDefaults.show_hidden, include_in_schema=False),
show_hidden: bool = fastapi_query(SearchParamDefaults.show_hidden),
x_ndb_client: NucliaDBClientType = Header(NucliaDBClientType.API),
x_nucliadb_user: str = Header(""),
x_forwarded_for: str = Header(""),
Expand Down Expand Up @@ -239,7 +239,7 @@ async def catalog_get(
range_modification_end: Optional[DateTime] = fastapi_query(
SearchParamDefaults.range_modification_end
),
hidden: Optional[bool] = fastapi_query(SearchParamDefaults.hidden, include_in_schema=False),
hidden: Optional[bool] = fastapi_query(SearchParamDefaults.hidden),
) -> Union[KnowledgeboxSearchResults, HTTPClientError]:
item = CatalogRequest(
query=query,
Expand Down
2 changes: 1 addition & 1 deletion nucliadb/src/nucliadb/search/api/v1/suggest.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async def suggest_knowledgebox(
x_forwarded_for: str = Header(""),
debug: bool = fastapi_query(SearchParamDefaults.debug),
highlight: bool = fastapi_query(SearchParamDefaults.highlight),
show_hidden: bool = fastapi_query(SearchParamDefaults.show_hidden, include_in_schema=False),
show_hidden: bool = fastapi_query(SearchParamDefaults.show_hidden),
) -> Union[KnowledgeboxSuggestResults, HTTPClientError]:
try:
return await suggest(
Expand Down
3 changes: 1 addition & 2 deletions nucliadb_models/src/nucliadb_models/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

from google.protobuf.json_format import MessageToDict
from pydantic import BaseModel, Field, field_validator, model_validator
from pydantic.json_schema import SkipJsonSchema

from nucliadb_models.conversation import FieldConversation
from nucliadb_models.external_index_providers import ExternalIndexProvider
Expand Down Expand Up @@ -297,7 +296,7 @@ class Resource(BaseModel):
last_seqid: Optional[int] = None
last_account_seq: Optional[int] = None
queue: Optional[QueueType] = None
hidden: SkipJsonSchema[Optional[bool]] = None
hidden: Optional[bool] = None

origin: Optional[Origin] = None
extra: Optional[Extra] = None
Expand Down
6 changes: 3 additions & 3 deletions nucliadb_models/src/nucliadb_models/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ class CatalogRequest(BaseModel):
range_modification_end: Optional[DateTime] = (
SearchParamDefaults.range_modification_end.to_pydantic_field()
)
hidden: SkipJsonSchema[Optional[bool]] = SearchParamDefaults.hidden.to_pydantic_field()
hidden: Optional[bool] = SearchParamDefaults.hidden.to_pydantic_field()

@field_validator("faceted")
@classmethod
Expand Down Expand Up @@ -736,7 +736,7 @@ class BaseSearchRequest(BaseModel):
autofilter: bool = SearchParamDefaults.autofilter.to_pydantic_field()
resource_filters: List[str] = SearchParamDefaults.resource_filters.to_pydantic_field()
security: Optional[RequestSecurity] = SearchParamDefaults.security.to_pydantic_field()
show_hidden: SkipJsonSchema[bool] = SearchParamDefaults.show_hidden.to_pydantic_field()
show_hidden: bool = SearchParamDefaults.show_hidden.to_pydantic_field()

rephrase: bool = Field(
default=False,
Expand Down Expand Up @@ -1263,7 +1263,7 @@ class AskRequest(BaseModel):
le=1.0,
)
security: Optional[RequestSecurity] = SearchParamDefaults.security.to_pydantic_field()
show_hidden: SkipJsonSchema[bool] = SearchParamDefaults.show_hidden.to_pydantic_field()
show_hidden: bool = SearchParamDefaults.show_hidden.to_pydantic_field()
rag_strategies: list[RagStrategies] = Field(
default=[],
title="RAG context building strategies",
Expand Down
5 changes: 2 additions & 3 deletions nucliadb_models/src/nucliadb_models/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from typing import Dict, List, Optional, Union

from pydantic import BaseModel, Field, field_validator
from pydantic.json_schema import SkipJsonSchema

from nucliadb_models import content_types
from nucliadb_models.conversation import InputConversationField
Expand Down Expand Up @@ -87,7 +86,7 @@ class CreateResourcePayload(BaseModel):
fieldmetadata: Optional[List[UserFieldMetadata]] = None
origin: Optional[InputOrigin] = None
extra: Optional[Extra] = None
hidden: SkipJsonSchema[Optional[bool]] = None
hidden: Optional[bool] = None

files: Dict[FieldIdString, FileField] = FieldDefaults.files
links: Dict[FieldIdString, LinkField] = FieldDefaults.links
Expand Down Expand Up @@ -138,7 +137,7 @@ class UpdateResourcePayload(BaseModel):
title="Security",
description="Security metadata for the resource. It can be used to have fine-grained control over who can access the resource.", # noqa
)
hidden: SkipJsonSchema[Optional[bool]] = None
hidden: Optional[bool] = None


class ResourceCreated(BaseModel):
Expand Down

0 comments on commit a1a6972

Please sign in to comment.