Camera2: Doc entries no longer have type='enum', instead they use enum='true'
* This allows all entries to have any backing type
(usually a byte, but for availableFormats it's int32)
* No longer need special casing for availableFormats
* No longer need to coerce an enum type into a byte
Change-Id: Ib1d4b93521e90f243b54f66c3d4c4b35032bc06a
diff --git a/camera/docs/metadata_validate.py b/camera/docs/metadata_validate.py
index 6c9c408..0dc4ae9 100755
--- a/camera/docs/metadata_validate.py
+++ b/camera/docs/metadata_validate.py
@@ -236,15 +236,15 @@
%(fully_qualified_name(entry), find_kind(entry), \
entry_container, entry_container))
- typ = entry.attrs.get('type')
- if typ == 'enum':
+ enum = entry.attrs.get('enum')
+ if enum and enum == 'true':
if entry.enum is None:
validate_error(("Entry '%s' in kind '%s' is missing enum") \
% (fully_qualified_name(entry), find_kind(entry),
))
+ success = False
- if typ == 'enum' and entry.enum is not None:
-
+ else:
for value in entry.enum.find_all('value'):
value_id = value.attrs.get('id')
@@ -256,6 +256,12 @@
" numeric.") \
%(fully_qualified_name(entry), value_id))
success = False
+ else:
+ if entry.enum:
+ validate_error(("Entry '%s' kind '%s' has enum el, but no enum attr") \
+ % (fully_qualified_name(entry), find_kind(entry),
+ ))
+ success = False
return success