Skip to content

adapter: Allow optional contentType in Blob and File#572

Open
paul-gerber-svg wants to merge 1 commit into
eclipse-basyx:developfrom
rwth-iat:fix-optional-contenttype
Open

adapter: Allow optional contentType in Blob and File#572
paul-gerber-svg wants to merge 1 commit into
eclipse-basyx:developfrom
rwth-iat:fix-optional-contenttype

Conversation

@paul-gerber-svg

Copy link
Copy Markdown

Currently, the JSON and XMOL deserializiers raise an error when parsing Blob or File submodels that do not include a contentType

The contentType attribute has a cardinality of 0..1 for both classes and should therefore be optional. The implementation now aligns with this specification and defaults to None if the field is absent in the data.

Currently, the JSON and XMOL deserializiers raise an error when parsing Blob or File submodels that do not include a contentType

The contentType attribute has a cardinality of 0..1 for both classes and should therefore be optional.
The implementation now aligns with this specification and defaults to None if the field is absent in the data.
Comment on lines +695 to +697
content_type = _get_ts(dct, "contentType", str) if 'contentType' in dct else None
ret = object_class(id_short=None,
content_type=_get_ts(dct, "contentType", str))
content_type=content_type)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor nitpick: I think in the rest of this file, it is done in one line directly in the constructor like so:

ret = object_class(
    id_short=None,
    content_type=_get_ts(dct, "contentType", str) if 'contentType' in dct else None
)

Can you adapt the two occurrences please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants