[jira] [Commented] (ATLAS-1863) Set default value for primitive types attributes in entity based on attributeDef in Typedef

2017-08-23 Thread Pierre Padovani (JIRA)

[ 
https://issues.apache.org/jira/browse/ATLAS-1863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16138871#comment-16138871
 ] 

Pierre Padovani commented on ATLAS-1863:


IMHO - A default value implies that the field is 'not null' *NOT* optional. 
This implies that the field is required to have a value when the entity is 
created, just that user input of the field is optional. Having a default value 
set for an optional field just doesn't make that much sense to me, however 
having it set for a field that is required makes a little more sense but still 
doesn't quite work either.

> Set default value for primitive types attributes in entity based on 
> attributeDef in Typedef
> ---
>
> Key: ATLAS-1863
> URL: https://issues.apache.org/jira/browse/ATLAS-1863
> Project: Atlas
>  Issue Type: Improvement
>  Components: atlas-intg
>Reporter: Nixon Rodrigues
>Assignee: Ruchi Solani
>Priority: Critical
> Fix For: 0.9-incubating
>
> Attachments: ATLAS-1863.2.patch, ATLAS-1863.3.patch, ATLAS-1863.patch
>
>
> While creating entity if attribute value are not set explicitly for primitive 
> type which are optional, then default value should be set from attributedef.
> eg of typedef attributeDef
> {code}
> "attributeDefs": [{
>   "name": "sourceCode",
>   "typeName": "string",
>   "isOptional": true,
>   "cardinality": "SINGLE",
>   "valuesMinCount": 0,
>   "valuesMaxCount": 1,
>   "isUnique": false,
>   "isIndexable": true,
>   "defaultValue": "xyz"
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ATLAS-1863) Set default value for primitive types attributes in entity based on attributeDef in Typedef

2017-06-30 Thread David Radley (JIRA)

[ 
https://issues.apache.org/jira/browse/ATLAS-1863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16070121#comment-16070121
 ] 

David Radley commented on ATLAS-1863:
-

I am not sure about this approach. 
- in principle I would have thought an optional attribute that is not specified 
means that it is not present and should not appear in a get. If we have a 
default value for an optional attribute - this is modelling in the style of an 
RDB schema, where all a tables columns are specified in the schema and need to 
exist in columns in the table, I would think we want to be looser than this. 
Json is flexible enough not to insist on attribute values being specified in 
the instances.
- if we add defaultvalue to attributeDef it should have a meaning for all 
attributeDefs, including those of type struc or enum. I think it would be 
unintuitive to have a default structure when it was optional. 

Can you share the use cases you are thinking of that drive the need for this 
change please?
 

> Set default value for primitive types attributes in entity based on 
> attributeDef in Typedef
> ---
>
> Key: ATLAS-1863
> URL: https://issues.apache.org/jira/browse/ATLAS-1863
> Project: Atlas
>  Issue Type: Improvement
>  Components: atlas-intg
>Reporter: Nixon Rodrigues
>Assignee: Ruchi Solani
>Priority: Critical
> Fix For: 0.9-incubating
>
> Attachments: ATLAS-1863.2.patch, ATLAS-1863.3.patch, ATLAS-1863.patch
>
>
> While creating entity if attribute value are not set explicitly for primitive 
> type which are optional, then default value should be set from attributedef.
> eg of typedef attributeDef
> {code}
> "attributeDefs": [{
>   "name": "sourceCode",
>   "typeName": "string",
>   "isOptional": true,
>   "cardinality": "SINGLE",
>   "valuesMinCount": 0,
>   "valuesMaxCount": 1,
>   "isUnique": false,
>   "isIndexable": true,
>   "defaultValue": "xyz"
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)