Skip to content

feat(ama-sdk-generator): add guard function for extended definitions#4119

Open
kpanot wants to merge 1 commit intomainfrom
feature/discriminator-helpers
Open

feat(ama-sdk-generator): add guard function for extended definitions#4119
kpanot wants to merge 1 commit intomainfrom
feature/discriminator-helpers

Conversation

@kpanot
Copy link
Copy Markdown
Contributor

@kpanot kpanot commented Apr 1, 2026

Proposed change

feat(ama-sdk-generator): enhance extended model definition with discriminator literal type
feat(ama-sdk-generator): add discriminator extended list
feat(ama-sdk-generator): add dynamic array type support option

Related issues

- No issue associated -

@kpanot kpanot requested a review from a team as a code owner April 1, 2026 14:47
@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud bot commented Apr 1, 2026

View your CI Pipeline Execution ↗ for commit d9465f1

Command Status Duration Result
nx run-many --target=test-e2e ✅ Succeeded 2m 6s View ↗
nx affected --target=lint --configuration ci ✅ Succeeded 15m 7s View ↗
nx run-many --tui=false --target=build --projec... ✅ Succeeded <1s View ↗
nx run-many --target=build,build-swagger ✅ Succeeded 13m 52s View ↗
nx affected --target=test --coverage --configur... ✅ Succeeded 6m View ↗
nx run ama-sdk-schematics:build-swagger ✅ Succeeded 3m 11s View ↗
nx run-many --target=documentation ✅ Succeeded 1m 23s View ↗
nx affected --target=package-github-action ✅ Succeeded 2m 4s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-07 02:16:45 UTC

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.92%. Comparing base (b09b8ad) to head (d9465f1).
✅ All tests successful. No failed tests found.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

❌ The fix was rejected

We updated the api.mustache template and the generated training-sdk/src/api/dummy/dummy-api.ts to restore the reviver import from import type to a regular import. Reviver functions like reviveFlight are used as runtime values in processCall, so import type — which is erased at compile time — causes a TS1361 error. This fix preserves import type for model/interface types while ensuring reviver functions remain as value imports.

Warning

We could not verify this fix.

Suggested Fix changes
diff --git a/packages/@ama-sdk/schematics/schematics/typescript/core/openapi-codegen-typescript/src/main/resources/typescriptFetch/api/api.mustache b/packages/@ama-sdk/schematics/schematics/typescript/core/openapi-codegen-typescript/src/main/resources/typescriptFetch/api/api.mustache
index 518081a63..a497512c1 100644
--- a/packages/@ama-sdk/schematics/schematics/typescript/core/openapi-codegen-typescript/src/main/resources/typescriptFetch/api/api.mustache
+++ b/packages/@ama-sdk/schematics/schematics/typescript/core/openapi-codegen-typescript/src/main/resources/typescriptFetch/api/api.mustache
@@ -2,7 +2,7 @@
 {{#imports}}
 import type { {{import}} } from '../../models/base/{{#kebabCase}}{{import}}{{/kebabCase}}/index';
 {{#keepRevivers}}
-import type { revive{{import}} } from '../../models/base/{{#kebabCase}}{{import}}{{/kebabCase}}/{{#kebabCase}}{{import}}{{/kebabCase}}.reviver';
+import { revive{{import}} } from '../../models/base/{{#kebabCase}}{{import}}{{/kebabCase}}/{{#kebabCase}}{{import}}{{/kebabCase}}.reviver';
 {{/keepRevivers}}
 {{/imports}}
 import { Api, ApiClient, ApiTypes, computePiiParameterTokens, isJsonMimeType, ParamSerializationOptions, RequestBody, RequestMetadata, Server, selectServerBasePath, utils } from '@ama-sdk/core';
diff --git a/packages/@o3r-training/training-sdk/src/api/dummy/dummy-api.ts b/packages/@o3r-training/training-sdk/src/api/dummy/dummy-api.ts
index ae4c170b4..c1c2253c2 100644
--- a/packages/@o3r-training/training-sdk/src/api/dummy/dummy-api.ts
+++ b/packages/@o3r-training/training-sdk/src/api/dummy/dummy-api.ts
@@ -1,5 +1,5 @@
 import type { Flight } from '../../models/base/flight/index';
-import type { reviveFlight } from '../../models/base/flight/flight.reviver';
+import { reviveFlight } from '../../models/base/flight/flight.reviver';
 import { Api, ApiClient, ApiTypes, computePiiParameterTokens,  ParamSerializationOptions, RequestBody, RequestMetadata, Server, selectServerBasePath, } from '@ama-sdk/core';
 import { SDK_SERVERS } from '../../constants/servers';
 /** Parameters object to DummyApi's dummyGet function */

View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

@kpanot kpanot force-pushed the feature/discriminator-helpers branch from ff5d358 to 8ed45bf Compare April 2, 2026 00:31
feat(ama-sdk-generator): enhance extended model definition with discriminator literal type
feat(ama-sdk-generator): add discriminator extended list
--radius-10: 10px;
--radius-25: 25px;
--spacing-0: 0px;
--spacing-0: 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems to not be related to your PR, maybe it can be done in another PR

Copy link
Copy Markdown
Contributor Author

@kpanot kpanot Apr 7, 2026

Choose a reason for hiding this comment

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

This is done by the build process.
I open a dedicated PR: #4130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants