LiformBundle icon indicating copy to clipboard operation
LiformBundle copied to clipboard

widget instead of format

Open ghost opened this issue 7 years ago • 5 comments

The bundle is working properly, but it returns widget instead of format. "address": { "type": "string", "title": "Email address", "widget": "email", "propertyOrder": 2 },

ghost avatar Dec 21 '17 09:12 ghost

Yes, this should be fixed. There are widgets like "textarea" that are only UI hints, but the case of email the rule should be stronger, not only a UI hint.

nacmartin avatar Dec 21 '17 11:12 nacmartin

I faced the very same issue and I've already applied a patch in my local branch. Before opening a PR I want to share a couple of points:

  1. I think that widget should be completely removed from the response. It's an information related to the UI and thus it has nothing to do with the data model

  2. At the moment I only support email format. I will also add support for date related form but this open a space to discussion. According to this document http://json-schema.org/latest/json-schema-validation.html#rfc.section.7.3 datetime should be sent using the format YYYY-MM-DDTHH:MM:SS.FFFZ while date must have the format YYYY-MM-DD. This means that we should not consider the parameter format for the DateType and DateTimeType. See https://symfony.com/doc/current/reference/forms/types/datetime.html#format and https://symfony.com/doc/current/reference/forms/types/date.html#format

Are these 2 point ok for you ?

hpatoio avatar Mar 21 '18 14:03 hpatoio

@hpatoio there will always be information related with the UI that has nothing to do with the data model here. Otherwise we cannot build a form generator based on json-schema, because we will need more information apart from what is needed to simply describe the data.

nacmartin avatar Mar 21 '18 17:03 nacmartin

@nacmartin ok. What about the point 2 ?

hpatoio avatar Mar 22 '18 08:03 hpatoio

Anyone knows how to change the key widget to format ?

Or how to solve this issue ?

I am using angular-schema-form to handle forms. @hpatoio do you know how to sold this issue ? Thanks in advance.

hugoalexmartins avatar Aug 07 '18 21:08 hugoalexmartins