Skip to content

Commit

Permalink
feat: Default openCodelist to whether enum is present, in case openCo…
Browse files Browse the repository at this point in the history
…delist is removed in future
  • Loading branch information
jpmckinney committed Dec 17, 2024
1 parent 2115181 commit 3110af5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ocdskit/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,13 @@ def get_schema_fields(


def _codelist(subschema):
default = 'enum' not in subschema
if codelist := subschema.get('codelist'):
return codelist, subschema.get('openCodelist', False)
return codelist, subschema.get('openCodelist', default)
# The behavior hasn't been decided if `items` is an array (e.g. with conflicting codelist-related values).
if (items := subschema.get('items')) and isinstance(items, dict):
return items.get('codelist', ''), items.get('openCodelist', False)
return '', False
return items.get('codelist', ''), items.get('openCodelist', default)
return '', default


def _deprecated(value):
Expand Down

0 comments on commit 3110af5

Please sign in to comment.