Skip to content

Duplicate Publishable attributes in CommonModel + DOI in Dandiset as Optional #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dandischema/consts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DANDI_SCHEMA_VERSION = "0.6.9"
DANDI_SCHEMA_VERSION = "0.6.10"
ALLOWED_INPUT_SCHEMAS = [
"0.4.4",
"0.5.1",
Expand All @@ -12,6 +12,7 @@
"0.6.6",
"0.6.7",
"0.6.8",
"0.6.9",
DANDI_SCHEMA_VERSION,
]

Expand Down
20 changes: 20 additions & 0 deletions dandischema/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,20 @@ class CommonModel(DandiBaseModel):
wasGeneratedBy: Optional[Sequence[Activity]] = Field(
None, json_schema_extra={"nskey": "prov"}
)

# Our current draft dandisets could be coming from Published ones,
# and thus carry their attributes. So we would need to define them here as well
# but make them optional, and `Publishable` would overload to make
# them mandatory.
Comment on lines +1584 to +1587
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when published, the draft state should remove the published by component. or we need a better flow that allows owners to create a new draft state from the latest published record (instead of defaulting to creating one). originally the process mimicked github in that a release is a tag on a branch. we can evolve that to be a staged evolution. draft/unpublished -> published -> create draft/unpublished when any change is made by the owner. i.e. any modification creates a new staged state. when that happens irrelevant attributes can be removed.

but it can continue to have derivedFrom to indicate that this new unpublished state did come from a previous published state.

publishedBy: Optional[Union[AnyHttpUrl, PublishActivity]] = Field(
default=None,
description="The URL should contain the provenance of the publishing process.",
json_schema_extra={"readOnly": True, "nskey": "dandi"},
)
datePublished: Optional[datetime] = Field(
default=None, json_schema_extra={"readOnly": True, "nskey": "schema"}
)

schemaKey: str = Field(
"CommonModel", validate_default=True, json_schema_extra={"readOnly": True}
)
Expand Down Expand Up @@ -1667,6 +1681,12 @@ def contributor_musthave_contact(

version: str = Field(json_schema_extra={"nskey": "schema", "readOnly": True})

doi: Optional[str] = Field(
None,
title="DOI",
pattern=DANDI_DOI_PATTERN,
json_schema_extra={"readOnly": True, "nskey": "dandi"},
)
wasGeneratedBy: Optional[Sequence[Project]] = Field(
None,
title="Associated projects",
Expand Down
Loading