Repository: incubator-nifi Updated Branches: refs/heads/NIFI-292 524606cae -> ead451fc5
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java index 79e457d..fa14936 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java @@ -73,7 +73,6 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Group. */ -//@Path("") // necessary due to bug in swagger @Api(hidden = true) public class ProcessGroupResource extends ApplicationResource { @@ -294,21 +293,27 @@ public class ProcessGroupResource extends ApplicationResource { * @return A processGroupEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ProcessGroupEntity.class) @ApiOperation( value = "Gets the specified process group", response = ProcessGroupEntity.class, authorizations = { - @Authorization(value = "ROLE_MONITOR", type = "ROLE_MONITOR"), - @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), - @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") } ) @ApiResponses( value = { - @ApiResponse(code = 403, message = "Client is not authorized to make this request") + @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(code = 401, message = "Client could not be authenticated."), + @ApiResponse(code = 403, message = "Client is not authorized to make this request."), + @ApiResponse(code = 404, message = "The specified resource could not be found."), + @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") } ) public Response getProcessGroup( @@ -366,6 +371,22 @@ public class ProcessGroupResource extends ApplicationResource { @Path("/snippet-instance") @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(FlowSnippetEntity.class) + @ApiOperation( + value = "Creates a new flow snippet", + response = FlowSnippetEntity.class, + authorizations = { + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(code = 401, message = "Client could not be authenticated."), + @ApiResponse(code = 403, message = "Client is not authorized to make this request."), + @ApiResponse(code = 404, message = "The specified resource could not be found."), + @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + } + ) public Response copySnippet( @Context HttpServletRequest httpServletRequest, @FormParam(VERSION) LongParameter version, @@ -519,6 +540,7 @@ public class ProcessGroupResource extends ApplicationResource { @PUT @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ProcessGroupEntity.class) public Response updateProcessGroup( @@ -561,6 +583,7 @@ public class ProcessGroupResource extends ApplicationResource { @PUT @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ProcessGroupEntity.class) public Response updateProcessGroup( @@ -635,6 +658,7 @@ public class ProcessGroupResource extends ApplicationResource { * @return A processGroupEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/process-group-references/{id}") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @@ -687,6 +711,7 @@ public class ProcessGroupResource extends ApplicationResource { * @return A controllerEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/process-group-references") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @@ -1004,6 +1029,7 @@ public class ProcessGroupResource extends ApplicationResource { * @return A processGroupEntity. */ @DELETE + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/process-group-references/{id}") @PreAuthorize("hasRole('ROLE_DFM')") @@ -1060,6 +1086,7 @@ public class ProcessGroupResource extends ApplicationResource { * @return A processGroupStatusEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/status") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN', 'ROLE_NIFI')") @@ -1105,6 +1132,7 @@ public class ProcessGroupResource extends ApplicationResource { * @return A processorEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/status/history") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java index e66778b..41f9cd5 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java @@ -18,6 +18,7 @@ package org.apache.nifi.web.api; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiParam; import com.wordnik.swagger.annotations.ApiResponse; import com.wordnik.swagger.annotations.ApiResponses; import com.wordnik.swagger.annotations.Authorization; @@ -160,8 +161,27 @@ public class ProcessorResource extends ApplicationResource { */ @GET @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ProcessorsEntity.class) + @ApiOperation( + value = "Gets all processors", + response = ProcessorsEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(code = 401, message = "Client could not be authenticated."), + @ApiResponse(code = 403, message = "Client is not authorized to make this request."), + @ApiResponse(code = 404, message = "The specified resource could not be found."), + @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + } + ) public Response getProcessors(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { // replicate if cluster manager @@ -204,6 +224,7 @@ public class ProcessorResource extends ApplicationResource { @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ProcessorEntity.class) public Response createProcessor( @@ -251,10 +272,31 @@ public class ProcessorResource extends ApplicationResource { @POST @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ProcessorEntity.class) + @ApiOperation( + value = "Creates a new processor", + response = ProcessorEntity.class, + authorizations = { + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(code = 401, message = "Client could not be authenticated."), + @ApiResponse(code = 403, message = "Client is not authorized to make this request."), + @ApiResponse(code = 404, message = "The specified resource could not be found."), + @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + } + ) public Response createProcessor( @Context HttpServletRequest httpServletRequest, + @ApiParam( + value = "The processor configuration details", + required = true + ) ProcessorEntity processorEntity) { if (processorEntity == null || processorEntity.getProcessor() == null) { @@ -345,14 +387,18 @@ public class ProcessorResource extends ApplicationResource { value = "Gets the specified processor", response = ProcessorEntity.class, authorizations = { - @Authorization(value = "ROLE_MONITOR", type = "ROLE_MONITOR"), - @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), - @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") } ) @ApiResponses( value = { - @ApiResponse(code = 403, message = "Client is not authorized to make this request") + @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(code = 401, message = "Client could not be authenticated."), + @ApiResponse(code = 403, message = "Client is not authorized to make this request."), + @ApiResponse(code = 404, message = "The specified resource could not be found."), + @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") } ) public Response getProcessor(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) { @@ -720,10 +766,38 @@ public class ProcessorResource extends ApplicationResource { @Path("/{id}") @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ProcessorEntity.class) + @ApiOperation( + value = "Deletes the specified processor", + response = ProcessorEntity.class, + authorizations = { + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(code = 401, message = "Client could not be authenticated."), + @ApiResponse(code = 403, message = "Client is not authorized to make this request."), + @ApiResponse(code = 404, message = "The specified resource could not be found."), + @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") + } + ) public Response deleteProcessor( @Context HttpServletRequest httpServletRequest, + @ApiParam( + value = "The revision is used to verify the client is working with the latest version of the flow", + required = false + ) @QueryParam(VERSION) LongParameter version, + @ApiParam( + value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response", + required = false + ) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, + @ApiParam( + value = "The processor id", + required = true + ) @PathParam("id") String id) { // replicate if cluster manager http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/endpoint.hbs ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/endpoint.hbs b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/endpoint.hbs index ce2f7d5..6296862 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/endpoint.hbs +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/endpoint.hbs @@ -13,11 +13,12 @@ limitations under the License. --}} <div class="endpoints"> + <span class="path hidden">{{@key}}</span> {{#post}} <div class="endpoint post"> <div class="operation-handle"> <div class="method">POST</div> - <div class="path">{{@key}}</div> + <div class="path mono"></div> <div class="summary">{{summary}}</div> <div class="clear"></div> </div> @@ -28,7 +29,7 @@ <div class="endpoint get"> <div class="operation-handle"> <div class="method">GET</div> - <div class="path">{{@key}}</div> + <div class="path mono"></div> <div class="summary">{{summary}}</div> <div class="clear"></div> </div> @@ -39,7 +40,7 @@ <div class="endpoint put"> <div class="operation-handle"> <div class="method">PUT</div> - <div class="path">{{@key}}</div> + <div class="path mono"></div> <div class="summary">{{summary}}</div> <div class="clear"></div> </div> @@ -50,7 +51,7 @@ <div class="endpoint delete"> <div class="operation-handle"> <div class="method">DELETE</div> - <div class="path">{{@key}}</div> + <div class="path mono"></div> <div class="summary">{{summary}}</div> <div class="clear"></div> </div> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs new file mode 100644 index 0000000..a753cc3 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs @@ -0,0 +1,16 @@ +{{!-- + 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. +--}} +{{#each properties}} {{#ifeq type "string"}}"{{@key}}": "string"{{/ifeq}}{{#ifeq type "integer"}}"{{@key}}": 0{{/ifeq}}{{#if $ref}}"{{@key}}": <span class="nested collapsed"><span class="nested-id hidden">{{basename $ref}}</span><span class="nested-example">{…}</span></span>{{/if}} +{{/each}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs index e169e4e..3516247 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs @@ -37,6 +37,10 @@ font-family: "Open Sans", "DejaVu Sans", sans-serif; } + div.overview { + margin-bottom: 10px; + } + div.endpoint { margin-bottom: 10px; } @@ -113,6 +117,8 @@ border-top: 1px solid #47758E; } + /* operations */ + div.operation-handle { cursor: pointer; padding-right: 5px; @@ -129,10 +135,9 @@ font-weight: bold; } - div.path { + div.endpoint div.path { float: left; line-height: 22px; - font-family: monospace; } div.summary { @@ -143,8 +148,115 @@ div.operation { padding: 5px; + font-size: 12px; + } + + div.operation > div.title { + font-weight: bold; + color: #000; + } + + div.operation div.details { + margin-left: 5px; + margin-bottom: 5px; + color: #333; + } + + div.operation div.description { + margin-bottom: 10px; + } + + div.mediatype { + line-height: 16px; } + div.mediatype > div.title { + float: left; + width: 70px; + } + + div.mediatype div.title { + float: left; + } + + div.type { + position: fixed; + width: 800px; + height: 500px; + left: 50%; + top: 50%; + margin-left: -400px; + margin-top: -250px; + border: 3px solid #365C6A; + box-shadow: 4px 4px 6px rgba(0, 0, 0, 0.9); + padding: 10px; + background-color: #eee; + font-size: 12px; + overflow-y: scroll; + } + + /* tables */ + + table { + background-color: #fefefe; + border: 1px solid #ccc; + border-left: 6px solid #ccc; + color: #555; + display: block; + margin-bottom: 12px; + padding: 5px 8px; + } + + table th { + font-weight: bold; + vertical-align:top; + text-align:left; + padding: 4px 15px; + border-width: 0; + white-space: nowrap; + } + + table td { + vertical-align:top; + text-align:left; + padding: 2px 15px; + border-width: 0; + white-space: nowrap; + } + + table td:last-child { + width: 99%; + white-space: normal; + } + + code.example { + background-color: #fefefe; + border: 1px solid #ccc; + border-left: 6px solid #ccc; + color: #555; + margin-bottom: 10px; + padding: 5px 8px; + white-space: pre; + display: block; + tab-size: 4; + -moz-tab-size: 4; + -o-tab-size: 4; + line-height: 20px + } + + span.nested.collapsed { + cursor: pointer; + border: 1px solid #7298AC; + background-color: rgba(114, 152, 172, .15); + padding: 1px; + } + + /* general */ + + .mono { + font-family: monospace; + } + div.clear { clear: both; } @@ -152,19 +264,92 @@ .hidden { display: none; } + + a { + cursor: pointer; + color: #1e373f; + font-weight: normal; + } + + a:hover { + color: #264c58; + text-decoration: underline; + } </style> <script type="text/javascript"> $(document).ready(function () { + // hide any open type dialogs + $('html').on('click', function() { + $('div.type').hide(); + }); + + // populate all paths - this is necessary because the @key + // doesn't seem to reset after iterating through a nested + // array or object + $('span.path').each(function() { + var path = $(this); + var endpoint = path.parent(); + endpoint.find('div.path').text(path.text()); + }); + + // toggles the visibility of a given operation $('div.operation-handle').on('click', function () { $(this).next('div.operation').toggle(); }); + + // add support for clicking to view the definition of a type + $('a.type-link').on('click', function(e) { + // hide any previously shown dialogs + $('div.type').hide(); + + // show the type selected + var link = $(this); + var typeId = link.text(); + $('#' + typeId).show(); + e.stopPropagation(); + }); + + // prevent hiding when clicking on the type dialog + $('div.type').on('click', function(e) { + e.stopPropagation(); + }); + + // populate nested examples + $('code.example').on('click', 'span.nested', function(e) { + var nested = $(this).removeClass('collapsed'); + var nestedId = nested.find('span.nested-id'); + var nestedExample = nested.find('span.nested-example'); + + // get the id of the nested example + var typeId = nestedId.text(); + var example = $('#' + typeId + ' code.example').html(); + var depth = nestedId.parents('span.nested').length; + + // tab over as appropriate + example = example.replace(/(\r\n|\r|\n)/g, function(match) { + var tab = '\t'; + for (var i = 0; i < depth - 1; i++) { + tab += '\t'; + } + return match + tab; + }); + + // copy over the example + nestedExample.html(example); + e.stopPropagation(); + }); }); </script> </head> <body> - + <div class="overview"> + <div class="title">{{info.title}}-{{info.version}}</div> + </div> {{#each paths}} {{> endpoint}} {{/each}} + {{#each definitions}} + {{> type}} + {{/each}} </body> </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.hbs ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.hbs b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.hbs index 11e8992..8c626bb 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.hbs +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.hbs @@ -13,81 +13,100 @@ limitations under the License. --}} <div class="operation hidden"> - {{description}} -</div> - -{{!-- -{{#deprecated}}-deprecated-{{/deprecated}} -{{summary}} - -{{description}} - -{{#if externalDocs.url}}{{externalDocs.description}}. [See external documents for more details]({{externalDocs.url}}) -{{/if}} - -{{#if security}} -#### Security -{{/if}} - -{{#security}} -{{#each this}} -* {{@key}} -{{#this}} * {{this}} -{{/this}} -{{/each}} -{{/security}} - -#### Request - -{{#if consumes}} -**Content-Type: ** {{join consumes ", "}}{{/if}} - -##### Parameters -{{#if parameters}} -<table border="1"> - <tr> - <th>Name</th> - <th>Located in</th> - <th>Required</th> - <th>Description</th> - <th>Default</th> - <th>Schema</th> - </tr> -{{/if}} - -{{#parameters}} -<tr> - <th>{{name}}</th> - <td>{{in}}</td> - <td>{{#if required}}yes{{else}}no{{/if}}</td> - <td>{{description}}</td> - <td> - </td> -{{#ifeq in "body"}} - <td> - {{#ifeq schema.type "array"}}Array[<a href="#/definitions/{{basename schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}} - {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a> {{/schema.$ref}} - </td> -{{else}} - {{#ifeq type "array"}} - <td>Array[{{items.type}}] ({{collectionFormat}})</td> - {{else}} - <td>{{type}} {{#format}}({{format}}){{/format}}</td> - {{/ifeq}} -{{/ifeq}} -</tr> -{{/parameters}} -{{#if parameters}} -</table> -{{/if}} - - -#### Response - -{{#if produces}}**Content-Type: ** {{join produces ", "}}{{/if}} - - -| Status Code | Reason | Response Model | -|-------------|-------------|----------------| -{{#each responses}}| {{@key}} | {{description}} | {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a>{{/schema.$ref}}{{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}{{^schema}} - {{/schema}}| -{{/each}} ---}} \ No newline at end of file + {{#if description}} + <div class="description"> + {{description}} + </div> + {{/if}} + <div class="title">Request</div> + <div class="mediatypes details"> + {{#if consumes}} + <div class="mediatype"><div class="title">consumes:</div><div class="mono">{{join consumes ", "}}</div><div class="clear"></div></div> + {{/if}} + </div> + {{#if parameters}} + <table> + <thead> + <tr> + <th>Name</th> + <th>Location</th> + <th>Required</th> + <th>Type</th> + <th>Description</th> + </tr> + </thead> + <tbody> + {{/if}} + {{#each parameters}} + <tr> + <td>{{#ifeq in "body"}}{{else}}{{name}}{{/ifeq}}</td> + <td>{{in}}</td> + <td> + {{#ifeq in "body"}} + yes + {{else}} + {{#if required}}yes{{else}}no{{/if}} + {{/ifeq}} + </td> + {{#ifeq in "body"}} + <td> + {{#ifeq schema.type "array"}}Array[<a class="type-link" href="javascript:void(0);">{{basename schema.items.$ref}}</a>]{{/ifeq}} + {{#schema.$ref}}<a class="type-link" href="javascript:void(0);">{{basename schema.$ref}}</a> {{/schema.$ref}} + </td> + {{else}} + {{#ifeq type "array"}} + <td>Array[{{items.type}}] ({{collectionFormat}})</td> + {{else}} + {{#ifeq type "ref"}} + <td>string</td> + {{else}} + <td>{{type}} {{#format}}({{format}}){{/format}}</td> + {{/ifeq}} + {{/ifeq}} + {{/ifeq}} + <td>{{description}}</td> + </tr> + {{/each}} + {{#if parameters}} + </tbody> + </table> + {{/if}} + <div class="title">Response</div> + <div class="mediatypes details"> + {{#if produces}} + <div class="mediatype"><div class="title">produces:</div><div class="mono">{{join produces ", "}}</div><div class="clear"></div></div> + {{/if}} + </div> + <table> + <thead> + <tr> + <th>Status Code</th> + <th>Type</th> + <th>Description</th> + </tr> + </thead> + <tbody> + {{#each responses}} + <tr> + <td>{{@key}}</td> + <td> + {{#if schema}} + {{#schema.$ref}}<a class="type-link" href="javascript:void(0);">{{basename schema.$ref}}</a>{{/schema.$ref}} + {{else}} + string + {{/if}} + </td> + <td>{{description}}</td> + </tr> + {{/each}} + </tbody> + </table> + <div class="title">Authorization</div> + <div class="authorization details"> + {{#security}} + {{#each this}} + <div>{{@key}}</div> + {{/each}} + {{/security}} + </div> +</div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs new file mode 100644 index 0000000..08f7a02 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs @@ -0,0 +1,51 @@ +{{!-- + 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. +--}} +<div id="{{@key}}" class="type hidden"> + <h3>{{@key}}</h3> + <table> + <tr> + <th>Name</th> + <th>Type</th> + <th>Required</th> + <th>Description</th> + </tr> + {{#each properties}} + <tr> + <td>{{@key}}</td> + <td> + {{#ifeq type "array"}} + {{#items.$ref}} + {{type}}[<a class="type-link" href="javascript:void(0);">{{basename items.$ref}}</a>] + {{/items.$ref}} + {{^items.$ref}} + {{type}}[{{items.type}}] + {{/items.$ref}} + {{else}} + {{#$ref}} + <a class="type-link" href="javascript:void(0);">{{basename $ref}}</a> + {{/$ref}} + {{^$ref}} + {{type}}{{#format}} ({{format}}){{/format}} + {{/$ref}} + {{/ifeq}} + </td> + <td>{{#required}}required{{/required}}{{^required}}optional{{/required}}</td> + <td>{{#description}}{{{description}}}{{/description}}</td> + </tr> + {{/each}} + </table> + <h4>Example</h4> + <code class="example">{{{> example}}}</code> +</div> \ No newline at end of file
