nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (NIFI-4269) GetMongo should be able to provide pure JSON as well as "extended JSON"
Date Tue, 22 Aug 2017 14:02:00 GMT

    [ https://issues.apache.org/jira/browse/NIFI-4269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16136828#comment-16136828
] 

ASF GitHub Bot commented on NIFI-4269:
--------------------------------------

Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2063#discussion_r134486575
  
    --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/GetMongo.java
---
    @@ -120,12 +123,30 @@ public ValidationResult validate(final String subject, final String
value, final
             .addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
             .build();
     
    +    static final String JSON_TYPE_EXTENDED = "Extended";
    +    static final String JSON_TYPE_NORMAL   = "Normal";
    +    static final AllowableValue JSON_EXTENDED = new AllowableValue(JSON_TYPE_EXTENDED,
"Extended JSON",
    +            "Use MongoDB's \"extended JSON\". This is the JSON generated with toJson()
on a MongoDB Document from the Java driver");
    +    static final AllowableValue JSON_NORMAL = new AllowableValue(JSON_TYPE_NORMAL, "Normal
JSON",
    +            "Use Jackson to convert the MongoDB Document into a representation that uses
only standard JSON");
    +    static final PropertyDescriptor JSON_TYPE = new PropertyDescriptor.Builder()
    +            .allowableValues(JSON_EXTENDED, JSON_NORMAL)
    +            .defaultValue(JSON_TYPE_EXTENDED)
    +            .displayName("JSON Type")
    +            .name("json-type")
    +            .description("By default, MongoDB's Java driver returns \"extended JSON\".
Some of the features of this variant of JSON" +
    +            " may cause problems for other JSON parsers that expect only standard JSON
types and conventions. This configuration setting " +
    +            " controls whether to use extended JSON or provide a clean view that conforms
to standard JSON.")
    +            .expressionLanguageSupported(false)
    +            .build();
    --- End diff --
    
    Another nitpick :)  Although there are only two allowable values and the default is one
of them, for consistency this field should be required(true).
    
    Also do you think it would be helpful to add some/all of this description to the processor's
CapabilityDescription too? That description is pretty thin, and this is a nice added feature
so might be good to draw more attention to it :)


> GetMongo should be able to provide pure JSON as well as "extended JSON"
> -----------------------------------------------------------------------
>
>                 Key: NIFI-4269
>                 URL: https://issues.apache.org/jira/browse/NIFI-4269
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Mike Thomsen
>
> GetMongo currently only supports "extended JSON." That results in ugly JSON like this:
> {
>     "timestamp": {
>         "$date": LONG_TIMESTAMP
>     }
> }
> instead of something cleaner like this:
> {
>     "timestamp": "2017-08-07T00:00:00Z"
> }
> GetMongo should be refactored to support both modes of JSON serialization.



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

Mime
View raw message