You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/05/14 03:45:31 UTC

[GitHub] [flink] TsReaper opened a new pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

TsReaper opened a new pull request #12141:
URL: https://github.com/apache/flink/pull/12141


   ## What is the purpose of the change
   
   Currently only ConfigOptions support @ExcludeFromDocumentation annotation in document generating.
   
   As FLINK-14807 is going to introduce a non-public REST API, we'll also need to support this annotation when generating REST API documents.
   
   ## Brief change log
   
    - Support `@ExcludeFromDocumentation` annotation in `RestAPIDocGenerator`.
   
   ## Verifying this change
   
   This change can be verified by running the added unit tests.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? yes
     - If yes, how is the feature documented? JavaDocs
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12141:
URL: https://github.com/apache/flink/pull/12141#issuecomment-628375347


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236",
       "triggerID" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1260",
       "triggerID" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c7a835625072893c37381a3844d7ad4334ad4318",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c7a835625072893c37381a3844d7ad4334ad4318",
       "triggerType" : "PUSH"
     }, {
       "hash" : "562929e227cfc1ca070b2085d37bae032b751e29",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1272",
       "triggerID" : "562929e227cfc1ca070b2085d37bae032b751e29",
       "triggerType" : "PUSH"
     }, {
       "hash" : "33540fd645685b066dab03bfffc1bf8f7d1f2ca1",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "33540fd645685b066dab03bfffc1bf8f7d1f2ca1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c7a835625072893c37381a3844d7ad4334ad4318 UNKNOWN
   * 562929e227cfc1ca070b2085d37bae032b751e29 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1272) 
   * 33540fd645685b066dab03bfffc1bf8f7d1f2ca1 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] tillrohrmann commented on a change in pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
tillrohrmann commented on a change in pull request #12141:
URL: https://github.com/apache/flink/pull/12141#discussion_r425153435



##########
File path: flink-docs/src/test/java/org/apache/flink/docs/rest/RestAPIDocGeneratorTest.java
##########
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.docs.rest;
+
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.docs.rest.data.TestEmptyMessageHeaders;
+import org.apache.flink.docs.rest.data.TestExcludeMessageHeaders;
+import org.apache.flink.runtime.rest.handler.RestHandlerSpecification;
+import org.apache.flink.runtime.rest.util.DocumentingRestEndpoint;
+import org.apache.flink.runtime.rest.versioning.RestAPIVersion;
+import org.apache.flink.util.FileUtils;
+import org.apache.flink.util.TestLogger;
+
+import org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Tests for the {@link RestAPIDocGenerator}.
+ */
+public class RestAPIDocGeneratorTest extends TestLogger {
+
+	@Test
+	public void testExcludeFromDocumentation() throws Exception {
+		File file = File.createTempFile("rest_v0_", ".html");
+		RestAPIDocGenerator.createHtmlFile(
+			new TestExcludeDocumentingRestEndpoint(),
+			RestAPIVersion.V0,
+			file.toPath());
+		String actual = FileUtils.readFile(file, "UTF-8");
+
+		Assert.assertTrue(actual.contains("/test/empty1"));
+		Assert.assertTrue(actual.contains("This is a testing REST API."));
+		Assert.assertTrue(actual.contains("/test/empty2"));
+		Assert.assertTrue(actual.contains("This is another testing REST API."));
+		Assert.assertFalse(actual.contains("/test/exclude1"));
+		Assert.assertFalse(actual.contains("This REST API should not appear in the generated documentation."));
+		Assert.assertFalse(actual.contains("/test/exclude2"));
+		Assert.assertFalse(actual.contains("This REST API should also not appear in the generated documentation."));

Review comment:
       Nit: I usually prefer `assertThat(actual, containsString(...))` as it provides slightly better error message in case the assertion fails.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12141:
URL: https://github.com/apache/flink/pull/12141#issuecomment-628375347


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236",
       "triggerID" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1260",
       "triggerID" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c7a835625072893c37381a3844d7ad4334ad4318",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c7a835625072893c37381a3844d7ad4334ad4318",
       "triggerType" : "PUSH"
     }, {
       "hash" : "562929e227cfc1ca070b2085d37bae032b751e29",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1272",
       "triggerID" : "562929e227cfc1ca070b2085d37bae032b751e29",
       "triggerType" : "PUSH"
     }, {
       "hash" : "33540fd645685b066dab03bfffc1bf8f7d1f2ca1",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1286",
       "triggerID" : "33540fd645685b066dab03bfffc1bf8f7d1f2ca1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c7a835625072893c37381a3844d7ad4334ad4318 UNKNOWN
   * 562929e227cfc1ca070b2085d37bae032b751e29 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1272) 
   * 33540fd645685b066dab03bfffc1bf8f7d1f2ca1 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1286) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12141:
URL: https://github.com/apache/flink/pull/12141#issuecomment-628375347


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236",
       "triggerID" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1260",
       "triggerID" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c7a835625072893c37381a3844d7ad4334ad4318",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c7a835625072893c37381a3844d7ad4334ad4318",
       "triggerType" : "PUSH"
     }, {
       "hash" : "562929e227cfc1ca070b2085d37bae032b751e29",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "562929e227cfc1ca070b2085d37bae032b751e29",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7d395370c88ba5e059f18ad634429d14fd44dc9a Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1260) 
   * c7a835625072893c37381a3844d7ad4334ad4318 UNKNOWN
   * 562929e227cfc1ca070b2085d37bae032b751e29 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12141:
URL: https://github.com/apache/flink/pull/12141#issuecomment-628375347


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236",
       "triggerID" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1260",
       "triggerID" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c7a835625072893c37381a3844d7ad4334ad4318",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c7a835625072893c37381a3844d7ad4334ad4318",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * cc7001d01358400a227d132784534ff6a79b4dc7 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236) 
   * 7d395370c88ba5e059f18ad634429d14fd44dc9a Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1260) 
   * c7a835625072893c37381a3844d7ad4334ad4318 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12141:
URL: https://github.com/apache/flink/pull/12141#issuecomment-628375347


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236",
       "triggerID" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * cc7001d01358400a227d132784534ff6a79b4dc7 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #12141:
URL: https://github.com/apache/flink/pull/12141#issuecomment-628375347


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * cc7001d01358400a227d132784534ff6a79b4dc7 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #12141:
URL: https://github.com/apache/flink/pull/12141#issuecomment-628369444


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit adbe96d4156c85d2b9261c972cb2a6238f1a0ec1 (Thu May 14 03:47:50 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
    * **This pull request references an unassigned [Jira ticket](https://issues.apache.org/jira/browse/FLINK-17680).** According to the [code contribution guide](https://flink.apache.org/contributing/contribute-code.html), tickets need to be assigned before starting with the implementation work.
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] TsReaper commented on pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
TsReaper commented on pull request #12141:
URL: https://github.com/apache/flink/pull/12141#issuecomment-628369757


   @zentol please help for the review. Thanks a lot~


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12141:
URL: https://github.com/apache/flink/pull/12141#issuecomment-628375347


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236",
       "triggerID" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1260",
       "triggerID" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * cc7001d01358400a227d132784534ff6a79b4dc7 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236) 
   * 7d395370c88ba5e059f18ad634429d14fd44dc9a Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1260) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] tillrohrmann closed pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
tillrohrmann closed pull request #12141:
URL: https://github.com/apache/flink/pull/12141


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12141:
URL: https://github.com/apache/flink/pull/12141#issuecomment-628375347


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236",
       "triggerID" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * cc7001d01358400a227d132784534ff6a79b4dc7 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12141:
URL: https://github.com/apache/flink/pull/12141#issuecomment-628375347


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236",
       "triggerID" : "cc7001d01358400a227d132784534ff6a79b4dc7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "7d395370c88ba5e059f18ad634429d14fd44dc9a",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * cc7001d01358400a227d132784534ff6a79b4dc7 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=1236) 
   * 7d395370c88ba5e059f18ad634429d14fd44dc9a UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] tillrohrmann commented on a change in pull request #12141: [FLINK-17680][docs] Support @ExcludeFromDocumentation when generating REST API documentations

Posted by GitBox <gi...@apache.org>.
tillrohrmann commented on a change in pull request #12141:
URL: https://github.com/apache/flink/pull/12141#discussion_r424999798



##########
File path: flink-docs/src/test/java/org/apache/flink/docs/rest/RestAPIDocGeneratorTest.java
##########
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.docs.rest;
+
+import org.apache.flink.docs.rest.data.TestDocumentingRestEndpoint;
+import org.apache.flink.runtime.rest.versioning.RestAPIVersion;
+import org.apache.flink.util.FileUtils;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.File;
+
+/**
+ * Tests for the {@link RestAPIDocGenerator}.
+ */
+public class RestAPIDocGeneratorTest {
+
+	@Test
+	public void testDocGeneration() throws Exception {
+		File file = File.createTempFile("rest_v0_", ".html");
+		RestAPIDocGenerator.createHtmlFile(
+			new TestDocumentingRestEndpoint(),
+			RestAPIVersion.V0,
+			file.toPath());
+		String actual = cleanUpHtml(FileUtils.readFile(file, "UTF-8"));
+
+		File expectedFile = new File(
+			RestAPIDocGeneratorTest.class.getClassLoader().getResource("rest_v0_expected.html").getFile());

Review comment:
       I would be good to have a mean to generate a new `rest_v0_expected.html` in case that it the rest doc generation should change in the future.

##########
File path: flink-docs/src/test/java/org/apache/flink/docs/rest/RestAPIDocGeneratorTest.java
##########
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.docs.rest;
+
+import org.apache.flink.docs.rest.data.TestDocumentingRestEndpoint;
+import org.apache.flink.runtime.rest.versioning.RestAPIVersion;
+import org.apache.flink.util.FileUtils;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.File;
+
+/**
+ * Tests for the {@link RestAPIDocGenerator}.
+ */
+public class RestAPIDocGeneratorTest {
+
+	@Test
+	public void testDocGeneration() throws Exception {
+		File file = File.createTempFile("rest_v0_", ".html");
+		RestAPIDocGenerator.createHtmlFile(
+			new TestDocumentingRestEndpoint(),
+			RestAPIVersion.V0,
+			file.toPath());
+		String actual = cleanUpHtml(FileUtils.readFile(file, "UTF-8"));
+
+		File expectedFile = new File(
+			RestAPIDocGeneratorTest.class.getClassLoader().getResource("rest_v0_expected.html").getFile());
+		String expected = cleanUpHtml(FileUtils.readFile(expectedFile, "UTF-8"));
+
+		Assert.assertEquals(expected, actual);

Review comment:
       This test works as long as `rest_v0_expected.html` is the same as what the `RestAPIDocGenerator` outputs. The problem I see is if we ever need to touch `rest_v0_expected.html`, then we have to make sure that we maintain all the contracts. This means that people need to remember that `@ExcludeFromDocumentation` items should not be listed, for example. A different way of testing this behaviour would to check that `actual` does not contain a message header which is annotated with `@ExcludeFromDocumentation`. This would make the contract more explicit and does not rely on the fact that `rest_v0_expected.html` is actually correct. Otherwise, the test will always pass if `rest_v0_expected.html` and `actual` are actually the same, also if both objects are empty.

##########
File path: flink-docs/src/test/java/org/apache/flink/docs/rest/RestAPIDocGeneratorTest.java
##########
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.docs.rest;
+
+import org.apache.flink.docs.rest.data.TestDocumentingRestEndpoint;
+import org.apache.flink.runtime.rest.versioning.RestAPIVersion;
+import org.apache.flink.util.FileUtils;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.File;
+
+/**
+ * Tests for the {@link RestAPIDocGenerator}.
+ */
+public class RestAPIDocGeneratorTest {

Review comment:
       ```suggestion
   public class RestAPIDocGeneratorTest extends TestLogger {
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org