Skip to content

Commit 23350e3

Browse files
committed
feat: add use case for 3.1 multi-type
1 parent 4f4f6c4 commit 23350e3

7 files changed

Lines changed: 33 additions & 23 deletions

File tree

nx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@
707707
"outputs": [
708708
"{projectRoot}/target/*.jar"
709709
],
710-
"cache": true
710+
"cache": false
711711
},
712712
"i18n": {
713713
"cache": true

packages/@ama-sdk/openapi-codegen-typescript/src/main/java/com/amadeus/codegen/ts/AbstractTypeScriptClientCodegen.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ public abstract class AbstractTypeScriptClientCodegen extends org.openapitools.c
6767
/** Custom request body transformation logic (GlobalSettings: requestBodyTransform, default: empty) */
6868
private final String requestBodyTransform;
6969

70+
/**
71+
* Preprocesses the OpenAPI specification to extract operation adapter paths.
72+
* This generates the OPERATION_ADAPTER data structure used for runtime operation matching.
73+
*
74+
* @param openAPI the OpenAPI specification to preprocess
75+
*/
76+
protected abstract void preprocessOperationAdapter(OpenAPI openAPI);
77+
7078
/**
7179
* Constructor for Otter-specific TypeScript client code generator.
7280
*
@@ -559,6 +567,18 @@ public void postProcessParameter(CodegenParameter parameter) {
559567
}
560568
}
561569

570+
/**
571+
* Otter-specific override: Add any additional preprocessing logic for the OpenAPI specification:
572+
* - Extract operation adapter paths for runtime matching and add to additionalProperties for template access.
573+
*
574+
* @param openAPI the OpenAPI specification to preprocess
575+
*/
576+
@Override
577+
public void preprocessOpenAPI(OpenAPI openAPI) {
578+
super.preprocessOpenAPI(openAPI);
579+
this.preprocessOperationAdapter(openAPI);
580+
}
581+
562582
/**
563583
* Otter-specific: Returns the TypeScript type for date-time objects without timezone modification.
564584
*

packages/@ama-sdk/openapi-codegen-typescript/src/main/java/com/amadeus/codegen/ts/TypescriptfetchGenerator.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,26 +95,10 @@ public TypescriptfetchGenerator() {
9595
}
9696

9797
/**
98-
* Otter-specific override: Escapes a reserved word as defined in the `reservedWords` array. Handle escaping
99-
* those terms here. This logic is only called if a variable matches the reseved words
100-
*
101-
* @return the escaped term
102-
*/
103-
@Override
104-
public String escapeReservedWord(String name) {
105-
return "_" + name; // add an underscore to the name
106-
}
107-
108-
/**
109-
* Otter-specific override: Preprocesses the OpenAPI specification to extract operation adapter paths.
110-
* This generates the OPERATION_ADAPTER data structure used for runtime operation matching.
111-
*
112-
* @param openAPI the OpenAPI specification to preprocess
98+
* @inheritDoc
11399
*/
114100
@Override
115-
public void preprocessOpenAPI(OpenAPI openAPI) {
116-
super.preprocessOpenAPI(openAPI);
117-
101+
protected void preprocessOperationAdapter(OpenAPI openAPI) {
118102
if (openAPI.getPaths() == null) {
119103
return;
120104
}

packages/@o3r-training/showcase-sdk/open-api.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
openapi: 3.0.2
1+
openapi: 3.1.0
22

33
servers:
44
- url: 'https://{environment}/v3'
@@ -786,7 +786,9 @@ components:
786786
xml:
787787
name: tag
788788
status:
789-
type: string
789+
type:
790+
- string
791+
- "null"
790792
description: pet status in the store
791793
enum:
792794
- available

packages/@o3r-training/showcase-sdk/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"generate": "schematics ../../@ama-sdk/schematics/dist:typescript-core --generator-key training-showcase-sdk",
5454
"spec:regen": "yarn run generate --no-dry-run && amasdk-clear-index",
5555
"files:pack": "yarn amasdk-files-pack",
56-
"test": "jest --passWithNoTests",
5756
"publish:package": "npm publish ./dist",
5857
"generate:mock": "schematics ../../@ama-sdk/schematics/dist:mock",
5958
"doc:generate": "node scripts/override-readme.js && typedoc && node scripts/restore-readme.js",

packages/@o3r-training/showcase-sdk/project.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
"^cli"
2323
]
2424
},
25+
"test": {
26+
"options": {
27+
"passWithNoTests": true
28+
}
29+
},
2530
"regen": {},
2631
"lint": {},
2732
"extract-folder-structure": {

packages/@o3r-training/showcase-sdk/src/models/base/pet/pet.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)