Skip to content

Conversation

@Kwok-he-Chu
Copy link
Member

@Kwok-he-Chu Kwok-he-Chu commented Nov 18, 2025

PR-2 of #1204

Description

This PR introduces the mustache.templates needed for the upgrade of the OpenApiGenerator to v7.16.0 used in the Adyen sdk-automation to generate .NET models & services from the Adyen OpenAPI Specifications.

  • Removed the old templates

@Kwok-he-Chu Kwok-he-Chu requested review from a team as code owners November 18, 2025 15:53
@Kwok-he-Chu Kwok-he-Chu changed the base branch from main to v7-generator/1-add-core-classes November 18, 2025 15:53
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a significant upgrade, replacing old templates with new ones for the generichost library to support OpenAPI Generator v7.16.0. The changes are extensive and introduce a new structure for C# code generation. My review of the new mustache templates has identified a few critical and high-severity issues related to null handling, incorrect logic in authentication flows, and attempts to instantiate abstract classes. These could lead to runtime exceptions or unexpected behavior in the generated code. I've provided detailed feedback and code suggestions to improve the robustness and correctness of the new templates.

@Adyen Adyen deleted a comment from gemini-code-assist bot Nov 18, 2025
@Kwok-he-Chu Kwok-he-Chu changed the title OpenAPIGenerator upgrade to v7.16.0 - Added new mustache templates OpenAPIGenerator upgrade to v7.16.0 - [2] Added new mustache templates Nov 18, 2025
@Kwok-he-Chu Kwok-he-Chu self-assigned this Nov 18, 2025
Kwok-he-Chu added a commit that referenced this pull request Nov 19, 2025
Remove unused templates ApiTests, DependencyInjectionTests
#1208 (comment)
@Kwok-he-Chu
Copy link
Member Author

@gcatanese The mustache templates include the generated templates for the classes in the /Core-folder, these templates can be removed (e.g. Options.mustache template etc.)

@Kwok-he-Chu Kwok-he-Chu force-pushed the v7-generator/2-add-mustache-templates branch from 6d99b32 to 2e33dc4 Compare November 26, 2025 15:26
@Kwok-he-Chu Kwok-he-Chu changed the base branch from v7-generator/1-add-core-classes to v7-generator/development-branch November 26, 2025 15:51
@Kwok-he-Chu Kwok-he-Chu force-pushed the v7-generator/2-add-mustache-templates branch from 2e33dc4 to d49b160 Compare November 28, 2025 12:38
@@ -0,0 +1,41 @@
\// <auto-generated>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this formatting ok?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result))
return result;

throw new NotSupportedException();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is out of sync with the generated file

@@ -0,0 +1 @@
{{#pathParams}}{{{dataType}}}{{>NullConditionalParameter}} {{paramName}}, {{/pathParams}}{{#queryParams}}{{#required}}{{{dataType}}}{{>NullConditionalParameter}} {{paramName}}, {{/required}}{{/queryParams}}{{#bodyParams}}{{{dataType}}}{{>NullConditionalParameter}} {{paramName}}, {{/bodyParams}}{{#queryParams}}{{^required}}Option<{{{dataType}}}{{>NullConditionalParameter}}> {{paramName}}{{#notRequiredOrIsNullable}} = default{{/notRequiredOrIsNullable}}, {{/required}}{{/queryParams}} RequestOptions? requestOptions = default, System.Threading.CancellationToken cancellationToken = default{{^netstandard20OrLater}}(global::System.Threading.CancellationToken){{/netstandard20OrLater}} No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this version is a bit more complicated than the original. No need to change for now but we can create a follow up about maintainability later

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gcatanese FYI, we decided to make these changes. The goal was to preserve the order of the operations and enforce mandatory body payloads

In terms of maintainability, this is the best I could given our mustache.template constraints, string manipulations are tedious yes :)

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.

3 participants