Skip to content
This repository was archived by the owner on Jan 21, 2023. It is now read-only.
This repository was archived by the owner on Jan 21, 2023. It is now read-only.

Pydantic field validations should not be stricter than the Structurizr server #40

Open
@yt-ms

Description

@yt-ms

Problem description

With a new workspace in the Structurizr UI, many fields are optional (may be left blank). The model we have using Pydantic is more strict than this, which means that trying to get the workspace fails on deserialisation.

Code Sample

The stacktrace below is from creating a new workspace with a system context view that has no description. There may well be a host of other fields with the same problem.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\users\xxx\dev\structurizr-python\src\structurizr\api\structurizr_client.py", line 145, in get_workspace
    return Workspace.hydrate(WorkspaceIO.parse_raw(response.text))
  File "pydantic\main.py", line 478, in pydantic.main.BaseModel.parse_raw
  File "pydantic\main.py", line 455, in pydantic.main.BaseModel.parse_obj
  File "pydantic\main.py", line 346, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for WorkspaceIO
views -> systemContextViews -> 0 -> description
  field required (type=value_error.missing)

Context

System Information
==================
OS         Windows
OS-release      10
Python       3.7.5

Package Versions
================
depinfo                       1.5.4
httpx                        0.15.3
importlib_metadata            1.7.0
ordered-set                     3.1
pip                          20.2.4
pydantic                      1.6.1
python-dotenv                0.14.0
setuptools                   41.2.0
structurizr-python 0.1.0+1.g58d76cb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions