Skip to content

Commit d2a06dd

Browse files
committed
test: add integration test for typescript-angular deepObject query params
1 parent b5472b6 commit d2a06dd

47 files changed

Lines changed: 15646 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CI/circle_parallel.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ elif [ "$NODE_INDEX" = "3" ]; then
9191
(cd samples/client/petstore/typescript-angular-v17-provided-in-root && mvn integration-test)
9292
(cd samples/client/petstore/typescript-angular-v18-provided-in-root && mvn integration-test)
9393
(cd samples/client/petstore/typescript-angular-v19-provided-in-root && mvn integration-test)
94+
(cd samples/client/other/typescript-angular-deep-object && mvn integration-test)
9495
(cd samples/openapi3/client/petstore/typescript/builds/default && mvn integration-test)
9596
(cd samples/openapi3/client/petstore/typescript/tests/default && mvn integration-test)
9697
(cd samples/openapi3/client/petstore/typescript/builds/jquery && mvn integration-test)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
generatorName: typescript-angular
2+
outputDir: samples/client/others/typescript-angular-deep-object/builds/default
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/deep-object-query.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
5+
additionalProperties:
6+
ngVersion: 19.0.1
7+
supportsES6: true
8+
tsVersion: 5.6.3
9+
zonejsVersion: 0.15.0
10+
ngPackagrVersion: 19.0.1
11+
rxjsVersion: 6.5.3

modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,29 @@ public void testEnumAsConst() throws IOException {
464464
assertThat(fileContents).containsOnlyOnce("} as const;");
465465
assertThat(fileContents).doesNotContain(" as Type");
466466
}
467+
468+
@Test
469+
public void testDeepObject() throws IOException {
470+
// GIVEN
471+
final String specPath = "src/test/resources/3_0/deepobject.yaml";
472+
473+
File output = Files.createTempDirectory("test").toFile();
474+
output.deleteOnExit();
475+
476+
// WHEN
477+
final CodegenConfigurator configurator = new CodegenConfigurator()
478+
.setGeneratorName("typescript-angular")
479+
.setInputSpec(specPath)
480+
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
481+
482+
final ClientOptInput clientOptInput = configurator.toClientOptInput();
483+
484+
Generator generator = new DefaultGenerator();
485+
generator.opts(clientOptInput).generate();
486+
487+
// THEN
488+
final String fileContents = Files.readString(Paths.get(output + "/api/default.service.ts"));
489+
assertThat(fileContents).containsOnlyOnce("<any>options, 'options', true);");
490+
assertThat(fileContents).containsOnlyOnce("<any>inputOptions, 'inputOptions', true);");
491+
}
467492
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
openapi: 3.0.0
2+
info:
3+
title: deepobject-query
4+
version: 1.0.0
5+
paths:
6+
/car:
7+
get:
8+
operationId: getCars
9+
parameters:
10+
- name: filter
11+
in: query
12+
required: false
13+
style: deepObject
14+
schema:
15+
$ref: '#/components/schemas/CarFilter'
16+
explode: true
17+
responses:
18+
'200':
19+
description: OK
20+
content:
21+
text/plain:
22+
schema:
23+
type: array
24+
items:
25+
$ref: '#/components/schemas/Car'
26+
components:
27+
schemas:
28+
Car:
29+
type: object
30+
properties:
31+
id:
32+
type: integer
33+
format: int64
34+
example: 1
35+
make:
36+
type: string
37+
example: Toyota
38+
model:
39+
type: string
40+
example: Camry
41+
CarFilter:
42+
type: object
43+
properties:
44+
make:
45+
type: string
46+
example: Toyota
47+
model:
48+
type: string
49+
example: Camry
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
13+
14+
# IDEs and editors
15+
.idea/
16+
.project
17+
.classpath
18+
.c9/
19+
*.launch
20+
.settings/
21+
*.sublime-workspace
22+
23+
# Visual Studio Code
24+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
.history/*
30+
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
testem.log
38+
/typings
39+
40+
# System files
41+
.DS_Store
42+
Thumbs.db
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"typescript-angular-deep-object-tests": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:application",
15+
"options": {
16+
"outputPath": "dist/typescript-angular-deep-object-tests",
17+
"index": "src/index.html",
18+
"browser": "src/main.ts",
19+
"polyfills": [
20+
"zone.js"
21+
],
22+
"tsConfig": "tsconfig.app.json",
23+
"assets": [
24+
{
25+
"glob": "**/*",
26+
"input": "public"
27+
}
28+
],
29+
"styles": [
30+
"src/styles.css"
31+
],
32+
"scripts": []
33+
},
34+
"configurations": {
35+
"production": {
36+
"budgets": [
37+
{
38+
"type": "initial",
39+
"maximumWarning": "500kB",
40+
"maximumError": "1MB"
41+
},
42+
{
43+
"type": "anyComponentStyle",
44+
"maximumWarning": "4kB",
45+
"maximumError": "8kB"
46+
}
47+
],
48+
"outputHashing": "all"
49+
},
50+
"development": {
51+
"optimization": false,
52+
"extractLicenses": false,
53+
"sourceMap": true
54+
}
55+
},
56+
"defaultConfiguration": "production"
57+
},
58+
"serve": {
59+
"builder": "@angular-devkit/build-angular:dev-server",
60+
"configurations": {
61+
"production": {
62+
"buildTarget": "typescript-angular-deep-object-tests:build:production"
63+
},
64+
"development": {
65+
"buildTarget": "typescript-angular-deep-object-tests:build:development"
66+
}
67+
},
68+
"defaultConfiguration": "development"
69+
},
70+
"extract-i18n": {
71+
"builder": "@angular-devkit/build-angular:extract-i18n"
72+
},
73+
"test": {
74+
"builder": "@angular-devkit/build-angular:karma",
75+
"options": {
76+
"polyfills": [
77+
"zone.js",
78+
"zone.js/testing"
79+
],
80+
"tsConfig": "tsconfig.spec.json",
81+
"assets": [
82+
{
83+
"glob": "**/*",
84+
"input": "public"
85+
}
86+
],
87+
"styles": [
88+
"src/styles.css"
89+
],
90+
"scripts": []
91+
}
92+
}
93+
}
94+
}
95+
}
96+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
wwwroot/*.js
2+
node_modules
3+
typings
4+
dist
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.gitignore
2+
README.md
3+
api.base.service.ts
4+
api.module.ts
5+
api/api.ts
6+
api/default.service.ts
7+
configuration.ts
8+
encoder.ts
9+
git_push.sh
10+
index.ts
11+
model/car.ts
12+
model/carFilter.ts
13+
model/models.ts
14+
param.ts
15+
variables.ts
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.13.0-SNAPSHOT

0 commit comments

Comments
 (0)