Skip to content

Commit b6b0006

Browse files
committed
RDBC-747 FacetBase.to_json doesn't care if there are options or not provided
1 parent 2f4ece2 commit b6b0006

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ravendb/documents/queries/facets/definitions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,16 @@ def to_facet_token(self, add_query_parameter: Callable[[object], str]) -> FacetT
4444
pass
4545

4646
def to_json(self) -> Dict:
47-
return {
47+
json_dict = {
4848
"DisplayFieldName": self.display_field_name,
49-
"Options": self.options.to_json(),
5049
"Aggregations": {
5150
aggregation.to_json(): {aggregation_field.to_json() for aggregation_field in aggregation_fields_set}
5251
for aggregation, aggregation_fields_set in self.aggregations.items()
5352
},
5453
}
54+
if self.options:
55+
json_dict["Options"] = self.options.to_json()
56+
return json_dict
5557

5658
@classmethod
5759
def from_json(cls, json_dict: Dict) -> FacetBase:

ravendb/documents/session/document_session.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
from ravendb.documents.indexes.definitions import AbstractCommonApiForIndexes
2020
from ravendb.documents.operations.attachments import (
2121
GetAttachmentOperation,
22-
AttachmentName, CloseableAttachmentResult,
22+
AttachmentName,
23+
CloseableAttachmentResult,
2324
)
2425
from ravendb.documents.operations.batch import BatchOperation
2526
from ravendb.documents.operations.executor import OperationExecutor, SessionOperationExecutor

0 commit comments

Comments
 (0)