Skip to main content
Question

Generating API using Swagger ignores allOf when generating model objects


Forum|alt.badge.img+1

Hi,

I'm running the command:

swagger-codegen generate -i https://developers.strava.com/swagger/swagger.json -l swift5

The DetailedActivity does not contain any of the SummaryActivity as described by the allOf section in https://developers.strava.com/swagger/activity.json#/DetailedActivity.

I've tried using version 3.0.41 and 2.4.30

A quick search indicated that it is a swagger bug?

Am I missing something here?

Thanks Antz

3 replies

Forum|alt.badge.img+1
  • Author
  • Hub Rookie
  • 2 replies
  • March 23, 2023

I also tried using openapi generator, but had to specify the skip validate spec parameter as validation fails 

 

Errors: 
-attribute paths.'/routes/{id}/export_gpx'(get).responses.200.content is unexpected
-attribute paths.'/routes/{id}/export_tcx'(get).responses.200.content is unexpected

The DetailedActivity generated looked better but it also generated a DetailsActivityAllOf one too.


Forum|alt.badge.img+1
  • Hub Rookie
  • 2 replies
  • April 2, 2025

hi ​@antokne , did you get a solution when generating models with openapi generator?
I’m hitting the same.

I am trying this generator instead of swagger-generator because I only get the models generated, not the clientAPIs. 
Any idea why?


Forum|alt.badge.img+1
  • Author
  • Hub Rookie
  • 2 replies
  • April 2, 2025

I was not able to get the generator to work so I manually updated DetailedActivity. 

see https://github.com/antokne/swift-strava

Although this might not be the language you need… 

Ants


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept, you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings