Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Swagger codegen compilation failure

Edited

Hello,

I am actually doing a rest api client for Jira for integration tools.

Firstly I was going to use jira-rest-java-client-api but it cannot manage project and user...

I found many discussions on the Jira swagger but when I try to generate the client code with swagger-codegen-maven-plugin, I got a compilation error with Java 11 :

FieldValueClause.java:[45,5] as of release 9, '_' is a keyword, and may not be used as an identifier

 

It looks like the swagger model is not working with java 11, so I changed my compiler to Java 8 but I got an other compilation error :

IssueTypeSchemesApi.java:[52,48] cannot find symbol
[ERROR] symbol: class IssueTypeIDs
[ERROR] location: class io.swagger.client.api.IssueTypeSchemesApi

 

I saw the class IssueTypeIDs has wrong name declaration, the file is named IssueTypeIDs but the class name is IssueTypeIds.

Related to this error report during compilation :

bad source file: C:\...\IssueTypeIDs.java
file does not contain class io.swagger.client.model.IssueTypeIDs
Please remove or make sure it appears in the correct subdirectory of the sourcepath.

 

Do you know a solution to this? I saw this tutorial : https://blog.developer.atlassian.com/update-to-jira-clouds-swagger-openapi-docs/ is using codegen directly but I prefer to use the maven plugin to generate the client code during compilation if possible.

 

My environment :

swagger json : swagger-v3.v3.json 

codegen version : swagger-codegen-maven-plugin 3.0.25 (tries with 3.0.24 and 3.0.20)

Java 8.

 

Thanks in advance.

 

Mathieu DELROCQ

 

 

 

2 answers

1 accepted

0 votes
Answer accepted
Ben Kelley Atlassian Team May 16, 2021

The IssueTypeIDs problem should be fixed now.

I see what you mean about the FieldValueClause. I'll look into it, and comment back here.

Ben Kelley Atlassian Team May 16, 2021

So it's how swagger-codegen maps the enum value to a type name. I can't see an easy way to specify that you need to send "xyz" but it should call it "abc".

Looking at how enums work in Open API, I don't think there's an easy way to get around how swagger-codegen creates identifiers for Java. I might submit a bug report for swagger-codegen, as I can see that its strategy for identifier naming will be a problem for Java 11.

In the short term, if you don't actually use this, you could just remove the "~=" option for operator for JqlQueryField.

Ben Kelley Atlassian Team Nov 07, 2021

Note that the FieldValueClause problem should be fixed.

0 votes
Ben Kelley Atlassian Team May 16, 2021

Note that you're using the Swagger spec for Jira Cloud, but you tagged this as Jira Server. The Cloud and Server APIs have differences.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you