Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fitbit Swagger Code Generation for Spring Boot 3 Compatible Client

Hi All,

I am trying to generate a Java Client Library based on this Swagger 2 definition. (https://dev.fitbit.com/build/reference/web-api/explore/fitbit-web-api-swagger.json)

However, somehow the library is not working in Java 17 and Spring Boot 3 since there are wrong dependencies used. Does may someone has an Idea how to generate a working Java Client Library.

This is the command I used to generate the Code:

swagger-v2 generate -i https://dev.fitbit.com/build/reference/web-api/explore/fitbit-web-api-swagger.json -l java -c ./swagger-config.json -o .


Would be really nice if someone could help here.

Best Answer
0 Votes
3 REPLIES 3

Sorry, forgot to add the swagger configuration File:

{
"modelPackage": "app.enduco.fitbit-swagger.model",
"apiPackage": "app.enduco.fitbit-swagger.api",
"invokerPackage": "app.enduco.fitbit-swagger.invoker",
"groupId": "app.enduco",
"artifactId": "fitbit-swagger",
"serializableModel": false,
"java11": true,
"hideGenerationTimestamp": true,
"library": "resttemplate",
"dateLibrary": "java11",
"artifactVersion": "1.16.3",
"localVariablePrefix": "local",
"jakarta": true,
"javaVersion": 17,
"useSpringBoot3": true,
"useJakartaEe": true
}
Best Answer
0 Votes

Hi @enduco 

I can try to help, but people have had problems using our swagger file in the past.   We've tried cleaning it up, but because the syntax of some endpoints are not always unique, it does cause problems.   

Are the wrong dependencies related to the swagger json syntax?   If so, would you provide the list of the wrong dependencies?  

Thanks!

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Hi Gordon,

Thanks for your reply, meanwhile I found this online swagger editor, which could be used and is compatible from 2.0 to 3.*, when I upload your file here it throws a lot of errors:

https://editor.swagger.io/

 

Semantic error at paths./1/user/-/activities/active-zone-minutes/date/{start-date}/{end-date}/time/{start-time}/{end-time}.json.get.parameters.2.name

Path parameter "detail-level" must have the corresponding {detail-level} segment in the "/1/user/-/activities/active-zone-minutes/date/{start-date}/{end-date}/time/{start-time}/{end-time}.json" path

Semantic error at paths./1/user/-/activities/active-zone-minutes/date/{start-date}/{end-date}.json

Equivalent paths are not allowed.

Semantic error at paths./1/user/-/activities/{resource-path}/date/{date}/{period}.json

Equivalent paths are not allowed.

Semantic error at paths./1/user/-/activities/tracker/{resource-path}/date/{date}/{period}.json

Equivalent paths are not allowed.

Semantic error at paths./1/user/-/body/log/fat/date/{base-date}/{end-date}.json

Equivalent paths are not allowed.

Semantic error at paths./1/user/-/body/log/weight/date/{base-date}/{end-date}.json

Equivalent paths are not allowed.

Semantic error at paths./1/user/-/body/{resource-path}/date/{base-date}/{end-date}.json

Equivalent paths are not allowed.

Semantic error at paths./1/user/-/activities/heart/date/{base-date}/{end-date}.json

Equivalent paths are not allowed.

Semantic error at paths./1/user/-/foods/log/{resource-path}/date/{date}/{period}.json

Equivalent paths are not allowed.

Semantic error at paths./1/user/-/meals/{meal-id}.json

Declared path parameter "meal-id" needs to be defined within every operation in the path (missing in "post"), or moved to the path-level parameters object
 
However, if you say in the past also a lot of Developers had problems with the swagger file, is there may another way or suggestion to realize API Changes quick and easy in an automated way? Since this is the most important to know for us.


Best Answer
0 Votes