Skip to content

chore(openchallenges): update the OC API client for Angular and migrate from OpenAPI Generator v6.1.0 to v7.11.0#3132

Merged
tschaffter merged 12 commits into
Sage-Bionetworks:mainfrom
tschaffter:openchallenges/update-api-client-angular
May 6, 2025
Merged

chore(openchallenges): update the OC API client for Angular and migrate from OpenAPI Generator v6.1.0 to v7.11.0#3132
tschaffter merged 12 commits into
Sage-Bionetworks:mainfrom
tschaffter:openchallenges/update-api-client-angular

Conversation

@tschaffter

@tschaffter tschaffter commented May 5, 2025

Copy link
Copy Markdown
Contributor

Description

This PR updates the version of the OpenAPI Generator used for the OC API client for Angular from v6.1.0 to v7.11.0.

OpenAPI Generator v7.12.0 and v7.13.0 have issues related to how the query parameters are serialized. This PR updates the generator to v7.11.0, which is the most recent version that still work successfully.

The release notes for OpenAPI Generator:

While the above releases fixes some issues related to the serialization of the query parameters, in particular v7.13.0, the tickets shown below describe the remaining issue that prevent us from futher updating the OpenAPI generator.

Note

The custom API template has been removed, as it no longer appears necessary. The original motivation for introducing the custom template is unclear due to a lack of sufficiently granular commit history. If needed, the rationale could be reconstructed by comparing the official template with the custom one.

Related Issues

Changelog

  • Update to OpenAPI Generator 7.11.0 that use Angular 19.0.0 by default.
  • Update the library build file to use Angular 19+.
  • Move the additional properties of the OpenAPI generator from templates/config.yaml to openapitools.json.
  • Remove custom OC API template for OpenAPI Generator.
  • Update ng-package.json to depend on Angular 19+.

Notes

  • Introduction of BaseService.ts that other services extends. This contributes to make the code more DRY.
  • The OpenAPI Generator no longer generates "*AllOf.ts" files, which contributes to make the library cleaner.
  • The OpenAPI Generator properly generates the "*JsonLd.ts" files, which no longer require to be manually fixed.

@tschaffter tschaffter self-assigned this May 5, 2025
@tschaffter tschaffter marked this pull request as ready for review May 5, 2025 21:36
@tschaffter tschaffter requested a review from rrchai as a code owner May 5, 2025 21:36
@tschaffter tschaffter marked this pull request as draft May 5, 2025 21:43
@tschaffter tschaffter force-pushed the openchallenges/update-api-client-angular branch from 5485e8b to 6b52c7f Compare May 6, 2025 17:48
@tschaffter

tschaffter commented May 6, 2025

Copy link
Copy Markdown
Contributor Author

Issue with query parameters

A query currently looks like that:

http://localhost:8082/api/v1/images?imageQuery={"objectKey":"logo/Australian-Biocommons.png","height":"140px","aspectRatio":"1_1"}

Using the same config as before:

additionalProperties:
  queryParamObjectFormat: key

The parameter queryParamObjectFormat does not seem to have any effect on the code generated.

Most of the issue is solved when updating OpenAPI Generator from v7.12.0 to v7.13.0, but the remaining issue shown below remains on the home page (and possibly somewhere else):

Currently (v6.1.0):

https://prod.openchallenges.io/api/v1/organizations?pageNumber=0&pageSize=4&categories=featured&searchTerms=&sort=challenge_count

In v7.13.0

http://localhost:8082/api/v1/organizations?pageNumber=0&pageSize=4&categories=["featured"]&searchTerms=&sort=challenge_count

This PR describes the fix introduced in v1.13.0 and references the original source of the issue with the query parameters.

OpenAPITools/openapi-generator#20850

@tschaffter tschaffter changed the title chore(openchallenges): update the OC API client for Angular chore(openchallenges): update the OC API client for Angular and migrate from OpenAPI Generator v6.1.0 to v7.11.0 May 6, 2025
@tschaffter tschaffter marked this pull request as ready for review May 6, 2025 22:04
@tschaffter tschaffter merged commit e7d888a into Sage-Bionetworks:main May 6, 2025
1 check failed
@tschaffter tschaffter deleted the openchallenges/update-api-client-angular branch May 6, 2025 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant