diff --git a/bin/configs/typescript-angular-with-prefixed-module-name-v8.yaml b/bin/configs/typescript-angular-with-prefixed-module-name-v8.yaml index b7cf4fd45e81..d0c0e1cd0b70 100644 --- a/bin/configs/typescript-angular-with-prefixed-module-name-v8.yaml +++ b/bin/configs/typescript-angular-with-prefixed-module-name-v8.yaml @@ -8,3 +8,4 @@ additionalProperties: npmRepository: https://skimdb.npmjs.com/registry snapshot: false apiModulePrefix: PetStore + configurationPrefix: PetStore diff --git a/docs/generators/typescript-angular.md b/docs/generators/typescript-angular.md index d859d3f759b1..55a7c1477dd6 100644 --- a/docs/generators/typescript-angular.md +++ b/docs/generators/typescript-angular.md @@ -9,6 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiModulePrefix|The prefix of the generated ApiModule.| |null| +|configurationPrefix|The prefix of the generated Configuration.| |null| |disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|
undefined if no selection could be made.
@@ -115,7 +115,7 @@ export class Configuration {
/**
* Select the correct accept content-type to use for a request.
- * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
+ * Uses {@link {{configurationClassName}}#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param accepts - the array of content types that are available for selection.
* @returns the selected content-type or undefined if no selection could be made.
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java
index ca8c7f491e97..51049743954c 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java
@@ -42,6 +42,7 @@ public class TypeScriptAngularClientOptionsProvider implements OptionsProvider {
public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true";
public static final String FILE_NAMING_VALUE = "camelCase";
public static final String API_MODULE_PREFIX = "";
+ public static final String CONFIGURATION_PREFIX = "";
public static final String QUERY_PARAM_OBJECT_FORMAT_VALUE = "dot";
public static String SERVICE_SUFFIX = "Service";
public static String SERVICE_FILE_SUFFIX = ".service";
@@ -75,6 +76,7 @@ public class TypeScriptAngularClientOptionsProvider implements OptionsProvider {
.put(TypeScriptAngularClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY)
.put(TypeScriptAngularClientCodegen.NG_VERSION, NG_VERSION)
.put(TypeScriptAngularClientCodegen.API_MODULE_PREFIX, API_MODULE_PREFIX)
+ .put(TypeScriptAngularClientCodegen.CONFIGURATION_PREFIX, CONFIGURATION_PREFIX)
.put(TypeScriptAngularClientCodegen.SERVICE_SUFFIX, SERVICE_SUFFIX)
.put(TypeScriptAngularClientCodegen.SERVICE_FILE_SUFFIX, SERVICE_FILE_SUFFIX)
.put(TypeScriptAngularClientCodegen.MODEL_SUFFIX, MODEL_SUFFIX)
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/README.md b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/README.md
index 151fb2f1a505..89dd72d00f78 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/README.md
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/README.md
@@ -73,13 +73,13 @@ export class AppModule {}
```
// configuring providers
-import { ApiModule, Configuration, ConfigurationParameters } from '@openapitools/typescript-angular-petstore';
+import { ApiModule, PetStoreConfiguration, PetStoreConfigurationParameters } from '@openapitools/typescript-angular-petstore';
-export function apiConfigFactory (): Configuration => {
- const params: ConfigurationParameters = {
+export function apiConfigFactory (): PetStoreConfiguration => {
+ const params: PetStoreConfigurationParameters = {
// set configuration parameters here.
}
- return new Configuration(params);
+ return new PetStoreConfiguration(params);
}
@NgModule({
@@ -93,15 +93,15 @@ export class AppModule {}
```
// configuring providers with an authentication service that manages your access tokens
-import { ApiModule, Configuration } from '@openapitools/typescript-angular-petstore';
+import { ApiModule, PetStoreConfiguration } from '@openapitools/typescript-angular-petstore';
@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
- provide: Configuration,
- useFactory: (authService: AuthService) => new Configuration(
+ provide: PetStoreConfiguration,
+ useFactory: (authService: AuthService) => new PetStoreConfiguration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api.module.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api.module.ts
index 61312d8cab77..3ef34151107c 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api.module.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api.module.ts
@@ -1,5 +1,5 @@
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
-import { Configuration } from './configuration';
+import { PetStoreConfiguration } from './configuration';
import { HttpClient } from '@angular/common/http';
import { PetService } from './api/pet.service';
@@ -13,10 +13,10 @@ import { UserService } from './api/user.service';
providers: []
})
export class PetStoreApiModule {
- public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders {
+ public static forRoot(configurationFactory: () => PetStoreConfiguration): ModuleWithProviders {
return {
ngModule: PetStoreApiModule,
- providers: [ { provide: Configuration, useFactory: configurationFactory } ]
+ providers: [ { provide: PetStoreConfiguration, useFactory: configurationFactory } ]
};
}
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts
index 46fef0be89fe..0975398771b9 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts
@@ -21,7 +21,7 @@ import { ApiResponse } from '../model/models';
import { Pet } from '../model/models';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
-import { Configuration } from '../configuration';
+import { PetStoreConfiguration } from '../configuration';
@@ -32,10 +32,10 @@ export class PetService {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders = new HttpHeaders();
- public configuration = new Configuration();
+ public configuration = new PetStoreConfiguration();
public encoder: HttpParameterCodec;
- constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
+ constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: PetStoreConfiguration) {
if (configuration) {
this.configuration = configuration;
}
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts
index d5d08ab3adc3..1ca9d2fc346f 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts
@@ -20,7 +20,7 @@ import { Observable } from 'rxjs';
import { Order } from '../model/models';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
-import { Configuration } from '../configuration';
+import { PetStoreConfiguration } from '../configuration';
@@ -31,10 +31,10 @@ export class StoreService {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders = new HttpHeaders();
- public configuration = new Configuration();
+ public configuration = new PetStoreConfiguration();
public encoder: HttpParameterCodec;
- constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
+ constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: PetStoreConfiguration) {
if (configuration) {
this.configuration = configuration;
}
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts
index 399676219054..a79076289582 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts
@@ -20,7 +20,7 @@ import { Observable } from 'rxjs';
import { User } from '../model/models';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
-import { Configuration } from '../configuration';
+import { PetStoreConfiguration } from '../configuration';
@@ -31,10 +31,10 @@ export class UserService {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders = new HttpHeaders();
- public configuration = new Configuration();
+ public configuration = new PetStoreConfiguration();
public encoder: HttpParameterCodec;
- constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
+ constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: PetStoreConfiguration) {
if (configuration) {
this.configuration = configuration;
}
diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/configuration.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/configuration.ts
index 38126642420d..1bd306a523eb 100644
--- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/configuration.ts
+++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/configuration.ts
@@ -1,6 +1,6 @@
import { HttpParameterCodec } from '@angular/common/http';
-export interface ConfigurationParameters {
+export interface PetStoreConfigurationParameters {
/**
* @deprecated Since 5.0. Use credentials instead
*/
@@ -22,7 +22,7 @@ export interface ConfigurationParameters {
credentials?: {[ key: string ]: string | (() => string | undefined)};
}
-export class Configuration {
+export class PetStoreConfiguration {
/**
* @deprecated Since 5.0. Use credentials instead
*/
@@ -43,7 +43,7 @@ export class Configuration {
*/
credentials: {[ key: string ]: string | (() => string | undefined)};
- constructor(configurationParameters: ConfigurationParameters = {}) {
+ constructor(configurationParameters: PetStoreConfigurationParameters = {}) {
this.apiKeys = configurationParameters.apiKeys;
this.username = configurationParameters.username;
this.password = configurationParameters.password;
@@ -77,7 +77,7 @@ export class Configuration {
/**
* Select the correct content-type to use for a request.
- * Uses {@link Configuration#isJsonMime} to determine the correct content-type.
+ * Uses {@link PetStoreConfiguration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param contentTypes - the array of content types that are available for selection
* @returns the selected content-type or undefined if no selection could be made.
@@ -96,7 +96,7 @@ export class Configuration {
/**
* Select the correct accept content-type to use for a request.
- * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
+ * Uses {@link PetStoreConfiguration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param accepts - the array of content types that are available for selection.
* @returns the selected content-type or undefined if no selection could be made.