Skip to content

Commit

Permalink
add text product encoding to CustomJSONEncoder
Browse files Browse the repository at this point in the history
  • Loading branch information
dsavchenko committed Jan 14, 2025
1 parent cd8609b commit 270c40d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions oda_api/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
import logging
import numpy as np

from .data_products import NumpyDataProduct, ODAAstropyTable, PictureProduct, BinaryData, BinaryProduct
from .data_products import (
NumpyDataProduct,
ODAAstropyTable,
PictureProduct,
BinaryData,
BinaryProduct,
TextLikeProduct
)

from astropy.io.fits.card import Undefined as astropyUndefined

Expand All @@ -15,7 +22,11 @@ def default(self, obj):
if isinstance(obj, astropyUndefined):
return "UNDEFINED"

if isinstance(obj, (NumpyDataProduct, ODAAstropyTable, PictureProduct, BinaryProduct)):
if isinstance(obj, (NumpyDataProduct,

Check warning on line 25 in oda_api/json.py

View check run for this annotation

Codecov / codecov/patch

oda_api/json.py#L25

Added line #L25 was not covered by tests
ODAAstropyTable,
PictureProduct,
BinaryProduct,
TextLikeProduct)):
return obj.encode()

if isinstance(obj, BinaryData):
Expand Down

0 comments on commit 270c40d

Please sign in to comment.