From 5022a5ee07e61614e585b3fd86c410ac9e04e750 Mon Sep 17 00:00:00 2001 From: exceptionfactory Date: Wed, 26 Jan 2022 08:03:26 -0600 Subject: [PATCH] NIFI-9630 Migrated Registry REST API docs to swagger-codegen (#5715) - Added swagger-codegen-maven-plugin configuration - Removed swagger2markup-maven-plugin and asciidoctor-maven-plugin configurations - Removed generation of legacy REST API documentation and associated templates --- .../nifi-registry-docs/pom.xml | 16 +- .../src/main/asciidoc/user-guide.adoc | 2 +- .../nifi-registry-web-api/pom.xml | 80 +-- .../src/main/resources/templates/endpoint.hbs | 61 -- .../src/main/resources/templates/example.hbs | 18 - .../main/resources/templates/index.html.hbs | 550 ------------------ .../main/resources/templates/operation.hbs | 110 ---- .../resources/templates/style.css.mustache | 138 +++++ .../src/main/resources/templates/type.hbs | 57 -- .../main/webapp/WEB-INF/jsp/documentation.jsp | 2 +- 10 files changed, 167 insertions(+), 867 deletions(-) delete mode 100644 nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/endpoint.hbs delete mode 100644 nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/example.hbs delete mode 100644 nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/index.html.hbs delete mode 100644 nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/operation.hbs create mode 100644 nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/style.css.mustache delete mode 100644 nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/type.hbs diff --git a/nifi-registry/nifi-registry-core/nifi-registry-docs/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-docs/pom.xml index c507811177..2dfdc24a65 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-docs/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-docs/pom.xml @@ -85,7 +85,7 @@ - + org.apache.maven.plugins maven-dependency-plugin @@ -100,15 +100,15 @@ org.apache.nifi.registry nifi-registry-web-api - ${project.build.directory}/nifi-registry-web-api/ - **/rest-api.html + ${project.build.directory}/nifi-registry-web-api + docs/rest-api/index.html false false - @@ -125,10 +125,10 @@ - Copy unpacked rest-api.html to generated-docs dir - - - + Copy unpacked rest-api/index.html to generated-docs dir + + + diff --git a/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/user-guide.adoc b/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/user-guide.adoc index 67fe5a4846..b501e542d7 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/user-guide.adoc +++ b/nifi-registry/nifi-registry-core/nifi-registry-docs/src/main/asciidoc/user-guide.adoc @@ -483,4 +483,4 @@ An example of using `curl` to download `my-processors-1.0.0.nar` by id and versi === Additional Actions -For additional actions that can be performed related to bundles, please consult the link:rest-api.html[REST API documentation]. +For additional actions that can be performed related to bundles, please consult the link:../rest-api/index.html[REST API documentation]. diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml index e0ba88fb5c..d6b032e914 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/pom.xml @@ -94,8 +94,6 @@ ${swagger.source.dir}/security-definitions.json - classpath:/templates/index.html.hbs - ${docs.dir}/rest-api/index.html ${swagger.generated.dir} @@ -123,6 +121,25 @@ + + io.swagger.codegen.v3 + swagger-codegen-maven-plugin + 3.0.31 + + + compile + + generate + + + ${swagger.generated.dir}/swagger.json + ${docs.dir}/rest-api + html + src/main/resources/templates + + + + com.googlecode.maven-download-plugin download-maven-plugin @@ -188,65 +205,6 @@ - - - io.github.swagger2markup - swagger2markup-maven-plugin - 1.3.3 - - - compile - - convertSwagger2markup - - - ${swagger.generated.dir}/swagger.json - ${asciidoc.generated.dir} - - ASCIIDOC - TAGS - true - - - - - - - - org.asciidoctor - asciidoctor-maven-plugin - 1.5.8 - - ${asciidoc.source.dir} - rest-api.adoc - - article - - 3 - - - - - ${project.version} - Apache NiFi - ${asciidoc.generated.dir} - - - - - output-html - compile - - process-asciidoc - - - html5 - ${docs.dir}/rest-api - rest-api.html - - - - org.apache.rat apache-rat-plugin diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/endpoint.hbs b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/endpoint.hbs deleted file mode 100644 index 1394136c92..0000000000 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/endpoint.hbs +++ /dev/null @@ -1,61 +0,0 @@ -{{!-- - 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. ---}} -
- - {{#post}} -
-
-
POST
-
-
{{summary}}
-
-
- {{> operation}} -
- {{/post}} - {{#get}} -
-
-
GET
-
-
{{summary}}
-
-
- {{> operation}} -
- {{/get}} - {{#put}} -
-
-
PUT
-
-
{{summary}}
-
-
- {{> operation}} -
- {{/put}} - {{#delete}} -
-
-
DELETE
-
-
{{summary}}
-
-
- {{> operation}} -
- {{/delete}} -
\ No newline at end of file diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/example.hbs b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/example.hbs deleted file mode 100644 index 26a4283ec7..0000000000 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/example.hbs +++ /dev/null @@ -1,18 +0,0 @@ -{{!-- - 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. ---}}{{!-- formatting here matters... in whitespace: pre. this is not comprehensive but sufficent for our examples --}} -{{#each properties}} {{#ifeq type "string"}}"{{@key}}": "value"{{/ifeq}}{{#ifeq type "boolean"}}"{{@key}}": true{{/ifeq}}{{#ifeq type "integer"}}"{{@key}}": 0{{/ifeq}}{{#ifeq type "number"}}"{{@key}}": 0.0{{/ifeq}}{{#if $ref}}"{{@key}}": {{/if}}{{#ifeq type "array"}}"{{@key}}": [{{#if items.$ref}}{{else}}"value"{{/if}}]{{/ifeq}}{{#ifeq type "object"}}"{{@key}}": { - "name": {{#if additionalProperties.$ref}}{{else}}{{#ifeq additionalProperties.type "integer"}}0{{else}}"value"{{/ifeq}}{{/if}} - }{{/ifeq}}, -{{/each}} \ No newline at end of file diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/index.html.hbs b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/index.html.hbs deleted file mode 100644 index aca97fed1c..0000000000 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/index.html.hbs +++ /dev/null @@ -1,550 +0,0 @@ - - - - - {{info.title}}-{{info.version}} - - - - - - - - -
- -
{{basePath}}
-
{{info.title}} {{info.version}}
-
-
-
-
{{info.description}}
-
-
- -
Bucket endpoints
-
-
- -
-
-
- -
Item endpoints
-
-
- -
-
-
- -
Flow endpoints
-
-
- -
-
-
- -
Bundle endpoints
-
-
- -
-
-
- -
Extension endpoints
-
-
- -
-
-
- -
Extension Repository endpoints
-
-
- -
-
-
- -
Tenant endpoints
-
-
- -
-
-
- -
Policy endpoints
-
-
- -
-
-
- -
Access endpoints
-
-
- -
- - - {{#each definitions}} - {{> type}} - {{/each}} - - \ No newline at end of file diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/operation.hbs b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/operation.hbs deleted file mode 100644 index 64bd582fa6..0000000000 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/operation.hbs +++ /dev/null @@ -1,110 +0,0 @@ -{{!-- - 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. ---}} - \ No newline at end of file diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/style.css.mustache b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/style.css.mustache new file mode 100644 index 0000000000..4dc8b82d81 --- /dev/null +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/style.css.mustache @@ -0,0 +1,138 @@ +{{!-- + 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. +--}} +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 300; + font-stretch: normal; + src: url(https://fonts.gstatic.com/s/opensans/v27/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsiH0B4gaVI.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} + +body { + font-family: "Open Sans","DejaVu Sans",sans-serif; + margin: 0 auto; + width: 100%; + max-width: 62.5em; +} + +h1 { + font-size: 2.75em; + color: rgba(0,0,0,0.85); + font-weight: 300; + font-style: normal; + line-height: 1.2; + word-spacing: -.05em; +} + +h2 { + font-size: 2em; +} + +h3 { + font-size: 1.5em; +} + +h4 { + font-size: 1.25em; +} + +h2, h3, h4, h5, h6 { + font-weight: 300; + font-style: normal; + color: #7a2518; + line-height: 1.2; + word-spacing: -.05em; +} + +a { + color: #2156a5; + text-decoration: none; +} + +h1 > a { + color: #7a2518; +} + +h2 > a { + color: #7a2518; +} + +h3 > a { + color: #7a2518; +} + +h4 > a { + color: #7a2518; +} + +h5 > a { + color: #7a2518; +} + +h6 > a { + color: #7a2518; +} + +pre { + background: #f7f7f8; + line-height: 1.45; + padding: 1em; + border-radius: 4px; +} + +.app-desc { + margin-bottom: 10px; +} + +.license-info { + margin-bottom: 10px; +} + +.license-url { + margin-bottom: 10px; +} + +.http-method { + text-transform: uppercase; +} + +code { + white-space: pre; +} + +code.huge { + font-size: 1.5em; +} + +.up { + display: none; +} + +.field-items { + margin-left: 10px; +} + +.param-desc { + margin-bottom: 10px; +} + +.param-type { + font-style: italic; +} + +.param-header { + font-weight: bold; +} diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/type.hbs b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/type.hbs deleted file mode 100644 index f6f117b586..0000000000 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/resources/templates/type.hbs +++ /dev/null @@ -1,57 +0,0 @@ -{{!-- - 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. ---}} - \ No newline at end of file diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-docs/src/main/webapp/WEB-INF/jsp/documentation.jsp b/nifi-registry/nifi-registry-core/nifi-registry-web-docs/src/main/webapp/WEB-INF/jsp/documentation.jsp index 0db7c41c11..c29fca2c88 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-docs/src/main/webapp/WEB-INF/jsp/documentation.jsp +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-docs/src/main/webapp/WEB-INF/jsp/documentation.jsp @@ -68,7 +68,7 @@
Developer