nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From St├ęphane Maarek <stephane.maa...@gmail.com>
Subject Re: Rest API Client swagger.json
Date Thu, 13 Oct 2016 22:47:36 GMT
Hi,

Thanks it helps ! Good to know there is already a java client I could use.
Nonetheless I think it would be extremely nice to use the swagger codegen
project to generate additionally sdks, I don't mind creating a github
project of my own to maintain these.

I gave it a go and it gave me a bunch of errors, see
https://github.com/swagger-api/swagger-codegen/issues/3976

I went to https://editor.swagger.io/ , uploaded the swagger.json file and
apparently the swagger.json specs for many (if not all) delete calls are
having wrong specs, see below. Do you think that's worth opening a JIRA?


Swagger Error

Not a valid parameter definition
Jump to line 344
Details
 Object
code: "ONE_OF_MISSING"
 params: Array [0]
message: "Not a valid parameter definition"
 path: Array [5]
0: "paths"
1: "/connections/{id}"
2: "delete"
3: "parameters"
4: "0"
schemaId: "http://swagger.io/v2/schema.json#"
 inner: Array [2]
 0: Object
code: "ONE_OF_MISSING"
 params: Array [0]
message: "Data does not match any schemas from 'oneOf'"
 path: Array [5]
 inner: Array [2]
 0: Object
code: "OBJECT_MISSING_REQUIRED_PROPERTY"
 params: Array [1]
0: "schema"
message: "Missing required property: schema"
 path: Array [0]
 1: Object
code: "ONE_OF_MISSING"
 params: Array [0]
message: "Data does not match any schemas from 'oneOf'"
 path: Array [0]
 inner: Array [4]
 0: Object
code: "ENUM_MISMATCH"
 params: Array [1]
message: "No enum match for: ref"
 path: Array [1]
 1: Object
code: "ENUM_MISMATCH"
 params: Array [1]
message: "No enum match for: ref"
 path: Array [1]
 2: Object
code: "ENUM_MISMATCH"
 params: Array [1]
message: "No enum match for: ref"
 path: Array [1]
 3: Object
code: "ENUM_MISMATCH"
 params: Array [1]
0: "ref"
message: "No enum match for: ref"
 path: Array [1]
0: "type"
 1: Object
code: "OBJECT_MISSING_REQUIRED_PROPERTY"
 params: Array [1]
0: "$ref"
message: "Missing required property: $ref"
 path: Array [5]
0: "paths"
1: "/connections/{id}"
2: "delete"
3: "parameters"
4: "0"
level: 900
type: "Swagger Error"
description: "Not a valid parameter definition"
lineNumber: 344

On Thu, Oct 13, 2016 at 11:43 PM Matt Gilman <matt.c.gilman@gmail.com>
wrote:

Stephane,

Yes, you are correct that Apache NiFi uses swagger. However, we are only
using it for keeping the documentation in sync. We use a maven plugin that
inspects the swagger annotations and generates a swagger.json. The
swagger.json is generated to nifi-web-api/target/swagger-ui/swagger.json at
build time. Subsequently, the swagger.json is run through a handlebars
template to generate the REST API docs.

We provide a client library at

<dependency>
    <groupId>org.apache.nifi</groupId>
    <artifactId>nifi-client-dto</artifactId>
    <version>1.0.0</version>
</dependency>

Examples of its usage can be seen in our access control integration tests
[1].

Let me know if you have any other questions. Thanks!

Matt

[1]
https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITProcessorAccessControl.java

On Wed, Oct 12, 2016 at 10:53 PM, St├ęphane Maarek <stephane.maarek@gmail.com
> wrote:

Hi,

It seems possible to create an API client for any language using this
project:
https://github.com/swagger-api/swagger-codegen

It needs the swagger.json file. I know it should be generated at build
time, but where can I find it?

Beyond that, would it be useful to extract that file, version control it,
and maybe automatically generate API sdks for many languages using the
project above? Would help tremendously

Cheers
Stephane

Mime
View raw message