Skip to content

Commit

Permalink
fix: pin to fastapi>=0.104.1 to pin swagger ui
Browse files Browse the repository at this point in the history
fixes #337
  • Loading branch information
dwinston committed Nov 3, 2023
1 parent dd1e065 commit ed7de9a
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 119 deletions.
3 changes: 2 additions & 1 deletion components/nmdc_runtime/workflow_execution_activity/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
WorkflowExecutionActivity,
Database,
)
from pydantic import BaseModel
from pydantic import BaseModel, ConfigDict


class ActivityTree(BaseModel):
model_config = ConfigDict(arbitrary_types_allowed=True)
children: list["ActivityTree"] = []
data: WorkflowExecutionActivity
spec: Workflow
Expand Down
2 changes: 1 addition & 1 deletion nmdc_runtime/api/models/capability.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class CapabilityBase(BaseModel):
name: Optional[str]
description: Optional[str]
description: Optional[str] = None


class Capability(CapabilityBase):
Expand Down
14 changes: 7 additions & 7 deletions nmdc_runtime/api/models/id.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
_base_object_name = f"{_naa}:{_shoulder}{_blade}"
pattern_base_object_name = re.compile(_base_object_name)

Naa = constr(regex=_naa)
Shoulder = constr(regex=rf"^{_shoulder}$", min_length=2)
Blade = constr(regex=_blade, min_length=4)
AssignedBaseName = constr(regex=_assigned_base_name)
BaseObjectName = constr(regex=_base_object_name)
Naa = constr(pattern=_naa)
Shoulder = constr(pattern=rf"^{_shoulder}$", min_length=2)
Blade = constr(pattern=_blade, min_length=4)
AssignedBaseName = constr(pattern=_assigned_base_name)
BaseObjectName = constr(pattern=_base_object_name)

NameAssigningAuthority = Literal[tuple(NAA_VALUES)]

Expand Down Expand Up @@ -74,15 +74,15 @@ class IdBindingRequest(BaseModel):
a: Optional[str]
v: Any

@root_validator()
@root_validator(skip_on_failure=True)
def set_or_add_needs_value(cls, values):
op = values.get("o")
if op in (IdBindingOp.set, IdBindingOp.addToSet):
if "v" not in values:
raise ValueError("{'set','add'} operations needs value 'v'.")
return values

@root_validator()
@root_validator(skip_on_failure=True)
def set_or_add_or_rm_needs_attribute(cls, values):
op = values.get("o")
if op in (IdBindingOp.set, IdBindingOp.addToSet, IdBindingOp.rm):
Expand Down
2 changes: 1 addition & 1 deletion nmdc_runtime/api/models/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class JobBase(BaseModel):
workflow: Workflow
name: Optional[str]
description: Optional[str]
description: Optional[str] = None


class JobClaim(BaseModel):
Expand Down
16 changes: 8 additions & 8 deletions nmdc_runtime/api/models/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AccessMethod(BaseModel):
region: Optional[str]
type: AccessMethodType = AccessMethodType.https

@root_validator
@root_validator(skip_on_failure=True)
def at_least_one_of_access_id_and_url(cls, values):
access_id, access_url = values.get("access_id"), values.get("access_url")
if access_id is None and access_url is None:
Expand All @@ -48,7 +48,7 @@ def at_least_one_of_access_id_and_url(cls, values):


ChecksumType = constr(
regex=rf"(?P<checksumtype>({'|'.join(sorted(hashlib.algorithms_guaranteed))}))"
pattern=rf"(?P<checksumtype>({'|'.join(sorted(hashlib.algorithms_guaranteed))}))"
)


Expand All @@ -57,8 +57,8 @@ class Checksum(BaseModel):
type: ChecksumType


DrsId = constr(regex=r"^[A-Za-z0-9._~\-]+$")
PortableFilename = constr(regex=r"^[A-Za-z0-9._\-]+$")
DrsId = constr(pattern=r"^[A-Za-z0-9._~\-]+$")
PortableFilename = constr(pattern=r"^[A-Za-z0-9._\-]+$")


class ContentsObject(BaseModel):
Expand All @@ -67,7 +67,7 @@ class ContentsObject(BaseModel):
id: Optional[DrsId]
name: PortableFilename

@root_validator()
@root_validator(skip_on_failure=True)
def no_contents_means_single_blob(cls, values):
contents, id_ = values.get("contents"), values.get("id")
if contents is None and id_ is None:
Expand All @@ -77,7 +77,7 @@ def no_contents_means_single_blob(cls, values):

ContentsObject.update_forward_refs()

Mimetype = constr(regex=r"^\w+/[-+.\w]+$")
Mimetype = constr(pattern=r"^\w+/[-+.\w]+$")
SizeInBytes = conint(strict=True, ge=0)


Expand All @@ -88,7 +88,7 @@ class Error(BaseModel):

class DrsObjectBase(BaseModel):
aliases: Optional[List[str]]
description: Optional[str]
description: Optional[str] = None
mime_type: Optional[Mimetype]
name: Optional[PortableFilename]

Expand All @@ -102,7 +102,7 @@ class DrsObjectIn(DrsObjectBase):
updated_time: Optional[datetime.datetime]
version: Optional[str]

@root_validator()
@root_validator(skip_on_failure=True)
def no_contents_means_single_blob(cls, values):
contents, access_methods = values.get("contents"), values.get("access_methods")
if contents is None and access_methods is None:
Expand Down
2 changes: 1 addition & 1 deletion nmdc_runtime/api/models/object_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class ObjectTypeBase(BaseModel):
name: Optional[str]
description: Optional[str]
description: Optional[str] = None


class ObjectType(ObjectTypeBase):
Expand Down
2 changes: 1 addition & 1 deletion nmdc_runtime/api/models/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
MetadataT = TypeVar("MetadataT")


PythonImportPath = constr(regex=r"^[A-Za-z0-9_.]+$")
PythonImportPath = constr(pattern=r"^[A-Za-z0-9_.]+$")


class OperationError(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion nmdc_runtime/api/models/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class QueryRun(BaseModel):
result: Optional[Any]
error: Optional[Any]

@root_validator
@root_validator(skip_on_failure=True)
def result_xor_error(cls, values):
result, error = values.get("result"), values.get("error")
if result is None and error is None:
Expand Down
2 changes: 1 addition & 1 deletion nmdc_runtime/api/models/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class WorkflowBase(BaseModel):
name: Optional[str]
description: Optional[str]
description: Optional[str] = None
capability_ids: Optional[List[str]]


Expand Down
6 changes: 3 additions & 3 deletions nmdc_runtime/site/terminusdb/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class NamedThing(DocumentTemplate):
_key = LexicalKey(["id"])
_abstract = []
alternative_identifiers: Set[str]
description: Optional[str]
description: Optional[str] = None
id: str
name: Optional[str]

Expand Down Expand Up @@ -1105,7 +1105,7 @@ class ImageValue(AttributeValue):
null
"""

description: Optional[str]
description: Optional[str] = None
display_order: Optional[str]
url: Optional[str]

Expand Down Expand Up @@ -1150,7 +1150,7 @@ class DataObject(NamedThing):
_key = LexicalKey(["id"])
compression_type: Optional[str]
data_object_type: Optional[str]
description: Optional[str]
description: Optional[str] = None
file_size_bytes: Optional["xsd:long"]
md5_checksum: Optional[str]
name: Optional[str]
Expand Down
26 changes: 13 additions & 13 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ attrs==23.1.0
# -c requirements/main.txt
# cattrs
# requests-cache
black==23.9.1
black==23.10.1
# via
# -c requirements/main.txt
# -r requirements/dev.in
Expand All @@ -23,7 +23,7 @@ certifi==2023.7.22
# via
# -c requirements/main.txt
# requests
charset-normalizer==3.2.0
charset-normalizer==3.3.1
# via
# -c requirements/main.txt
# requests
Expand All @@ -32,7 +32,7 @@ click==8.1.7
# -c requirements/main.txt
# black
# pip-tools
coverage==7.3.1
coverage==7.3.2
# via
# -r requirements/dev.in
# pytest-cov
Expand Down Expand Up @@ -84,7 +84,7 @@ mypy-extensions==1.0.0
# black
nh3==0.2.14
# via readme-renderer
packaging==23.1
packaging==23.2
# via
# -c requirements/main.txt
# black
Expand All @@ -99,7 +99,7 @@ pip-tools==7.3.0
# via -r requirements/dev.in
pkginfo==1.9.6
# via twine
platformdirs==3.10.0
platformdirs==3.11.0
# via
# -c requirements/main.txt
# black
Expand All @@ -108,7 +108,7 @@ pluggy==1.3.0
# via
# -c requirements/main.txt
# pytest
pycodestyle==2.11.0
pycodestyle==2.11.1
# via flake8
pyflakes==3.1.0
# via
Expand All @@ -121,13 +121,13 @@ pygments==2.16.1
# rich
pyproject-hooks==1.0.0
# via build
pytest==7.4.2
pytest==7.4.3
# via
# -c requirements/main.txt
# -r requirements/dev.in
# pytest-asyncio
# pytest-cov
pytest-asyncio==0.21.1
pytest-asyncio==0.22.0
# via -r requirements/dev.in
pytest-cov==4.1.0
# via -r requirements/dev.in
Expand All @@ -152,9 +152,9 @@ requests-toolbelt==0.10.1
# twine
rfc3986==2.0.0
# via twine
rich==13.5.3
rich==13.6.0
# via twine
setuptools-scm==8.0.3
setuptools-scm==8.0.4
# via -r requirements/dev.in
six==1.16.0
# via
Expand Down Expand Up @@ -183,21 +183,21 @@ url-normalize==1.4.3
# via
# -c requirements/main.txt
# requests-cache
urllib3==1.26.16
urllib3==1.26.18
# via
# -c requirements/main.txt
# requests
# requests-cache
# twine
wheel==0.41.2
wheel==0.41.3
# via pip-tools
zipp==3.17.0
# via
# -c requirements/main.txt
# importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
pip==23.2.1
pip==23.3.1
# via
# -r requirements/dev.in
# pip-tools
Expand Down
2 changes: 1 addition & 1 deletion requirements/main.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dagster-graphql
dagster-postgres
dependency-injector
dotted-dict
fastapi>=0.85.0 # using starlette >=0.20.3 for working colon-containing URL paths.
fastapi>=0.104.1 # Pins Swagger UI version to 5.9.0 temporarily to handle a bug crashing it in 5.9.1
fastjsonschema
fnc
frozendict
Expand Down
Loading

0 comments on commit ed7de9a

Please sign in to comment.