Skip to content

Commit

Permalink
add nested override for recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkent committed Apr 26, 2023
1 parent ae95e6e commit cd2c318
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compose/neurosynth_compose/schemas/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class StringOrNested(fields.Nested):
def _serialize(self, value, attr, obj, **kwargs):
if value is None:
return None
nested = self.context.get("nested")
nested = (
False if self.metadata.get("nested", None) is False else self.context.get("nested")
)
nested_attr = self.metadata.get("pluck")
if nested:
many = self.schema.many or self.many
Expand Down Expand Up @@ -161,7 +163,7 @@ class MetaAnalysisSchema(BaseSchema):
annotation = StringOrNested(
AnnotationSchema, metadata={"pluck": "neurostore_id"}, dump_only=True
)
project_id = StringOrNested("ProjectSchema", data_key="project")
project_id = StringOrNested("ProjectSchema", metadata={"nested": False}, data_key="project")
internal_studyset_id = fields.Pluck(
StudysetSchema, "id", load_only=True, attribute="studyset"
)
Expand Down

0 comments on commit cd2c318

Please sign in to comment.