You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/02/04 08:00:56 UTC

[camel] 03/04: Include enums in dataformat documentation

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 08f7b19d29668d1f390976693b019de621c51e61
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Feb 4 08:59:55 2020 +0100

    Include enums in dataformat documentation
---
 components/camel-any23/src/main/docs/any23-dataformat.adoc     |  2 +-
 components/camel-bindy/src/main/docs/bindy-dataformat.adoc     |  2 +-
 components/camel-csv/src/main/docs/csv-dataformat.adoc         |  2 +-
 .../camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc |  2 +-
 .../src/main/docs/fhirJson-dataformat.adoc                     |  2 +-
 .../camel-fhir-component/src/main/docs/fhirXml-dataformat.adoc |  2 +-
 components/camel-gson/src/main/docs/json-gson-dataformat.adoc  |  2 +-
 .../camel-jackson/src/main/docs/json-jackson-dataformat.adoc   |  2 +-
 components/camel-jaxb/src/main/docs/jaxb-dataformat.adoc       |  2 +-
 .../camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc   |  2 +-
 .../camel-protobuf/src/main/docs/protobuf-dataformat.adoc      |  2 +-
 .../src/main/docs/yaml-snakeyaml-dataformat.adoc               |  2 +-
 components/camel-thrift/src/main/docs/thrift-dataformat.adoc   |  2 +-
 .../camel-xstream/src/main/docs/json-xstream-dataformat.adoc   |  2 +-
 .../org/apache/camel/maven/packaging/UpdateReadmeMojo.java     | 10 +++++++++-
 15 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/components/camel-any23/src/main/docs/any23-dataformat.adoc b/components/camel-any23/src/main/docs/any23-dataformat.adoc
index 08e0ce2..f24c0d0 100644
--- a/components/camel-any23/src/main/docs/any23-dataformat.adoc
+++ b/components/camel-any23/src/main/docs/any23-dataformat.adoc
@@ -20,7 +20,7 @@ The Any23 dataformat supports 4 options, which are listed below.
 [width="100%",cols="2s,1m,1m,6",options="header"]
 |===
 | Name | Default | Java Type | Description
-| outputFormat | RDF4JMODEL | Any23OutputFormat | What RDF syntax to unmarshal as, can be: NTRIPLES, TURTLE, NQUADS, RDFXML, JSONLD, RDFJSON, RDF4JMODEL. It is by default: RDF4JMODEL.
+| outputFormat | RDF4JMODEL | Any23OutputFormat | What RDF syntax to unmarshal as, can be: NTRIPLES, TURTLE, NQUADS, RDFXML, JSONLD, RDFJSON, RDF4JMODEL. It is by default: RDF4JMODEL. The value can be one of: JSONLD, NQUADS, NTRIPLES, RDF4JMODEL, RDFJSON, RDFXML, TURTLE
 | extractors |  | List | List of Any23 extractors to be used in the unmarshal operation. A list of the available extractors can be found here here. If not provided, all the available extractors are used.
 | baseURI |  | String | The URI to use as base for building RDF entities if only relative paths are provided.
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
diff --git a/components/camel-bindy/src/main/docs/bindy-dataformat.adoc b/components/camel-bindy/src/main/docs/bindy-dataformat.adoc
index 4876795..9102b29 100644
--- a/components/camel-bindy/src/main/docs/bindy-dataformat.adoc
+++ b/components/camel-bindy/src/main/docs/bindy-dataformat.adoc
@@ -59,7 +59,7 @@ The Bindy dataformat supports 6 options, which are listed below.
 [width="100%",cols="2s,1m,1m,6",options="header"]
 |===
 | Name | Default | Java Type | Description
-| type |  | BindyType | Whether to use Csv, Fixed, or KeyValue.
+| type |  | BindyType | Whether to use Csv, Fixed, or KeyValue. The value can be one of: Csv, Fixed, KeyValue
 | classType |  | String | Name of model class to use.
 | locale |  | String | To configure a default locale to use, such as us for united states. To use the JVM platform default locale then use the name default
 | unwrapSingleInstance | true | Boolean | When unmarshalling should a single instance be unwrapped and returned instead of wrapped in a java.util.List.
diff --git a/components/camel-csv/src/main/docs/csv-dataformat.adoc b/components/camel-csv/src/main/docs/csv-dataformat.adoc
index 9098b9f..7290b24 100644
--- a/components/camel-csv/src/main/docs/csv-dataformat.adoc
+++ b/components/camel-csv/src/main/docs/csv-dataformat.adoc
@@ -20,7 +20,7 @@ The CSV dataformat supports 29 options, which are listed below.
 |===
 | Name | Default | Java Type | Description
 | formatRef |  | String | The reference format to use, it will be updated with the other format options, the default value is CSVFormat.DEFAULT
-| formatName |  | String | The name of the format to use, the default value is CSVFormat.DEFAULT
+| formatName |  | String | The name of the format to use, the default value is CSVFormat.DEFAULT. The value can be one of: DEFAULT, EXCEL, INFORMIX_UNLOAD, INFORMIX_UNLOAD_CSV, MYSQL, RFC4180
 | commentMarkerDisabled | false | Boolean | Disables the comment marker of the reference format.
 | commentMarker |  | String | Sets the comment marker of the reference format.
 | delimiter |  | String | Sets the delimiter to use. The default value is , (comma)
diff --git a/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc b/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
index db9ac32..e09a2ca 100644
--- a/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
+++ b/components/camel-fastjson/src/main/docs/json-fastjson-dataformat.adoc
@@ -27,7 +27,7 @@ The JSon Fastjson dataformat supports 20 options, which are listed below.
 | objectMapper |  | String | Lookup and use the existing ObjectMapper with the given id when using Jackson.
 | useDefaultObjectMapper | true | Boolean | Whether to lookup and use default Jackson ObjectMapper from the registry.
 | prettyPrint | false | Boolean | To enable pretty printing output nicely formatted. Is by default false.
-| library | Jackson | JsonLibrary | Which json library to use.
+| library | Jackson | JsonLibrary | Which json library to use. The value can be one of: Fastjson, Gson, Jackson, Johnzon, XStream
 | unmarshalTypeName |  | String | Class name of the java type to use when unarmshalling
 | jsonView |  | Class | When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations
 | include |  | String | If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL
diff --git a/components/camel-fhir/camel-fhir-component/src/main/docs/fhirJson-dataformat.adoc b/components/camel-fhir/camel-fhir-component/src/main/docs/fhirJson-dataformat.adoc
index c5b7164..999b6e3 100644
--- a/components/camel-fhir/camel-fhir-component/src/main/docs/fhirJson-dataformat.adoc
+++ b/components/camel-fhir/camel-fhir-component/src/main/docs/fhirJson-dataformat.adoc
@@ -17,7 +17,7 @@ The FHIR JSon dataformat supports 13 options, which are listed below.
 [width="100%",cols="2s,1m,1m,6",options="header"]
 |===
 | Name | Default | Java Type | Description
-| fhirVersion | DSTU3 | String | The version of FHIR to use. Possible values are: DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4
+| fhirVersion | DSTU3 | String | The version of FHIR to use. Possible values are: DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4. The value can be one of: DSTU2, DSTU2_1, DSTU2_HL7ORG, DSTU3, R4
 | prettyPrint | false | Boolean | Sets the pretty print flag, meaning that the parser will encode resources with human-readable spacing and newlines between elements instead of condensing output as much as possible.
 | serverBaseUrl |  | String | Sets the server's base URL used by this parser. If a value is set, resource references will be turned into relative references if they are provided as absolute URLs but have a base matching the given base.
 | omitResourceId | false | Boolean | If set to true (default is false) the ID of any resources being encoded will not be included in the output. Note that this does not apply to contained resources, only to root resources. In other words, if this is set to true, contained resources will still have local IDs but the outer/containing ID will not have an ID.
diff --git a/components/camel-fhir/camel-fhir-component/src/main/docs/fhirXml-dataformat.adoc b/components/camel-fhir/camel-fhir-component/src/main/docs/fhirXml-dataformat.adoc
index ffa66a4..29154ae 100644
--- a/components/camel-fhir/camel-fhir-component/src/main/docs/fhirXml-dataformat.adoc
+++ b/components/camel-fhir/camel-fhir-component/src/main/docs/fhirXml-dataformat.adoc
@@ -17,7 +17,7 @@ The FHIR XML dataformat supports 13 options, which are listed below.
 [width="100%",cols="2s,1m,1m,6",options="header"]
 |===
 | Name | Default | Java Type | Description
-| fhirVersion | DSTU3 | String | The version of FHIR to use. Possible values are: DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4
+| fhirVersion | DSTU3 | String | The version of FHIR to use. Possible values are: DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4. The value can be one of: DSTU2, DSTU2_1, DSTU2_HL7ORG, DSTU3, R4
 | prettyPrint | false | Boolean | Sets the pretty print flag, meaning that the parser will encode resources with human-readable spacing and newlines between elements instead of condensing output as much as possible.
 | serverBaseUrl |  | String | Sets the server's base URL used by this parser. If a value is set, resource references will be turned into relative references if they are provided as absolute URLs but have a base matching the given base.
 | omitResourceId | false | Boolean | If set to true (default is false) the ID of any resources being encoded will not be included in the output. Note that this does not apply to contained resources, only to root resources. In other words, if this is set to true, contained resources will still have local IDs but the outer/containing ID will not have an ID.
diff --git a/components/camel-gson/src/main/docs/json-gson-dataformat.adoc b/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
index 6a1a249..187968f 100644
--- a/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
+++ b/components/camel-gson/src/main/docs/json-gson-dataformat.adoc
@@ -27,7 +27,7 @@ The JSon GSon dataformat supports 20 options, which are listed below.
 | objectMapper |  | String | Lookup and use the existing ObjectMapper with the given id when using Jackson.
 | useDefaultObjectMapper | true | Boolean | Whether to lookup and use default Jackson ObjectMapper from the registry.
 | prettyPrint | false | Boolean | To enable pretty printing output nicely formatted. Is by default false.
-| library | Gson | JsonLibrary | Which json library to use.
+| library | Gson | JsonLibrary | Which json library to use. The value can be one of: Fastjson, Gson, Jackson, Johnzon, XStream
 | unmarshalTypeName |  | String | Class name of the java type to use when unarmshalling
 | jsonView |  | Class | When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations
 | include |  | String | If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL
diff --git a/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc b/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
index f8733ae..4b83b0d 100644
--- a/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
+++ b/components/camel-jackson/src/main/docs/json-jackson-dataformat.adoc
@@ -28,7 +28,7 @@ The JSon Jackson dataformat supports 20 options, which are listed below.
 | objectMapper |  | String | Lookup and use the existing ObjectMapper with the given id when using Jackson.
 | useDefaultObjectMapper | true | Boolean | Whether to lookup and use default Jackson ObjectMapper from the registry.
 | prettyPrint | false | Boolean | To enable pretty printing output nicely formatted. Is by default false.
-| library | Jackson | JsonLibrary | Which json library to use.
+| library | Jackson | JsonLibrary | Which json library to use. The value can be one of: Fastjson, Gson, Jackson, Johnzon, XStream
 | unmarshalTypeName |  | String | Class name of the java type to use when unarmshalling
 | jsonView |  | Class | When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations
 | include |  | String | If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL
diff --git a/components/camel-jaxb/src/main/docs/jaxb-dataformat.adoc b/components/camel-jaxb/src/main/docs/jaxb-dataformat.adoc
index 5627ca8..152455e 100644
--- a/components/camel-jaxb/src/main/docs/jaxb-dataformat.adoc
+++ b/components/camel-jaxb/src/main/docs/jaxb-dataformat.adoc
@@ -20,7 +20,7 @@ The JAXB dataformat supports 18 options, which are listed below.
 | Name | Default | Java Type | Description
 | contextPath |  | String | Package name where your JAXB classes are located.
 | schema |  | String | To validate against an existing schema. Your can use the prefix classpath:, file: or http: to specify how the resource should by resolved. You can separate multiple schema files by using the ',' character.
-| schemaSeverityLevel | 0 | Integer | Sets the schema severity level to use when validating against a schema. This level determines the minimum severity error that triggers JAXB to stop continue parsing. The default value of 0 (warning) means that any error (warning, error or fatal error) will trigger JAXB to stop. There are the following three levels: 0=warning, 1=error, 2=fatal error.
+| schemaSeverityLevel | 0 | Integer | Sets the schema severity level to use when validating against a schema. This level determines the minimum severity error that triggers JAXB to stop continue parsing. The default value of 0 (warning) means that any error (warning, error or fatal error) will trigger JAXB to stop. There are the following three levels: 0=warning, 1=error, 2=fatal error. The value can be one of: 0, 1, 2
 | prettyPrint | false | Boolean | To enable pretty printing output nicely formatted. Is by default false.
 | objectFactory | false | Boolean | Whether to allow using ObjectFactory classes to create the POJO classes during marshalling. This only applies to POJO classes that has not been annotated with JAXB and providing jaxb.index descriptor files.
 | ignoreJAXBElement | false | Boolean | Whether to ignore JAXBElement elements - only needed to be set to false in very special use-cases.
diff --git a/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc b/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
index 53d0f78..a173b41 100644
--- a/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
+++ b/components/camel-johnzon/src/main/docs/json-johnzon-dataformat.adoc
@@ -28,7 +28,7 @@ The JSon Johnzon dataformat supports 20 options, which are listed below.
 | objectMapper |  | String | Lookup and use the existing ObjectMapper with the given id when using Jackson.
 | useDefaultObjectMapper | true | Boolean | Whether to lookup and use default Jackson ObjectMapper from the registry.
 | prettyPrint | false | Boolean | To enable pretty printing output nicely formatted. Is by default false.
-| library | Johnzon | JsonLibrary | Which json library to use.
+| library | Johnzon | JsonLibrary | Which json library to use. The value can be one of: Fastjson, Gson, Jackson, Johnzon, XStream
 | unmarshalTypeName |  | String | Class name of the java type to use when unarmshalling
 | jsonView |  | Class | When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations
 | include |  | String | If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL
diff --git a/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc b/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc
index 6c5cf8c..14a18e7 100644
--- a/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc
+++ b/components/camel-protobuf/src/main/docs/protobuf-dataformat.adoc
@@ -32,7 +32,7 @@ The Protobuf dataformat supports 3 options, which are listed below.
 |===
 | Name | Default | Java Type | Description
 | instanceClass |  | String | Name of class to use when unarmshalling
-| contentTypeFormat | native | String | Defines a content type format in which protobuf message will be serialized/deserialized from(to) the Java been. The format can either be native or json for either native protobuf or json fields representation. The default value is native.
+| contentTypeFormat | native | String | Defines a content type format in which protobuf message will be serialized/deserialized from(to) the Java been. The format can either be native or json for either native protobuf or json fields representation. The default value is native. The value can be one of: json, native
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc b/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc
index bfe9a15..555d104 100644
--- a/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc
+++ b/components/camel-snakeyaml/src/main/docs/yaml-snakeyaml-dataformat.adoc
@@ -25,7 +25,7 @@ The YAML SnakeYAML dataformat supports 11 options, which are listed below.
 [width="100%",cols="2s,1m,1m,6",options="header"]
 |===
 | Name | Default | Java Type | Description
-| library | SnakeYAML | YAMLLibrary | Which yaml library to use. By default it is SnakeYAML
+| library | SnakeYAML | YAMLLibrary | Which yaml library to use. By default it is SnakeYAML. The value can be one of: SnakeYAML
 | unmarshalTypeName |  | String | Class name of the java type to use when unarmshalling
 | constructor |  | String | BaseConstructor to construct incoming documents.
 | representer |  | String | Representer to emit outgoing objects.
diff --git a/components/camel-thrift/src/main/docs/thrift-dataformat.adoc b/components/camel-thrift/src/main/docs/thrift-dataformat.adoc
index f10b75b..f7464f8 100644
--- a/components/camel-thrift/src/main/docs/thrift-dataformat.adoc
+++ b/components/camel-thrift/src/main/docs/thrift-dataformat.adoc
@@ -25,7 +25,7 @@ The Thrift dataformat supports 3 options, which are listed below.
 |===
 | Name | Default | Java Type | Description
 | instanceClass |  | String | Name of class to use when unarmshalling
-| contentTypeFormat | binary | String | Defines a content type format in which thrift message will be serialized/deserialized from(to) the Java been. The format can either be native or json for either native binary thrift, json or simple json fields representation. The default value is binary.
+| contentTypeFormat | binary | String | Defines a content type format in which thrift message will be serialized/deserialized from(to) the Java been. The format can either be native or json for either native binary thrift, json or simple json fields representation. The default value is binary. The value can be one of: binary, json, sjson
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc b/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
index faf45b8..d8fee0c 100644
--- a/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
+++ b/components/camel-xstream/src/main/docs/json-xstream-dataformat.adoc
@@ -38,7 +38,7 @@ The JSon XStream dataformat supports 20 options, which are listed below.
 | objectMapper |  | String | Lookup and use the existing ObjectMapper with the given id when using Jackson.
 | useDefaultObjectMapper | true | Boolean | Whether to lookup and use default Jackson ObjectMapper from the registry.
 | prettyPrint | false | Boolean | To enable pretty printing output nicely formatted. Is by default false.
-| library | XStream | JsonLibrary | Which json library to use.
+| library | XStream | JsonLibrary | Which json library to use. The value can be one of: Fastjson, Gson, Jackson, Johnzon, XStream
 | unmarshalTypeName |  | String | Class name of the java type to use when unarmshalling
 | jsonView |  | Class | When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. This option is to refer to the class which has JsonView annotations
 | include |  | String | If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, you can set this option to NON_NULL
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
index 622a524..be09a92 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
@@ -746,7 +746,7 @@ public class UpdateReadmeMojo extends AbstractMojo {
         return component;
     }
 
-    private static DataFormatModel generateDataFormatModel(String json) {
+    private DataFormatModel generateDataFormatModel(String json) {
         DataFormatModel model = JsonMapper.generateDataFormatModel(json);
         // skip option named id
         model.getOptions().removeIf(opt -> Objects.equals(opt.getName(), "id"));
@@ -762,6 +762,14 @@ public class UpdateReadmeMojo extends AbstractMojo {
             }
             option.setDescription(desc);
         });
+        model.getOptions().stream().filter(o -> o.getEnums() != null).forEach(option -> {
+            String desc = option.getDescription();
+            if (!desc.endsWith(".")) {
+                desc = desc + ".";
+            }
+            desc = desc + " The value can be one of: " + wrapEnumValues(option.getEnums());
+            option.setDescription(desc);
+        });
         return model;
     }