Jira Pojos to match REST API output?

Hi all,
I’m writing a Java program to consume JSON from the REST API. It would be really helpful to find a set of Java classes that represent each of the objects returned from the API. Has anyone created them or know of a source?


Download https://developer.atlassian.com/cloud/jira/platform/swagger.yaml and then just use swagger codegen. But be quick, that URL may be gone within the next month as it’s not an official URL. :slight_smile: we’ll be providing an official swagger download url soon and it’ll be for OAS 3.0

Well, that looked very promising. But, I’m getting an exception in Swagger. I’m new to Swagger so maybe I’m doing something wrong. The command below does production a lot (maybe all) of the Java files before the exception. I’m executing using this:

c:\Work\workspaceSpring\swagger>java -jar swagger-codegen-cli.jar generate -i jira.swagger -l java -o C:\Work\workspaceSpring\jiraCentral\src\main\java\com\compname

The exception output is:

[main] INFO io.swagger.codegen.AbstractGenerator - writing file C:\Work\workspaceSpring\jiraCentral\src\main\java\com\hartehanks\docs\WorklogWithPaginationBean.md
Exception in thread “main” java.lang.RuntimeException: Could not process operation:
Tag: Tag {
name: default
description: null
externalDocs: null
Operation: com.atlassian.jira.rest.v2.issue.CommentPropertyResource.setCommentProperty_put
Resource: put /api/2/comment/{commentId}/properties/{propertyKey}
Definitions: {SecurityListLevelJsonBean=io.swagger.models.ModelImpl@58d31ba,…

Exception: null
at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:932)
at io.swagger.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:810)
at io.swagger.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:431)
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:746)
at io.swagger.codegen.cmd.Generate.run(Generate.java:285)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Caused by: java.lang.NullPointerException
at io.swagger.codegen.DefaultCodegen.fromParameter(DefaultCodegen.java:2585)
at io.swagger.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:2213)
at io.swagger.codegen.languages.AbstractJavaCodegen.fromOperation(AbstractJavaCodegen.java:1057)
at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:881)
… 5 more

I also tried validating the YAML at https://bigstickcarpet.com/swagger-parser/www/index.html. It returned the following message:
This API is valid, but it cannot be shown because it contains circular references

TypeError: Converting circular structure to JSON
at JSON.stringify ()
at toText (/bundle.js:916:20)
at Function.editors.addResult (/bundle.js:849:13)
at Function.editors.showResult (/bundle.js:805:11)
at /bundle.js:1122:19
at Array.forEach ()

I have no idea if this is a real problem or not.

If anyone has any suggestions on what to do next I’d really appreciate it.


1 Like

Hi @jim.icenhower

Did you manage do solve this problem? I face the same issue :frowning: I would be really grateful for any answer.

BR , Tomek

I was never able to get Swagger working. But I did find this: https://github.com/rcarz/jira-client
It’s a set of java classes that represent Jira objects like Issue, WorkLog, etc. It seems pretty robust to me. I’m using it to pull Jira data into a SQL db for reporting.

1 Like

Hi @jim.icenhower

Thanks for the answer :slight_smile: