From 18bb5466bb3c32f873337a8bc9f2fe6687490cb4 Mon Sep 17 00:00:00 2001 From: Nikos Epping Date: Thu, 18 Aug 2022 20:23:51 +0200 Subject: [PATCH] [typescript-axios] Ignore unused imports when using 'withSeparateModelsAndApi' (#13204) * Add typescript-axios/with-separate-models-and-api-inheritance sample as test for #13203 * [typescript-axios] Add // @ts-ignore to imports in models if withSeparateModelsAndApi is set * [typescript-axios] Update samples --- ...h-separate-models-and-api-inheritance.yaml | 8 + .../resources/typescript-axios/model.mustache | 6 + ...h-separate-models-and-api-inheritance.yaml | 35 +++++ .../.gitignore | 4 + .../.npmignore | 1 + .../.openapi-generator-ignore | 23 +++ .../.openapi-generator/FILES | 13 ++ .../.openapi-generator/VERSION | 1 + .../api.ts | 17 ++ .../base.ts | 71 +++++++++ .../common.ts | 148 ++++++++++++++++++ .../configuration.ts | 101 ++++++++++++ .../git_push.sh | 57 +++++++ .../index.ts | 18 +++ .../model/abstract-user-dto.ts | 45 ++++++ .../model/branch-dto.ts | 30 ++++ .../model/index.ts | 4 + .../model/internal-authenticated-user-dto.ts | 29 ++++ .../model/remote-authenticated-user-dto.ts | 29 ++++ .../model/some/levels/deep/pet.ts | 4 + 20 files changed, 644 insertions(+) create mode 100644 bin/configs/typescript-axios-with-separate-models-and-api-inheritance.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_0/typescript-axios/with-separate-models-and-api-inheritance.yaml create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.gitignore create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.npmignore create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator-ignore create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator/FILES create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator/VERSION create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/api.ts create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/base.ts create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/common.ts create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/configuration.ts create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/git_push.sh create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/index.ts create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/abstract-user-dto.ts create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/branch-dto.ts create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/index.ts create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/internal-authenticated-user-dto.ts create mode 100644 samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/remote-authenticated-user-dto.ts diff --git a/bin/configs/typescript-axios-with-separate-models-and-api-inheritance.yaml b/bin/configs/typescript-axios-with-separate-models-and-api-inheritance.yaml new file mode 100644 index 00000000000..155f7f435ff --- /dev/null +++ b/bin/configs/typescript-axios-with-separate-models-and-api-inheritance.yaml @@ -0,0 +1,8 @@ +generatorName: typescript-axios +outputDir: samples/client/others/typescript-axios/with-separate-models-and-api-inheritance +inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript-axios/with-separate-models-and-api-inheritance.yaml +templateDir: modules/openapi-generator/src/main/resources/typescript-axios +additionalProperties: + apiPackage: api + modelPackage: model + withSeparateModelsAndApi: true diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/model.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/model.mustache index 46838a8a08e..9e1e84422bc 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/model.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/model.mustache @@ -2,8 +2,14 @@ /* eslint-disable */ {{>licenseInfo}} {{#withSeparateModelsAndApi}}{{#hasAllOf}}{{#allOf}} +// May contain unused imports in some cases +// @ts-ignore import { {{class}} } from './{{filename}}';{{/allOf}}{{/hasAllOf}}{{#hasOneOf}}{{#oneOf}} +// May contain unused imports in some cases +// @ts-ignore import { {{class}} } from './{{filename}}';{{/oneOf}}{{/hasOneOf}}{{^hasAllOf}}{{^hasOneOf}}{{#imports}} +// May contain unused imports in some cases +// @ts-ignore import { {{class}} } from './{{filename}}';{{/imports}}{{/hasOneOf}}{{/hasAllOf}}{{/withSeparateModelsAndApi}} {{#models}}{{#model}} {{#isEnum}}{{>modelEnum}}{{/isEnum}}{{#oneOf}}{{#-first}}{{>modelOneOf}}{{/-first}}{{/oneOf}}{{#allOf}}{{#-first}}{{>modelAllOf}}{{/-first}}{{/allOf}}{{^isEnum}}{{^oneOf}}{{^allOf}}{{>modelGeneric}}{{/allOf}}{{/oneOf}}{{/isEnum}} diff --git a/modules/openapi-generator/src/test/resources/3_0/typescript-axios/with-separate-models-and-api-inheritance.yaml b/modules/openapi-generator/src/test/resources/3_0/typescript-axios/with-separate-models-and-api-inheritance.yaml new file mode 100644 index 00000000000..d784ef25ba5 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/typescript-axios/with-separate-models-and-api-inheritance.yaml @@ -0,0 +1,35 @@ +--- +openapi: 3.0.1 +info: + title: Example + version: '1' +paths: {} +components: + schemas: + BranchDto: + type: object + properties: + name: + type: string + AbstractUserDto: + type: object + properties: + username: + type: string + branch: + "$ref": "#/components/schemas/BranchDto" + type: + type: string + discriminator: + propertyName: type + mapping: + internal-authenticated: "#/components/schemas/InternalAuthenticatedUserDto" + remote-authenticated: "#/components/schemas/RemoteAuthenticatedUserDto" + InternalAuthenticatedUserDto: + type: object + allOf: + - "$ref": "#/components/schemas/AbstractUserDto" + RemoteAuthenticatedUserDto: + type: object + allOf: + - "$ref": "#/components/schemas/AbstractUserDto" diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.gitignore b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.gitignore new file mode 100644 index 00000000000..149b5765472 --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.npmignore b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.npmignore new file mode 100644 index 00000000000..999d88df693 --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.npmignore @@ -0,0 +1 @@ +# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator-ignore b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator/FILES b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator/FILES new file mode 100644 index 00000000000..54773e481d6 --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator/FILES @@ -0,0 +1,13 @@ +.gitignore +.npmignore +api.ts +base.ts +common.ts +configuration.ts +git_push.sh +index.ts +model/abstract-user-dto.ts +model/branch-dto.ts +model/index.ts +model/internal-authenticated-user-dto.ts +model/remote-authenticated-user-dto.ts diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator/VERSION b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator/VERSION new file mode 100644 index 00000000000..66672d4e9d3 --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/api.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/api.ts new file mode 100644 index 00000000000..76a72f3a74a --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/api.ts @@ -0,0 +1,17 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + + diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/base.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/base.ts new file mode 100644 index 00000000000..9046b16626b --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/base.ts @@ -0,0 +1,71 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +// Some imports not used depending on template conditions +// @ts-ignore +import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; + +export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: AxiosRequestConfig; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/common.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/common.ts new file mode 100644 index 00000000000..76b5d765008 --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/common.ts @@ -0,0 +1,148 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance, AxiosResponse } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + setFlattenedQueryParams(searchParams, objects); + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/configuration.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/configuration.ts new file mode 100644 index 00000000000..51125503002 --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/git_push.sh b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/git_push.sh new file mode 100644 index 00000000000..f53a75d4fab --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/index.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/index.ts new file mode 100644 index 00000000000..09f94830a1f --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; +export * from "./model"; diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/abstract-user-dto.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/abstract-user-dto.ts new file mode 100644 index 00000000000..765c4258833 --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/abstract-user-dto.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { BranchDto } from './branch-dto'; + +/** + * + * @export + * @interface AbstractUserDto + */ +export interface AbstractUserDto { + /** + * + * @type {string} + * @memberof AbstractUserDto + */ + 'username'?: string; + /** + * + * @type {BranchDto} + * @memberof AbstractUserDto + */ + 'branch'?: BranchDto; + /** + * + * @type {string} + * @memberof AbstractUserDto + */ + 'type'?: string; +} + diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/branch-dto.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/branch-dto.ts new file mode 100644 index 00000000000..4c6d31ceb24 --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/branch-dto.ts @@ -0,0 +1,30 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface BranchDto + */ +export interface BranchDto { + /** + * + * @type {string} + * @memberof BranchDto + */ + 'name'?: string; +} + diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/index.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/index.ts new file mode 100644 index 00000000000..f92a1d9cadf --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/index.ts @@ -0,0 +1,4 @@ +export * from './abstract-user-dto'; +export * from './branch-dto'; +export * from './internal-authenticated-user-dto'; +export * from './remote-authenticated-user-dto'; diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/internal-authenticated-user-dto.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/internal-authenticated-user-dto.ts new file mode 100644 index 00000000000..790458e5390 --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/internal-authenticated-user-dto.ts @@ -0,0 +1,29 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { AbstractUserDto } from './abstract-user-dto'; +// May contain unused imports in some cases +// @ts-ignore +import { BranchDto } from './branch-dto'; + +/** + * @type InternalAuthenticatedUserDto + * @export + */ +export type InternalAuthenticatedUserDto = AbstractUserDto; + + diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/remote-authenticated-user-dto.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/remote-authenticated-user-dto.ts new file mode 100644 index 00000000000..b8071de4421 --- /dev/null +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/model/remote-authenticated-user-dto.ts @@ -0,0 +1,29 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Example + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import { AbstractUserDto } from './abstract-user-dto'; +// May contain unused imports in some cases +// @ts-ignore +import { BranchDto } from './branch-dto'; + +/** + * @type RemoteAuthenticatedUserDto + * @export + */ +export type RemoteAuthenticatedUserDto = AbstractUserDto; + + diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/model/some/levels/deep/pet.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/model/some/levels/deep/pet.ts index e32493df735..bb1cab2e56d 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/model/some/levels/deep/pet.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/model/some/levels/deep/pet.ts @@ -13,7 +13,11 @@ */ +// May contain unused imports in some cases +// @ts-ignore import { Category } from './category'; +// May contain unused imports in some cases +// @ts-ignore import { Tag } from './tag'; /**