Commit 202f8595 authored by Guillaume Vandevelde's avatar Guillaume Vandevelde
Browse files

[mappers] Fix the AttributeMapper to give the translated title in the resulting json schema

The title is not needed for the support of the translation for all the schema entries.

branch : 0.1
parent 4e9e472f2e25
Pipeline #119393 failed with stages
in 1 minute and 32 seconds
......@@ -522,6 +522,8 @@ class AttributeMapper(BaseRelationMapper):
def jsl_field(self, schema_role, **kwargs):
kwargs.setdefault('format', self.format)
if hasattr(self, 'title') and self.title:
kwargs['title'] = self.title
if schema_role in (CREATION_ROLE, EDITION_ROLE):
if 'required' not in kwargs and self.attr.cardinality[0] == '1':
kwargs['required'] = True
......@@ -136,6 +136,7 @@ class RelationMapperTC(CubicWebTC):
{'enum': ['png'], 'title': 'png', 'type': 'string'},
'default': 'png',
'title': 'media_type',
self.assertEqual(field.get_schema(), expected)
adapter = self.vreg['adapters'].select(
......@@ -692,7 +693,6 @@ class EntityMapperTC(CubicWebTC):
expected['definitions']['EXIF data']['required'] = ['flash']
expected['properties']['media_type']['default'] = 'png'
del expected['properties']['media_type']['type']
del expected['properties']['media_type']['title']
expected['properties']['media_type']['oneOf'] = [
{'enum': ['jpeg'], 'title': 'jpeg', 'type': 'string'},
{'enum': ['png'], 'title': 'png', 'type': 'string'},
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment