diff --git a/.yarnrc.yml b/.yarnrc.yml
index dc79fc379c..aa654b4428 100644
--- a/.yarnrc.yml
+++ b/.yarnrc.yml
@@ -20,7 +20,7 @@ packageExtensions:
"@swc/types": "*"
"@typescript-eslint/rule-tester@*":
dependencies:
- "@typescript-eslint/parser": ~8.17.0
+ "@typescript-eslint/parser": ~8.18.0
"@angular-eslint/eslint-plugin-template@*":
dependencies:
"@typescript-eslint/types": "^8.0.0"
diff --git a/apps/chrome-devtools/src/app-components/app.component.ts b/apps/chrome-devtools/src/app-components/app.component.ts
index 26ac6a3116..e7c0d2f716 100644
--- a/apps/chrome-devtools/src/app-components/app.component.ts
+++ b/apps/chrome-devtools/src/app-components/app.component.ts
@@ -139,8 +139,7 @@ export class AppComponent {
]).pipe(
map(([info, executions]) =>
executions.filter((execution) =>
- (execution.rulesetInformation?.linkedComponent?.name === info.componentName)
- || (execution.rulesetInformation?.linkedComponents?.or.some((linkedComp) => linkedComp.name === info.componentName))
+ (execution.rulesetInformation?.linkedComponents?.or.some((linkedComp) => linkedComp.name === info.componentName))
)
)
);
diff --git a/apps/chrome-devtools/src/app-devtools/component-panel/component-panel-pres.component.ts b/apps/chrome-devtools/src/app-devtools/component-panel/component-panel-pres.component.ts
index 3519aae114..6f6c5c96d6 100644
--- a/apps/chrome-devtools/src/app-devtools/component-panel/component-panel-pres.component.ts
+++ b/apps/chrome-devtools/src/app-devtools/component-panel/component-panel-pres.component.ts
@@ -117,8 +117,7 @@ export class ComponentPanelPresComponent {
]).pipe(
map(([info, executions]) =>
executions.filter((execution) =>
- (execution.rulesetInformation?.linkedComponent?.name === info.componentName)
- || (execution.rulesetInformation?.linkedComponents?.or.some((linkedComp) => linkedComp.name === info.componentName))
+ (execution.rulesetInformation?.linkedComponents?.or.some((linkedComp) => linkedComp.name === info.componentName))
)
)
);
diff --git a/apps/chrome-devtools/src/components/otter-component/otter-component.component.ts b/apps/chrome-devtools/src/components/otter-component/otter-component.component.ts
index 35948eed59..b4f428b6f5 100644
--- a/apps/chrome-devtools/src/components/otter-component/otter-component.component.ts
+++ b/apps/chrome-devtools/src/components/otter-component/otter-component.component.ts
@@ -106,9 +106,10 @@ export class OtterComponentComponent implements OnChanges {
this.librariesLinkedToRulesetExecutions = [...(
new Set((this.rulesetExecutions || [])
.flatMap((execution) => {
- const linkedComponent = execution.rulesetInformation?.linkedComponent;
const linkedComponents = execution.rulesetInformation?.linkedComponents?.or;
- return (linkedComponents?.map((lc) => lc.library) || [linkedComponent?.library]).filter((lib): lib is string => !!lib);
+ return linkedComponents
+ ? (linkedComponents.map((lc) => lc.library)).filter((lib): lib is string => !!lib)
+ : [];
})
)
)];
diff --git a/docs/ab-testing/AB_TESTING.md b/docs/ab-testing/AB_TESTING.md
index 3af64db125..0280aea6b1 100644
--- a/docs/ab-testing/AB_TESTING.md
+++ b/docs/ab-testing/AB_TESTING.md
@@ -261,5 +261,3 @@ You can now create A/B testing-driven rulesets .
}
```
-> Note: In v10 and previously, we used `linkedComponent` property to activate a ruleset on demand. This becomes deprecated and will be removed in v12. Use `linkedComponents` instead;
-
diff --git a/docs/components/COMPONENT_REPLACEMENT.md b/docs/components/COMPONENT_REPLACEMENT.md
index 40408e728f..b87528628d 100644
--- a/docs/components/COMPONENT_REPLACEMENT.md
+++ b/docs/components/COMPONENT_REPLACEMENT.md
@@ -163,7 +163,8 @@ That information is expected to be a property of the **component's configuration
Since configurations **have** to have a default value, in this specific instance it must always be the **empty string**. The default presenter will be declared in the component's class.
````typescript
-import { computeConfigurationName, Configuration } from '@o3r/configuration';
+import { Configuration } from '@o3r/configuration';
+import { computeItemIdentifier } from '@o3r/core';
export interface DummyContConfig extends Configuration {
/** Key used to identify a custom component, if provided */
@@ -174,7 +175,7 @@ export const DUMMY_CONT_DEFAULT_CONFIG: DummyContConfig = {
customDummyKey: ''
}
-export const DUMMY_CONT_CONFIG_ID = computeConfigurationName('DummyContConfig', '@scope/o3r-components');
+export const DUMMY_CONT_CONFIG_ID = computeItemIdentifier('DummyContConfig', '@scope/o3r-components');
````
For more information on configuration, you can check this [documentation](../configuration/OVERVIEW.md).
diff --git a/docs/components/PLACEHOLDERS.md b/docs/components/PLACEHOLDERS.md
index 0febab0502..6bfce931cb 100644
--- a/docs/components/PLACEHOLDERS.md
+++ b/docs/components/PLACEHOLDERS.md
@@ -296,107 +296,6 @@ Thanks to the parameters map you can use fact variables with JSONPath in localiz
}
```
-#### Variable support for localization variables (DEPRECATED)
-
-Before, localization variables could reference facts via variables instead of parameters. This feature is currently deprecated and will be removed from Otter v12 as it is replaced by the parameters explained above.
-
-``en-GB.json``
-
-```json
-{
- "o3r-increment-key": "{increment, plural, =1 {1 second has} other {{{increment}} seconds have}} elapsed since you opened the page"
-}
-```
-
-``template.json``
-
-```json
-{
- "vars": {
- "incrementKey": {
- "type": "localisation",
- "value": "o3r-increment-key",
- "vars": [
- "incrementVar"
- ]
- },
- "incrementVar": {
- "type": "fact",
- "value": "increment"
- }
- },
- "template": "
<%= incrementKey %>
"
-}
-```
-
-The 1-to-1 mapping between the fact name and the reference in the translation brings many inconveniences as explained below.
-
-> [!CAUTION]
-> **Limitations**
-> Today you can only make a reference to a fact with the same name. You also cannot use JSON path to resolve your fact.
-
-This means the following is not possible:
-
-``ruleset.json``
-
-```json
-{
- "vars": {
- "incrementKey": {
- "type": "localisation",
- "value": "o3r-increment-key",
- "vars": [
- "incrementVar"
- ]
- },
- "incrementVar": {
- "type": "fact",
- "value": "incrementFact",
- "path": "$.this.is.a.json.path"
- }
- },
- "template": "
<%= incrementKey %>
"
-}
-```
-
-> [!TIPS]
-> **General notice**
-
-Keep in mind that this feature deeply binds functional facts exposed in your application to your translations.
-You will need to carefully plan the way you bind your localization key to your facts to avoid messy references.
-
-For example, let's imagine you want a generic counter until specific events.
-You will probably want to reuse your placeholder in different pages for different events:
-
-```json
-{
- "vars": {
- "titleKey": {
- "type": "localisation",
- "value": "o3r-event-title-key"
- },
- "contentWithCounterKey": {
- "type": "localisation",
- "value": "o3r-event-counter-key",
- "vars": [
- "increment"
- ]
- },
- "increment": {
- "type": "fact",
- "value": "increment"
- }
- },
- "template": "
<%= titleKey %>
<%= contentWithCounterKey %>
"
-}
-```
-
-You might be tempted to use this generic template for all your events but the value of your counter parameter will
-depend on the event itself (Easter or next Summer Holidays for example).
-This means that ``increment`` might have a different value depending on the context of the page which might be tricky to
-maintain and to debug.
-Try to keep it as simple as possible.
-
### Multiple templates in same placeholder
You can use placeholder actions to target the same placeholderId with different template URLs.
diff --git a/docs/linter/eslint-plugin/rules/matching-configuration-name.md b/docs/linter/eslint-plugin/rules/matching-configuration-name.md
index 0cd0f18240..bd791308ce 100644
--- a/docs/linter/eslint-plugin/rules/matching-configuration-name.md
+++ b/docs/linter/eslint-plugin/rules/matching-configuration-name.md
@@ -1,6 +1,6 @@
# @o3r/matching-configuration-name
-Ensures that the configuration interface name matches the first parameter of `computeConfigurationName` used beside the configuration interface to expose its ID (as generated by the configuration module).
+Ensures that the configuration interface name matches the first parameter of `computeItemIdentifier` used beside the configuration interface to expose its ID (as generated by the configuration module).
## How to use
diff --git a/docs/rules-engine/how-to-use/dedicated-component-ruleset.md b/docs/rules-engine/how-to-use/dedicated-component-ruleset.md
index b3081fd672..91be13aa3b 100644
--- a/docs/rules-engine/how-to-use/dedicated-component-ruleset.md
+++ b/docs/rules-engine/how-to-use/dedicated-component-ruleset.md
@@ -89,9 +89,6 @@ prevent the execution of the Ruleset until your component is available in the pa
]
}
```
-> [!INFO]
-> In v10 and the previous version, the Otter framework exposed the `linkedComponent` property to activate a ruleset on demand.
-> This is now deprecated and will be removed in v12. Use `linkedComponents` instead.
## How it works
diff --git a/packages/@ama-sdk/client-angular/src/api-angular-client.ts b/packages/@ama-sdk/client-angular/src/api-angular-client.ts
index f3589f6152..7f85d93f1e 100644
--- a/packages/@ama-sdk/client-angular/src/api-angular-client.ts
+++ b/packages/@ama-sdk/client-angular/src/api-angular-client.ts
@@ -169,8 +169,7 @@ export class ApiAngularClient implements ApiClient {
exception = new EmptyResponseError(e.message || 'Fail to Fetch', undefined, { apiName, operationId, url, origin });
}
- // eslint-disable-next-line no-console -- `console.error` is supposed to be the default value if the `options` argument is not provided, can be removed in Otter v12.
- const reviver = getResponseReviver(revivers, response, operationId, { disableFallback: this.options.disableFallback, log: console.error });
+ const reviver = getResponseReviver(revivers, response, operationId, { disableFallback: this.options.disableFallback });
const replyPlugins = this.options.replyPlugins
? this.options.replyPlugins.map((plugin) => plugin.load({
dictionaries: root && root.dictionaries,
diff --git a/packages/@ama-sdk/client-fetch/package.json b/packages/@ama-sdk/client-fetch/package.json
index 6a44f37453..57d269e75b 100644
--- a/packages/@ama-sdk/client-fetch/package.json
+++ b/packages/@ama-sdk/client-fetch/package.json
@@ -40,6 +40,7 @@
},
"dependencies": {
"@swc/helpers": "~0.5.0",
+ "ts-node": "~10.9.2",
"tslib": "^2.6.2",
"uuid": "^10.0.0"
},
diff --git a/packages/@ama-sdk/core/package.json b/packages/@ama-sdk/core/package.json
index 5d61036269..9a98255a7e 100644
--- a/packages/@ama-sdk/core/package.json
+++ b/packages/@ama-sdk/core/package.json
@@ -83,6 +83,7 @@
},
"dependencies": {
"@swc/helpers": "~0.5.0",
+ "ts-node": "~10.9.2",
"tslib": "^2.6.2",
"uuid": "^10.0.0"
},
diff --git a/packages/@ama-sdk/core/src/clients/api-angular-client.ts b/packages/@ama-sdk/core/src/clients/api-angular-client.ts
index a0d6f0eb11..390ce71bf3 100644
--- a/packages/@ama-sdk/core/src/clients/api-angular-client.ts
+++ b/packages/@ama-sdk/core/src/clients/api-angular-client.ts
@@ -193,8 +193,7 @@ export class ApiAngularClient implements ApiClient {
exception = new EmptyResponseError(e.message || 'Fail to Fetch', undefined, { apiName, operationId, url, origin });
}
- // eslint-disable-next-line no-console -- `console.error` is supposed to be the default value if the `options` argument is not provided, can be removed in Otter v12.
- const reviver = getResponseReviver(revivers, response, operationId, { disableFallback: this.options.disableFallback, log: console.error });
+ const reviver = getResponseReviver(revivers, response, operationId, { disableFallback: this.options.disableFallback });
const replyPlugins = this.options.replyPlugins
? this.options.replyPlugins.map((plugin) => plugin.load({
dictionaries: root && root.dictionaries,
diff --git a/packages/@ama-sdk/core/src/fwk/api.helpers.ts b/packages/@ama-sdk/core/src/fwk/api.helpers.ts
index 2765e5a480..0271449538 100644
--- a/packages/@ama-sdk/core/src/fwk/api.helpers.ts
+++ b/packages/@ama-sdk/core/src/fwk/api.helpers.ts
@@ -115,7 +115,7 @@ export function tokenizeRequestOptions(tokenizedUrl: string, queryParameters: {
* @param endpoint
* @param options `{ disableFallback: false, log: console.error }` by default
* @param options.disableFallback `false` by default
- * @param options.log `() => {}` by default -- warning: default value will change to `console.error` in Otter v12.
+ * @param options.log `console.error` by default
*/
export function getResponseReviver(
revivers: { [statusCode: number]: ReviverType | undefined } | undefined | ReviverType,
@@ -124,7 +124,7 @@ export function getResponseReviver(
options?: { disableFallback?: boolean; log?: (...args: any[]) => void }
): ReviverType | undefined {
// eslint-disable-next-line no-console -- set as default value
- const { disableFallback = false, log: logMsg = options ? () => {} : console.error } = options ?? {};
+ const { disableFallback = false, log: logMsg = console.error } = options ?? {};
const logPrefix = `API status code error for ${endpoint || 'unknown'} endpoint`;
if (!response || !response.ok) {
return undefined;
diff --git a/packages/@ama-sdk/schematics/README.md b/packages/@ama-sdk/schematics/README.md
index 6ad2c945a1..e785549051 100644
--- a/packages/@ama-sdk/schematics/README.md
+++ b/packages/@ama-sdk/schematics/README.md
@@ -4,11 +4,7 @@
[![Bundle Size](https://img.shields.io/bundlephobia/min/@ama-sdk/schematics?color=green&style=for-the-badge)](https://www.npmjs.com/package/@ama-sdk/schematics)
This package provides `schematics` generators to create an SDK based on an OpenAPI specifications.
-There are two SDK generators in the Otter Framework: Typescript and Java. The Java generator is currently in maintenance
-mode and only the Typescript generator is actively supported and will see future evolutions.
-
-- [Typescript SDK](#typescript-sdk)
-- [Java SDK](#java-client-core-sdk)
+The Otter framework provides a Typescript SDK generator.
## Typescript SDK
@@ -287,21 +283,6 @@ For more information on the generated SDK and how the framework supports differe
- [Generated SDK hierarchy and extension](https://github.com/AmadeusITGroup/otter/blob/main/docs/api-sdk/SDK_MODELS_HIERARCHY.md)
- [Composition and Inheritance support](https://github.com/AmadeusITGroup/otter/blob/main/docs/api-sdk/COMPOSITION_INHERITANCE.md)
-## Java Client Core SDK
-
-> [!WARNING]
-> This feature is on maintenance mode and will see no future evolution
-
-Generate a Java Client Core SDK:
-
-Make sure to have a `./swagger-spec.yaml` file at the root of your project and run:
-
-```shell
-yarn schematics @ama-sdk/schematics:java-client-core --spec-path ./swagger-spec.yaml --swagger-config-path ./swagger-codegen-config.json
-```
-
-[Default swagger config](schematics/java/client-core/swagger-codegen-java-client/config/swagger-codegen-config.json) will be used if `--swagger-config-path` is not provided.
-
## Command Line Interface
This package also comes with CLI scripts that can facilitate the upgrade and publication of an SDK.
diff --git a/packages/@ama-sdk/schematics/collection.json b/packages/@ama-sdk/schematics/collection.json
index a82ba3ccd7..6c68625a9c 100644
--- a/packages/@ama-sdk/schematics/collection.json
+++ b/packages/@ama-sdk/schematics/collection.json
@@ -31,11 +31,6 @@
"description": "Generate a typescript SDK repository shell",
"factory": "./schematics/typescript/shell/index#ngGenerateTypescriptSDK",
"schema": "./schematics/typescript/shell/schema.json"
- },
- "java-client-core": {
- "description": "[Deprecated - Removed in v12] Generate a Java SDK source code based on swagger specification",
- "factory": "./schematics/java/client-core/index#ngGenerateJavaClientCore",
- "schema": "./schematics/java/client-core/schema.json"
}
}
}
diff --git a/packages/@ama-sdk/schematics/package.json b/packages/@ama-sdk/schematics/package.json
index c30ab460cd..d26b075f64 100644
--- a/packages/@ama-sdk/schematics/package.json
+++ b/packages/@ama-sdk/schematics/package.json
@@ -17,9 +17,8 @@
"postbuild": "patch-package-json-main",
"build:builders": "tsc -b tsconfig.builders.json --pretty && yarn generate-cjs-manifest",
"install-swagger-cli": "mvn install:install-file -DgroupId=io.swagger -DartifactId=swagger-codegen-cli -Dversion=2.4.0-AMADEUS -Dpackaging=jar -Dfile=./schematics/resources/swagger-codegen-cli.jar",
- "build:swagger": "yarn install-swagger-cli && run-p 'build:swagger-*' 'build:openapi-*'",
+ "build:swagger": "yarn install-swagger-cli && run-p 'build:openapi-*'",
"build:openapi-typescript-gen": "mvn clean package -f ./schematics/typescript/core/openapi-codegen-typescript/pom.xml",
- "build:swagger-java-client-gen": "mvn clean package -f ./schematics/java/client-core/swagger-codegen-java-client/pom.xml",
"build:cli": "tsc -b tsconfig.cli.json --pretty && yarn generate-cjs-manifest",
"prepare:publish": "prepare-publish ./dist"
},
@@ -70,6 +69,7 @@
"@o3r/schematics": "workspace:^",
"@openapitools/openapi-generator-cli": "^2.15.0",
"openapi-types": "^12.0.0",
+ "ts-node": "~10.9.2",
"type-fest": "^4.10.2"
},
"dependencies": {
@@ -144,7 +144,7 @@
"@swc/helpers": "~0.5.0",
"@commitlint/cli": "^19.0.0",
"@commitlint/config-conventional": "^19.0.0",
- "@typescript-eslint/eslint-plugin": "~8.17.0",
+ "@typescript-eslint/eslint-plugin": "~8.18.0",
"jest-junit": "~16.0.0",
"lint-staged": "^15.0.0",
"minimist": "^1.2.6",
diff --git a/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.generator.ts b/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.generator.ts
deleted file mode 100644
index 2fbb38a08e..0000000000
--- a/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.generator.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import {
- spawn,
- SpawnOptions,
-} from 'node:child_process';
-import * as path from 'node:path';
-import {
- CodeGenerator,
-} from '../code-generator';
-import {
- defaultOptions,
- JavaGeneratorTaskOptions,
-} from './swagger-java.options';
-
-/**
- * Manage the schematic to generate a sdk using the Swagger 2 Generator
- * Note: a working java setup compatible with Swagger 2 Generator is required to use this class
- * @deprecated to be removed in v12
- */
-export class SwaggerJavaGenerator extends CodeGenerator {
- /** @inheritDoc */
- protected generatorName = 'java-generator';
-
- /** @inheritDoc */
- protected getDefaultOptions = () => defaultOptions;
- /** @inheritDoc */
- protected runCodeGeneratorFactory(factoryOptions: { rootDirectory?: string } = {}) {
- const rootDirectory = factoryOptions.rootDirectory || process.cwd();
- return async (generatorOptions?: JavaGeneratorTaskOptions) => {
- if (!generatorOptions) {
- return Promise.reject(new Error('Missing options'));
- }
- const spawnOptions = {
- stdio: 'inherit',
- shell: true,
- cwd: rootDirectory
- } as const satisfies SpawnOptions;
- const codegenPath = path.join(generatorOptions.targetFolder, `${generatorOptions.codegenLanguage}-${generatorOptions.codegenFileName}`);
- const cliPath = path.resolve(__dirname, '..', '..', 'resources', generatorOptions.cliFilename);
-
- const args = [
- '-cp',
- codegenPath + path.delimiter + cliPath,
- 'io.swagger.codegen.SwaggerCodegen',
- 'generate',
- '-l',
- generatorOptions.codegenLanguage,
- '-i',
- generatorOptions.specPath,
- '-o',
- generatorOptions.outputPath
- ];
-
- if (!generatorOptions.apiTests) {
- args.push('-DapiTests=false');
- }
-
- if (generatorOptions.specConfigPath) {
- args.push(`-c=${generatorOptions.specConfigPath}`);
- }
-
- return new Promise((resolve, reject) => {
- spawn('java', args, spawnOptions)
- .on('close', (code: number) => {
- if (code === 0) {
- resolve();
- } else {
- reject(new Error(`Java generator failed with status ${code}`));
- }
- });
- });
- };
- }
-}
diff --git a/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.options.ts b/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.options.ts
deleted file mode 100644
index 56af474245..0000000000
--- a/packages/@ama-sdk/schematics/schematics/code-generator/swagger-java-generator/swagger-java.options.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import {
- CodegenTaskOptions,
-} from '../code-generator';
-
-/**
- * Options for the generator-java task.
- */
-export type JavaGeneratorTaskOptions = CodegenTaskOptions & {
- targetFolder: string;
- /**
- * Enable API testing in Swagger Codegen
- * @default true
- */
- apiTests: boolean;
- /**
- * Path to the Swagger CLI
- * @default 'swagger-codegen-cli.jar'
- */
- cliFilename: string;
- /**
- * Path to the Swagger Codegen
- * @default 'swagger-codegen.jar'
- */
- codegenFileName: string;
- /**
- * Template language use for the codegen
- * @default 'default'
- */
- codegenLanguage: string;
-};
-
-/**
- * Default options to generate a JAVA sdk using the Swagger 2 Generator
- */
-export const defaultOptions: Readonly = {
- apiTests: true,
- targetFolder: './',
- cliFilename: 'swagger-codegen-cli.jar',
- codegenFileName: 'swagger-codegen.jar',
- codegenLanguage: 'default',
- specPath: 'swagger-spec.yaml',
- outputPath: '.',
- specConfigPath: ''
-} as const;
diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/index.spec.ts b/packages/@ama-sdk/schematics/schematics/java/client-core/index.spec.ts
deleted file mode 100644
index 78988c116c..0000000000
--- a/packages/@ama-sdk/schematics/schematics/java/client-core/index.spec.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import * as path from 'node:path';
-import {
- Tree,
-} from '@angular-devkit/schematics';
-import {
- SchematicTestRunner,
-} from '@angular-devkit/schematics/testing';
-
-const collectionPath = path.join(__dirname, '..', '..', '..', 'collection.json');
-
-describe('Java Core Generator', () => {
- it('should work correctly', async () => {
- const runner = new SchematicTestRunner('@ama-sdk/schematics', collectionPath);
- const tree = await runner.runSchematic('java-client-core', {
- specPath: path.join(__dirname, '..', '..', '..', 'testing', 'MOCK_swagger.yaml')
- }, Tree.empty());
-
- expect(tree.files.length).toBeGreaterThan(0);
- });
-});
diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/index.ts b/packages/@ama-sdk/schematics/schematics/java/client-core/index.ts
deleted file mode 100644
index db8ad6ee4e..0000000000
--- a/packages/@ama-sdk/schematics/schematics/java/client-core/index.ts
+++ /dev/null
@@ -1,102 +0,0 @@
-import {
- promises as fs,
-} from 'node:fs';
-import * as path from 'node:path';
-import {
- chain,
- Rule,
- SchematicContext,
- Tree,
-} from '@angular-devkit/schematics';
-import {
- SwaggerJavaGenerator,
-} from '../../code-generator/swagger-java-generator/swagger-java.generator';
-import {
- treeGlob,
-} from '../../helpers/tree-glob';
-import {
- NgGenerateJavaClientCoreSchematicsSchema,
-} from './schema';
-
-/** Base path where to find codegen jars */
-const jarBasePath = path.resolve(__dirname, 'swagger-codegen-java-client', 'target');
-
-/**
- * Generate a Java client SDK source code base on swagger specification
- * @param options
- */
-function ngGenerateJavaClientCoreFn(options: NgGenerateJavaClientCoreSchematicsSchema): Rule {
- const specPath = path.resolve(process.cwd(), options.specPath);
- /**
- * rule to clear previous SDK generation
- * @param tree
- * @param context
- */
- const clearGeneratedCode = async (tree: Tree, context: SchematicContext) => {
- const swaggerConfig = options.specConfigPath ? JSON.parse(await fs.readFile(options.specConfigPath, { encoding: 'utf8' })) as Record : undefined;
- if (swaggerConfig?.additionalProperties) {
- const modelPackage = swaggerConfig.additionalProperties?.basePackage;
- if (modelPackage) {
- context.logger.info('Remove previously generated base models');
- treeGlob(tree, path.join('src', 'main', 'java', ...modelPackage.split('.'), '**', '*.java')).forEach((file) => tree.delete(file));
- }
-
- const apiInterfacesPackage = swaggerConfig.additionalProperties.endpointsPackage;
- if (apiInterfacesPackage) {
- context.logger.info('Remove previously generated API interfaces');
- treeGlob(tree, path.join('src', 'main', 'java', ...apiInterfacesPackage.split('.'), '**', '*.java')).forEach((file) => tree.delete(file));
- }
-
- const apiImplPackage = swaggerConfig.additionalProperties.endpointsImplPackage;
- if (apiImplPackage) {
- context.logger.info('Remove previously generated API implementations');
- treeGlob(tree, path.join('src', 'main', 'java', ...apiImplPackage.split('.'), '**', '*.java')).forEach((file) => tree.delete(file));
- }
- }
-
- context.logger.info('Remove previously generated doc');
- treeGlob(tree, path.join('docs', '**')).forEach((file) => tree.delete(file));
- if (tree.exists('/README.md')) {
- context.logger.info('Remove previously generated readme');
- tree.delete('/README.md');
- }
- return () => tree;
- };
-
- /**
- * rule to update readme and generate mandatory code source
- * @param tree
- */
- const generateSource = async (tree: Tree) => {
- const specContent = await fs.readFile(path.resolve(process.cwd(), options.specPath), { encoding: 'utf8' });
- if (tree.exists('/swagger-spec.yaml')) {
- tree.overwrite('/swagger-spec.yaml', specContent);
- } else {
- tree.create('/swagger-spec.yaml', specContent);
- }
-
- return () => tree;
- };
-
- return chain([
- clearGeneratedCode,
- generateSource,
- (new SwaggerJavaGenerator()).getGeneratorRunSchematic({
- targetFolder: jarBasePath,
- specPath,
- codegenLanguage: 'javaClient',
- apiTests: false,
- specConfigPath: options.specConfigPath || undefined
- })
- ]);
-}
-
-/**
- * Generate a Java client SDK source code base on swagger specification
- * @deprecated Remove in otter v12
- * @param options
- */
-export const ngGenerateJavaClientCore = (options: NgGenerateJavaClientCoreSchematicsSchema) => async () => {
- const { createSchematicWithMetricsIfInstalled } = await import('@o3r/schematics');
- return createSchematicWithMetricsIfInstalled(ngGenerateJavaClientCoreFn)(options);
-};
diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/schema.json b/packages/@ama-sdk/schematics/schematics/java/client-core/schema.json
deleted file mode 100644
index 6cdd28ce65..0000000000
--- a/packages/@ama-sdk/schematics/schematics/java/client-core/schema.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-07/schema",
- "$id": "NgGenerateJavaClientCoreSchematicsSchema",
- "title": "Generate Java Client",
- "description": "ng generate java-client-core",
- "properties": {
- "specPath": {
- "type": "string",
- "description": "Path to the swagger specification used to generate the SDK",
- "x-prompt": "Swagger Spec file to generate the SDK",
- "$default": {
- "$source": "argv",
- "index": 0
- }
- },
- "specConfigPath": {
- "type": "string",
- "description": "Swagger config file\nMore info: https://openapi-generator.tech/docs/generators/java/#config-options"
- }
- },
- "additionalProperties": true,
- "required": [
- "specPath"
- ]
-}
diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/schema.ts b/packages/@ama-sdk/schematics/schematics/java/client-core/schema.ts
deleted file mode 100644
index 04c2935877..0000000000
--- a/packages/@ama-sdk/schematics/schematics/java/client-core/schema.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import type {
- SchematicOptionObject,
-} from '@o3r/schematics';
-
-export interface NgGenerateJavaClientCoreSchematicsSchema extends SchematicOptionObject {
- /** Path to the swagger specification used to generate the SDK */
- specPath: string;
-
- /** Swagger config file */
- specConfigPath?: string | undefined;
-}
diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/.gitignore b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/.gitignore
deleted file mode 100644
index 16c20927ab..0000000000
--- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-# Output directory
-/test-sdk
-/~
-
-# IDE
-*.iml
-
-.classpath
-.project
-.factorypath
-.settings
diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/README.md b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/README.md
deleted file mode 100644
index 7324a4b77a..0000000000
--- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/README.md
+++ /dev/null
@@ -1,105 +0,0 @@
-# Swagger Codegen for the javaClient library [Deprecated]
-
-> [!WARN]
-> This project is no longer maintained and is now fully deprecated. We intend to delete it from Otter v12
-> It is based on old version of the SwaggerCodegen tool which is not even compatible with today's standard.
-
-## Overview
-This is a boilerplate project to generate your own client library with Swagger. Its goal is
-to get you started with the basic plumbing so you can put in your own logic. It won't work without
-your changes applied.
-
-## What's Swagger?
-The goal of Swaggerâ„¢ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service.
-
-
-Check out [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger project, including additional libraries with support for other languages and more.
-
-## How do I use this?
-At this point, you've likely generated a client setup. It will include something along these lines:
-
-```
-.
-|- README.md // this file
-|- pom.xml // build script
-|-- src
-|--- main
-|---- java
-|----- com.amadeus.swagger.codegen.javaclient.CustomJavaClientCodegen.java // generator file
-|---- resources
-|----- javaClient // template files
-|----- config
-|------- swagger-codegen-config.json // language generation config file
-|----- META-INF
-|------ services
-|------- io.swagger.codegen.CodegenConfig
-```
-
-You _will_ need to make changes in at least the following:
-
-`CustomJavaClientCodegen.java`
-
-Templates in this folder:
-
-`src/main/resources/javaClient`
-
-Once modified, you can run this:
-
-```
-mvn package
-```
-
-In your generator project. A single jar file will be produced in `target`. You can now use that with codegen:
-
-```
-java -cp /path/to/swagger-codegen-distribution:/path/to/your/jar io.swagger.codegen.Codegen -l javaClient -c "path/to/language/config/file/swagger-codegen-config.json" -o ./test-sdk
-```
-
-Now your templates are available to the client generator and you can write output values
-
-## But how do I modify this?
-The `CustomJavaClientCodegen.java` has comments in it--lots of comments. There is no good substitute
-for reading the code more, though. See how the `CustomJavaClientCodegen` implements `CodegenConfig`.
-That class has the signature of all values that can be overridden.
-
-For the templates themselves, you have a number of values available to you for generation.
-You can execute the `java` command from above while passing different debug flags to show
-the object you have available during client generation:
-
-```
-# The following additional debug options are available for all codegen targets:
-# -DdebugSwagger prints the OpenAPI Specification as interpreted by the codegen
-# -DdebugModels prints models passed to the template engine
-# -DdebugOperations prints operations passed to the template engine
-# -DdebugSupportingFiles prints additional data passed to the template engine
-
-java -DdebugOperations -cp /path/to/swagger-codegen-distribution:/path/to/your/jar io.swagger.codegen.Codegen -l javaClient -c "path/to/language/config/file/swagger-codegen-config.json" -o ./test-sdk
-```
-
-Will, for example, output the debug info for operations. You can use this info
-in the `api.mustache` file.
-
-### swagger-codegen-config.json
-
-Example of swagger-codegen-config.json
-``` json
-{
- "modelPackage" : "com.company.api",
- "apiPackage" : "com.company.api",
- "invokerPackage" : "com.company.api",
- "generateApiTests": "false",
- "groupId" : "com.company.api",
- "artifactId" : "dapi-client-sdk",
- "dateLibrary" : "java8",
- "java8": true,
- "hideGenerationTimestamp": true,
- "additionalProperties": {
- "endpointsImplPackage": "com.company.api.api.impl",
- "endpointsPackage": "com.company.api.api.interfaces",
- "basePackage": "com.company.api.model.base",
- "corePackage": "com.company.api.model.core",
- "sdkCorePackage": "com.company.sdk.core",
- "sdkUtilsPackage": "com.company.sdk.utils"
- }
-}
-```
diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/config/swagger-codegen-config.json b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/config/swagger-codegen-config.json
deleted file mode 100644
index a301856963..0000000000
--- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/config/swagger-codegen-config.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "modelPackage" : "com.amadeus.dapi",
- "apiPackage" : "com.amadeus.dapi",
- "invokerPackage" : "com.amadeus.dapi",
- "generateApiTests": "false",
- "groupId" : "com.amadeus.dapi",
- "artifactId" : "dapi-client-sdk",
- "dateLibrary" : "java8",
- "java8": true,
- "hideGenerationTimestamp": true,
- "additionalProperties": {
- "endpointsImplPackage": "com.amadeus.dapi.api.impl",
- "endpointsPackage": "com.amadeus.dapi.api.interfaces",
- "basePackage": "com.amadeus.dapi.model.base",
- "corePackage": "com.amadeus.dapi.model.core",
- "sdkCorePackage": "com.amadeus.des.sdk.core",
- "sdkUtilsPackage": "com.amadeus.des.sdk.utils"
- }
-}
diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/pom.xml b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/pom.xml
deleted file mode 100644
index 600c19dbc0..0000000000
--- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/pom.xml
+++ /dev/null
@@ -1,154 +0,0 @@
-
- 4.0.0
- io.swagger
- javaClient-swagger-codegen
- jar
- javaClient-swagger-codegen
- ${project.version}
-
- 2.2.0
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
-
-
- unpack-templates
- process-classes
-
- unpack
-
-
-
-
- io.swagger
- swagger-codegen-cli
- 2.4.0-AMADEUS
- jar
- false
- ${project.build.directory}/default-templates
- Java/**/*.mustache
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-resources-plugin
-
-
- copy-templates
- process-classes
-
- copy-resources
-
-
- ${project.build.directory}/classes/javaClient
- false
-
-
- ${project.build.directory}/default-templates/Java
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.22.2
-
-
-
- loggerPath
- conf/log4j.properties
-
-
- -Xms512m -Xmx1500m
- methods
- pertest
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 2.6
-
-
-
- jar
- test-jar
-
-
-
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
-
- add_sources
- generate-sources
-
- add-source
-
-
-
-
-
-
-
-
- add_test_sources
- generate-test-sources
-
- add-test-source
-
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.13.0
-
-
- 1.8
-
-
-
-
-
-
- io.swagger
- swagger-codegen-cli
- ${swagger-codegen-version}
- provided
-
-
-
- 2.4.0-AMADEUS
- 1.0.0
- 4.8.1
- 1.0.0
- 0.0.0
- ${project.name}
-
-
diff --git a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/CustomJavaClientCodegen.java b/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/CustomJavaClientCodegen.java
deleted file mode 100644
index 5d6f10b110..0000000000
--- a/packages/@ama-sdk/schematics/schematics/java/client-core/swagger-codegen-java-client/src/main/java/com/amadeus/swagger/codegen/javaclient/CustomJavaClientCodegen.java
+++ /dev/null
@@ -1,553 +0,0 @@
-package com.amadeus.swagger.codegen.javaclient;
-
-import java.io.IOException;
-import java.nio.file.*;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.stream.*;
-
-import com.google.common.base.CaseFormat;
-
-import io.swagger.codegen.CodegenModel;
-import io.swagger.codegen.CodegenProperty;
-import org.apache.commons.lang3.StringUtils;
-
-import io.swagger.codegen.CodegenConfig;
-import io.swagger.codegen.CodegenOperation;
-import io.swagger.codegen.CodegenParameter;
-import io.swagger.codegen.SupportingFile;
-import io.swagger.codegen.languages.JavaClientCodegen;
-import io.swagger.models.HttpMethod;
-import io.swagger.models.Model;
-import io.swagger.models.ModelImpl;
-import io.swagger.models.Operation;
-import io.swagger.models.Path;
-import io.swagger.models.Swagger;
-import io.swagger.models.parameters.Parameter;
-import io.swagger.models.properties.Property;
-
-public class CustomJavaClientCodegen extends JavaClientCodegen implements CodegenConfig {
-
- /**
- * Extension of standard Java swagger code generator, to adhere to SOLID
- * principles (https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)
- *
- *
- * S: extract URL manipulations to a separate utility class URLUtils
- *
- * I/D: create interfaces for APIs, to depend on abstractions. The APiClient
- * implementation is renamed to DefaultApiClient.
- */
-
- public static final String FILE_SEPARATOR = java.nio.file.FileSystems.getDefault().getSeparator();
-
- private LambdaHelper lambdaHelper = new LambdaHelper();
-
- /**
- * Operation vendor extension: wrapper model class simple name (ex:
- * MyOperationRequest)
- */
- private static final String X_REQUEST_WRAPPER_MODEL_TYPE = "x-request-wrapper-model-type";
-
- /**
- * Parameters vendor extension: value of parameter via calling getter on wrapper
- * object (ex: request.getParam1())
- */
- private static final String X_REQUEST_UNWRAPPED_PARAM_VALUE = "x-request-unwrapped-param-value";
-
- /**
- * Parameters vendor extension: value of parameter in camel case
- * ("parameterName" to "ParameterName")
- */
- private static final String X_PARAM_NAME_IN_CAMEL_CASE = "x-param-name-in-camel-case";
-
- public static final String SETTER_SUFFIX_FOR_ENUM_LISTS = "FromStrings";
-
- public static final String ENDPOINTS_IMPL_PACKAGE = "endpointsImplPackage";
- protected String endpointsImplPackage = "com.amadeus.dapi.api.impl";
-
- public static final String ENDPOINTS_PACKAGE = "endpointsPackage";
- protected String endpointsPackage = "com.amadeus.dapi.api.interfaces";
-
- public static final String CORE_PACKAGE = "corePackage";
- protected String corePackage = "com.amadeus.dapi.model.core";
-
- public static final String BASE_PACKAGE = "basePackage";
- protected String basePackage = "com.amadeus.dapi.model.base";
-
- public static final String EXCLUDE_WRAPPED_INTERFACES = "excludeWrappedInterfaces";
- protected boolean shouldExcludeWrappedInterfaces = false;
-
- public static final String EXCLUDE_IMPL = "excludeImpl";
- protected boolean shouldExcludeImpl = false;
-
- private List postProcessConfigs;
-
- public CustomJavaClientCodegen() {
- super();
- // Override the output folder and template location
- setLibrary(null);
- setOutputDir("generated-code/javaClient");
- setTemplateDir("javaClient");
-
- embeddedTemplateDir = "javaClient";
- postProcessConfigs = new ArrayList<>();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getName() {
- return "javaClient";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getHelp() {
- return "Generates a Java client library.";
- }
-
- /**
- * Ignore the gradle-related files, and add new supporting files.
- */
- @Override
- public void processOpts() {
- super.processOpts();
-
- additionalProperties.put("uppercaseFirst", new LambdaHelper.UppercaseFirstLambda());
- additionalProperties.put("removeDuplicateLines", new LambdaHelper.RemoveDuplicateLinesLambda());
- additionalProperties.put("removeEmptyLines", new LambdaHelper.RemoveEmptyLines());
- additionalProperties.put("jackson", "true");
- additionalProperties.remove("gson");
-
- if (additionalProperties.containsKey(ENDPOINTS_IMPL_PACKAGE)) {
- this.setEndpointsImplPackage((String) additionalProperties.get(ENDPOINTS_IMPL_PACKAGE));
- } else {
- // not set, use to be passed to template
- additionalProperties.put(ENDPOINTS_IMPL_PACKAGE, endpointsImplPackage);
- }
-
- if (additionalProperties.containsKey(ENDPOINTS_PACKAGE)) {
- this.setEndpointsPackage((String) additionalProperties.get(ENDPOINTS_PACKAGE));
- } else {
- // not set, use to be passed to template
- additionalProperties.put(ENDPOINTS_PACKAGE, endpointsPackage);
- }
-
- if (additionalProperties.containsKey(CORE_PACKAGE)) {
- this.setCorePackage((String) additionalProperties.get(CORE_PACKAGE));
- } else {
- // not set, use to be passed to template
- additionalProperties.put(CORE_PACKAGE, corePackage);
- }
-
- if (additionalProperties.containsKey(BASE_PACKAGE)) {
- this.setBasePackage((String) additionalProperties.get(BASE_PACKAGE));
- } else {
- // not set, use to be passed to template
- additionalProperties.put(BASE_PACKAGE, basePackage);
- }
-
- if (additionalProperties.containsKey(EXCLUDE_WRAPPED_INTERFACES)) {
- setShouldExcludeWrappedInterfaces((Boolean)additionalProperties.get(EXCLUDE_WRAPPED_INTERFACES));
- } else {
- additionalProperties.put(EXCLUDE_WRAPPED_INTERFACES, shouldExcludeWrappedInterfaces);
- }
-
- if (additionalProperties.containsKey(EXCLUDE_IMPL)) {
- setShouldExcludeImpl((Boolean)additionalProperties.get(EXCLUDE_IMPL));
- } else {
- additionalProperties.put(EXCLUDE_IMPL, shouldExcludeImpl);
- }
-
- supportingFiles.clear();
- modelTemplateFiles.clear();
- apiTemplateFiles.clear();
- apiTestTemplateFiles.clear();
-
- modelTemplateFiles.put("model.mustache", "Private.java");
- modelTemplateFiles.put("coreModel.mustache", ".java");
-
- // API: interface and implementation
- apiTemplateFiles.put("api.mustache", "Api.java");
-
- if (!shouldExcludeWrappedInterfaces) {
- apiTemplateFiles.put("wrapped_api.mustache", "WrappedApi.java");
- }
-
- if (!shouldExcludeImpl) {
- apiTemplateFiles.put("wrapped_api_impl.mustache", "WrappedApiImpl.java");
- }
-
- String patchFolder = sourceFolder + FILE_SEPARATOR + endpointsPackage.replace(".", FILE_SEPARATOR);
- supportingFiles.add(new SupportingFile("PATCH.mustache", patchFolder, "PATCH.java"));
- supportingFiles.add(new SupportingFile("settings.mustache", "settings.xml"));
- supportingFiles.add(new SupportingFile("README.mustache", "README.md"));
-
- String baseModelPathString = packageToSrcFolder(basePackage);
- String coreModelPathString = packageToSrcFolder(corePackage);
-
- // Manually manage the structure of the code generated by swagger codegen (models, api interfaces, api impl and api test)
- postProcessConfigs.add(new FilePostProcessConfig(".*ApiTest[.]java$", packageToTestFolder(endpointsImplPackage), true));
- postProcessConfigs.add(new FilePostProcessConfig(".*ApiImpl[.]java$", packageToSrcFolder(endpointsImplPackage), true));
- postProcessConfigs.add(new FilePostProcessConfig(".*Api[.]java$", packageToSrcFolder(endpointsPackage), true));
- postProcessConfigs.add(new FilePostProcessConfig(".*Private[.]java$", baseModelPathString, true));
- postProcessConfigs.add(new FilePostProcessConfig(".*java$", coreModelPathString, false));
-
- }
-
- @Override
- public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
- super.postProcessModelProperty(model, property);
-
- if( property != null ) {
- if (property.datatype.contains("BigDecimal") || property.datatype.contains("OffsetDateTime") || property.datatype.contains("LocalDate")) {
- property.isPrimitiveType = true;
- }
- if (property.isContainer && (property.items.datatype.contains("BigDecimal") || property.items.datatype.contains("OffsetDateTime") || property.datatype.contains("LocalDate"))) {
- property.items.isPrimitiveType = true;
- }
-
- // Check that we have vendor extensions for dictionary
- if (property.vendorExtensions.containsKey("x-dictionary-name")) {
- // Add some imports needed when reviving object from dictionaries
- model.imports.add("java.util.Map");
- model.imports.add("java.lang.reflect.InvocationTargetException");
- model.imports.add("com.fasterxml.jackson.annotation.JsonIgnore");
-
- String type = (String)property.vendorExtensions.get("x-field-type");
- if (typeMapping.containsKey(type) || languageSpecificPrimitives.contains(type)) {
- if (typeMapping.containsKey(type)) {
- property.vendorExtensions.put("x-field-type", typeMapping.get(type));
- }
- } else {
- model.imports.add(type);
- }
- }
-
- if (property.vendorExtensions.containsKey("x-map-name") && !property.isListContainer) {
- throw new IllegalArgumentException("error in " + property.baseName + ", x-map-name should only apply to a " + "list container.");
- }
- }
- }
-
- /**
- * Process models to identify API Root reply object and among them which ones declare dictionaries.
- * These helpers are used to revive data model with dictionaries.
- */
- @Override
- public Map postProcessModels(Map objs) {
- for (Map.Entry entry : objs.entrySet()) {
- if( "models".equals(entry.getKey()) ) {
-
- for( HashMap _map : (List)entry.getValue() ) {
- CodegenModel model = (CodegenModel) _map.get("model");
- boolean hasDictionaries = false;
- for (CodegenProperty property : model.vars) {
- hasDictionaries |= "dictionaries".equalsIgnoreCase(property.name);
- }
- if (model.classname.endsWith("Reply")) {
- model.vendorExtensions.put("isReply", Boolean.TRUE);
- if (hasDictionaries) {
- model.vendorExtensions.put("isReplyWithDictionaries", Boolean.TRUE);
- }
- }
- }
- }
- }
- return super.postProcessModels(objs);
- }
-
- /**
- * Suffix all files with API
- */
- @Override
- public String apiFilename(String templateName, String tag) {
- String suffix = apiTemplateFiles().get(templateName);
- return apiFileFolder() + FILE_SEPARATOR + toApiFilename(tag) + suffix;
- }
-
- public void setEndpointsImplPackage(String endpointsImplPackage) {
- this.endpointsImplPackage = endpointsImplPackage;
- }
-
- public void setEndpointsPackage(String endpointsPackage) {
- this.endpointsPackage = endpointsPackage;
- }
-
- public void setBasePackage(String basePackage) {
- this.basePackage = basePackage;
- }
-
- public void setCorePackage(String corePackage) {
- this.corePackage = corePackage;
- }
-
- private void setShouldExcludeWrappedInterfaces(boolean shouldExcludeWrappedInterfaces) {
- this.shouldExcludeWrappedInterfaces = shouldExcludeWrappedInterfaces;
- }
-
- private void setShouldExcludeImpl(boolean shouldExcludeImpl) {
- this.shouldExcludeImpl = shouldExcludeImpl;
- }
-
- /**
- * Enum values are converted from camelCase to UPPER_SNAKE_CASE
- */
- @Override
- public String toEnumVarName(String value, String datatype) {
- String upperSnakeCaseValue = value;
- if (!StringUtils.isAllUpperCase(value)) {
- upperSnakeCaseValue = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, value);
- }
- return super.toEnumVarName(upperSnakeCaseValue, datatype);
- }
-
- /**
- * Hook for altering the CodegenOperation data after it has been built from the
- * swagger specification.
- *
- * New variables are passed to template via vendor extensions.
- */
- @Override
- public Map postProcessOperations(Map objs) {
- Map newObjs = super.postProcessOperations(objs);
-
- List