From 98cd9bd80399c2ce235f4b087e005741fe07bdf3 Mon Sep 17 00:00:00 2001 From: Cameron Koegel <53310569+ckoegel@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:01:59 -0500 Subject: [PATCH 1/7] [typescript-axios] Respect User Supplied Header Params (#20040) --- CI/circle_parallel.sh | 1 + ...typescript-axios-with-complex-headers.yaml | 5 + .../typescript-axios/apiInner.mustache | 57 +- .../3_0/petstore-with-complex-headers.yaml | 7 + .../echo_api/typescript-axios/build/api.ts | 9 +- .../typescript-axios/builds/default/api.ts | 5 +- .../typescript-axios/builds/es6-target/api.ts | 5 +- .../builds/test-petstore/api.ts | 27 +- .../.openapi-generator/FILES | 3 + .../builds/with-complex-headers/README.md | 46 + .../builds/with-complex-headers/api.ts | 37 +- .../with-complex-headers/package-lock.json | 116 + .../builds/with-complex-headers/package.json | 34 + .../builds/with-complex-headers/tsconfig.json | 21 + .../api.ts | 32 +- .../api.ts | 5 +- .../builds/with-interfaces/api.ts | 5 +- .../builds/with-node-imports/api.ts | 5 +- .../api/another/level/pet-api.ts | 5 +- .../builds/with-npm-version/api.ts | 5 +- .../with-single-request-parameters/api.ts | 5 +- .../builds/with-string-enums/api.ts | 5 +- .../with-complex-headers/package-lock.json | 2821 +++++++++++++++++ .../tests/with-complex-headers/package.json | 31 + .../tests/with-complex-headers/pom.xml | 59 + .../tests/with-complex-headers/test/PetApi.ts | 112 + .../tests/with-complex-headers/test/index.ts | 1 + .../tests/with-complex-headers/tsconfig.json | 21 + 28 files changed, 3370 insertions(+), 115 deletions(-) create mode 100644 samples/client/petstore/typescript-axios/builds/with-complex-headers/README.md create mode 100644 samples/client/petstore/typescript-axios/builds/with-complex-headers/package-lock.json create mode 100644 samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json create mode 100644 samples/client/petstore/typescript-axios/builds/with-complex-headers/tsconfig.json create mode 100644 samples/client/petstore/typescript-axios/tests/with-complex-headers/package-lock.json create mode 100644 samples/client/petstore/typescript-axios/tests/with-complex-headers/package.json create mode 100644 samples/client/petstore/typescript-axios/tests/with-complex-headers/pom.xml create mode 100644 samples/client/petstore/typescript-axios/tests/with-complex-headers/test/PetApi.ts create mode 100644 samples/client/petstore/typescript-axios/tests/with-complex-headers/test/index.ts create mode 100644 samples/client/petstore/typescript-axios/tests/with-complex-headers/tsconfig.json diff --git a/CI/circle_parallel.sh b/CI/circle_parallel.sh index 5c0c586e181c..3941f7724664 100755 --- a/CI/circle_parallel.sh +++ b/CI/circle_parallel.sh @@ -100,6 +100,7 @@ elif [ "$NODE_INDEX" = "3" ]; then (cd samples/client/petstore/typescript-rxjs/builds/with-npm-version && mvn integration-test) (cd samples/client/petstore/typescript-axios/builds/with-npm-version && mvn integration-test) (cd samples/client/petstore/typescript-axios/tests/default && mvn integration-test) + (cd samples/client/petstore/typescript-axios/tests/with-complex-headers && mvn integration-test) (cd samples/client/petstore/javascript-flowtyped && mvn integration-test) (cd samples/client/petstore/javascript-es6 && mvn integration-test) (cd samples/client/petstore/javascript-promise-es6 && mvn integration-test) diff --git a/bin/configs/typescript-axios-with-complex-headers.yaml b/bin/configs/typescript-axios-with-complex-headers.yaml index e4eeee792ad0..8308bb20f91c 100644 --- a/bin/configs/typescript-axios-with-complex-headers.yaml +++ b/bin/configs/typescript-axios-with-complex-headers.yaml @@ -2,3 +2,8 @@ generatorName: typescript-axios outputDir: samples/client/petstore/typescript-axios/builds/with-complex-headers inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-complex-headers.yaml templateDir: modules/openapi-generator/src/main/resources/typescript-axios +additionalProperties: + npmVersion: 1.0.0 + npmName: '@openapitools/typescript-axios-petstore' + npmRepository: https://skimdb.npmjs.com/registry + snapshot: false diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache index 0ccf40c11615..48aadcbde192 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache @@ -156,34 +156,6 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur {{/isArray}} {{/queryParams}} - {{#headerParams}} - {{#isArray}} - if ({{paramName}}) { - {{#uniqueItems}} - let mapped = Array.from({{paramName}}).map(value => ("{{{dataType}}}" !== "Set") ? JSON.stringify(value) : (value || "")); - {{/uniqueItems}} - {{^uniqueItems}} - let mapped = {{paramName}}.map(value => ("{{{dataType}}}" !== "Array") ? JSON.stringify(value) : (value || "")); - {{/uniqueItems}} - localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]); - } - {{/isArray}} - {{^isArray}} - {{! `val == null` covers for both `null` and `undefined`}} - if ({{paramName}} != null) { - {{#isString}} - localVarHeaderParameter['{{baseName}}'] = String({{paramName}}); - {{/isString}} - {{^isString}} - {{! isString is falsy also for $ref that defines a string or enum type}} - localVarHeaderParameter['{{baseName}}'] = typeof {{paramName}} === 'string' - ? {{paramName}} - : JSON.stringify({{paramName}}); - {{/isString}} - } - {{/isArray}} - - {{/headerParams}} {{#vendorExtensions}} {{#formParams}} {{#isArray}} @@ -224,6 +196,33 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur {{/consumes.0}} {{/bodyParam}} + {{#headerParams}} + {{#isArray}} + if ({{paramName}}) { + {{#uniqueItems}} + let mapped = Array.from({{paramName}}).map(value => ("{{{dataType}}}" !== "Set") ? JSON.stringify(value) : (value || "")); + {{/uniqueItems}} + {{^uniqueItems}} + let mapped = {{paramName}}.map(value => ("{{{dataType}}}" !== "Array") ? JSON.stringify(value) : (value || "")); + {{/uniqueItems}} + localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]); + } + {{/isArray}} + {{^isArray}} + {{! `val == null` covers for both `null` and `undefined`}} + if ({{paramName}} != null) { + {{#isString}} + localVarHeaderParameter['{{baseName}}'] = String({{paramName}}); + {{/isString}} + {{^isString}} + {{! isString is falsy also for $ref that defines a string or enum type}} + localVarHeaderParameter['{{baseName}}'] = typeof {{paramName}} === 'string' + ? {{paramName}} + : JSON.stringify({{paramName}}); + {{/isString}} + } + {{/isArray}} + {{/headerParams}} setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions,{{#hasFormParams}}{{#multipartFormData}} ...(localVarFormParams as any).getHeaders?.(),{{/multipartFormData}}{{/hasFormParams}} ...options.headers}; @@ -465,4 +464,4 @@ export type {{operationIdCamelCase}}{{enumName}} = typeof {{operationIdCamelCase {{/isEnum}} {{/allParams}} {{/operation}} -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-complex-headers.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-complex-headers.yaml index 2b8d0a7f5f83..71d5ff0511ea 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-complex-headers.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-complex-headers.yaml @@ -257,6 +257,13 @@ paths: schema: type: integer format: int64 + - name: Content-Type + in: header + style: simple + description: Content type header parameter + required: false + schema: + type: string responses: '200': description: successful operation diff --git a/samples/client/echo_api/typescript-axios/build/api.ts b/samples/client/echo_api/typescript-axios/build/api.ts index ffe05310d2dd..b3e78cb928fd 100644 --- a/samples/client/echo_api/typescript-axios/build/api.ts +++ b/samples/client/echo_api/typescript-axios/build/api.ts @@ -1605,34 +1605,29 @@ export const HeaderApiAxiosParamCreator = function (configuration?: Configuratio const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + + if (integerHeader != null) { localVarHeaderParameter['integer_header'] = typeof integerHeader === 'string' ? integerHeader : JSON.stringify(integerHeader); } - if (booleanHeader != null) { localVarHeaderParameter['boolean_header'] = typeof booleanHeader === 'string' ? booleanHeader : JSON.stringify(booleanHeader); } - if (stringHeader != null) { localVarHeaderParameter['string_header'] = String(stringHeader); } - if (enumNonrefStringHeader != null) { localVarHeaderParameter['enum_nonref_string_header'] = String(enumNonrefStringHeader); } - if (enumRefStringHeader != null) { localVarHeaderParameter['enum_ref_string_header'] = typeof enumRefStringHeader === 'string' ? enumRefStringHeader : JSON.stringify(enumRefStringHeader); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/builds/default/api.ts b/samples/client/petstore/typescript-axios/builds/default/api.ts index df0c45abc78d..a8605bb76b54 100644 --- a/samples/client/petstore/typescript-axios/builds/default/api.ts +++ b/samples/client/petstore/typescript-axios/builds/default/api.ts @@ -320,12 +320,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/api.ts b/samples/client/petstore/typescript-axios/builds/es6-target/api.ts index df0c45abc78d..a8605bb76b54 100644 --- a/samples/client/petstore/typescript-axios/builds/es6-target/api.ts +++ b/samples/client/petstore/typescript-axios/builds/es6-target/api.ts @@ -320,12 +320,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts index 4fdd6c8e213a..6e6e7852cf0e 100644 --- a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts +++ b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts @@ -2484,15 +2484,6 @@ export const FakeApiAxiosParamCreator = function (configuration?: Configuration) localVarQueryParameter['enum_query_double'] = enumQueryDouble; } - if (enumHeaderStringArray) { - let mapped = enumHeaderStringArray.map(value => ("Array<'>' | '$'>" !== "Array") ? JSON.stringify(value) : (value || "")); - localVarHeaderParameter['enum_header_string_array'] = mapped.join(COLLECTION_FORMATS["csv"]); - } - - if (enumHeaderString != null) { - localVarHeaderParameter['enum_header_string'] = String(enumHeaderString); - } - if (enumFormStringArray) { localVarFormParams.set('enum_form_string_array', enumFormStringArray.join(COLLECTION_FORMATS.csv)); } @@ -2505,6 +2496,13 @@ export const FakeApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + if (enumHeaderStringArray) { + let mapped = enumHeaderStringArray.map(value => ("Array<'>' | '$'>" !== "Array") ? JSON.stringify(value) : (value || "")); + localVarHeaderParameter['enum_header_string_array'] = mapped.join(COLLECTION_FORMATS["csv"]); + } + if (enumHeaderString != null) { + localVarHeaderParameter['enum_header_string'] = String(enumHeaderString); + } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -2566,20 +2564,18 @@ export const FakeApiAxiosParamCreator = function (configuration?: Configuration) localVarQueryParameter['int64_group'] = int64Group; } + + if (requiredBooleanGroup != null) { localVarHeaderParameter['required_boolean_group'] = typeof requiredBooleanGroup === 'string' ? requiredBooleanGroup : JSON.stringify(requiredBooleanGroup); } - if (booleanGroup != null) { localVarHeaderParameter['boolean_group'] = typeof booleanGroup === 'string' ? booleanGroup : JSON.stringify(booleanGroup); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -3829,12 +3825,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/with-complex-headers/.openapi-generator/FILES index a80cd4f07b06..534fae710fba 100644 --- a/samples/client/petstore/typescript-axios/builds/with-complex-headers/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/.openapi-generator/FILES @@ -1,8 +1,11 @@ .gitignore .npmignore +README.md api.ts base.ts common.ts configuration.ts git_push.sh index.ts +package.json +tsconfig.json diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/README.md b/samples/client/petstore/typescript-axios/builds/with-complex-headers/README.md new file mode 100644 index 000000000000..856ac0a1ef56 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/README.md @@ -0,0 +1,46 @@ +## @openapitools/typescript-axios-petstore@1.0.0 + +This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments: + +Environment +* Node.js +* Webpack +* Browserify + +Language level +* ES5 - you must have a Promises/A+ library installed +* ES6 + +Module system +* CommonJS +* ES6 module system + +It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html)) + +### Building + +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### Publishing + +First build the package then run `npm publish` + +### Consuming + +navigate to the folder of your consuming project and run one of the following commands. + +_published:_ + +``` +npm install @openapitools/typescript-axios-petstore@1.0.0 --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save +``` diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts b/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts index a373dc21fe56..d7728f692e7c 100644 --- a/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts @@ -295,27 +295,24 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + if (header1 != null) { localVarHeaderParameter['header1'] = typeof header1 === 'string' ? header1 : JSON.stringify(header1); } - if (header2) { let mapped = header2.map(value => ("Array" !== "Array") ? JSON.stringify(value) : (value || "")); localVarHeaderParameter['header2'] = mapped.join(COLLECTION_FORMATS["csv"]); } - if (accept != null) { localVarHeaderParameter['Accept'] = typeof accept === 'string' ? accept : JSON.stringify(accept); } - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -354,12 +351,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -585,12 +581,13 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) * * @summary uploads an image * @param {number} petId ID of pet to update + * @param {string} [contentType] Content type header parameter * @param {string} [additionalMetadata] Additional data to pass to server * @param {File} [file] file to upload * @param {*} [options] Override http request option. * @throws {RequiredError} */ - uploadFile: async (petId: number, additionalMetadata?: string, file?: File, options: RawAxiosRequestConfig = {}): Promise => { + uploadFile: async (petId: number, contentType?: string, additionalMetadata?: string, file?: File, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'petId' is not null or undefined assertParamExists('uploadFile', 'petId', petId) const localVarPath = `/pet/{petId}/uploadImage` @@ -623,6 +620,9 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; + if (contentType != null) { + localVarHeaderParameter['Content-Type'] = String(contentType); + } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -745,13 +745,14 @@ export const PetApiFp = function(configuration?: Configuration) { * * @summary uploads an image * @param {number} petId ID of pet to update + * @param {string} [contentType] Content type header parameter * @param {string} [additionalMetadata] Additional data to pass to server * @param {File} [file] file to upload * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async uploadFile(petId: number, additionalMetadata?: string, file?: File, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, additionalMetadata, file, options); + async uploadFile(petId: number, contentType?: string, additionalMetadata?: string, file?: File, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, contentType, additionalMetadata, file, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['PetApi.uploadFile']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); @@ -847,13 +848,14 @@ export const PetApiFactory = function (configuration?: Configuration, basePath?: * * @summary uploads an image * @param {number} petId ID of pet to update + * @param {string} [contentType] Content type header parameter * @param {string} [additionalMetadata] Additional data to pass to server * @param {File} [file] file to upload * @param {*} [options] Override http request option. * @throws {RequiredError} */ - uploadFile(petId: number, additionalMetadata?: string, file?: File, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); + uploadFile(petId: number, contentType?: string, additionalMetadata?: string, file?: File, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.uploadFile(petId, contentType, additionalMetadata, file, options).then((request) => request(axios, basePath)); }, }; }; @@ -960,14 +962,15 @@ export class PetApi extends BaseAPI { * * @summary uploads an image * @param {number} petId ID of pet to update + * @param {string} [contentType] Content type header parameter * @param {string} [additionalMetadata] Additional data to pass to server * @param {File} [file] file to upload * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PetApi */ - public uploadFile(petId: number, additionalMetadata?: string, file?: File, options?: RawAxiosRequestConfig) { - return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options).then((request) => request(this.axios, this.basePath)); + public uploadFile(petId: number, contentType?: string, additionalMetadata?: string, file?: File, options?: RawAxiosRequestConfig) { + return PetApiFp(this.configuration).uploadFile(petId, contentType, additionalMetadata, file, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/package-lock.json b/samples/client/petstore/typescript-axios/builds/with-complex-headers/package-lock.json new file mode 100644 index 000000000000..b64668a5c51d --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/package-lock.json @@ -0,0 +1,116 @@ +{ + "name": "with-complex-headers", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@types/node": { + "version": "12.20.42", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.42.tgz", + "integrity": "sha512-aI3/oo5DzyiI5R/xAhxxRzfZlWlsbbqdgxfTPkqu/Zt+23GXiJvMCyPJT4+xKSXOnLqoL8jJYMLTwvK2M3a5hw==", + "dev": true + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.7.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/typescript": { + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + } +} diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json b/samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json new file mode 100644 index 000000000000..aa938d8bf659 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/package.json @@ -0,0 +1,34 @@ +{ + "name": "@openapitools/typescript-axios-petstore", + "version": "1.0.0", + "description": "OpenAPI client for @openapitools/typescript-axios-petstore", + "author": "OpenAPI-Generator Contributors", + "repository": { + "type": "git", + "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" + }, + "keywords": [ + "axios", + "typescript", + "openapi-client", + "openapi-generator", + "@openapitools/typescript-axios-petstore" + ], + "license": "Unlicense", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts": { + "build": "tsc", + "prepare": "npm run build" + }, + "dependencies": { + "axios": "^1.6.1" + }, + "devDependencies": { + "@types/node": "12.11.5 - 12.20.42", + "typescript": "^4.0 || ^5.0" + }, + "publishConfig": { + "registry": "https://skimdb.npmjs.com/registry" + } +} diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/tsconfig.json b/samples/client/petstore/typescript-axios/builds/with-complex-headers/tsconfig.json new file mode 100644 index 000000000000..d953a374d812 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "declaration": true, + "target": "ES5", + "module": "commonjs", + "noImplicitAny": true, + "outDir": "dist", + "rootDir": ".", + "lib": [ + "es6", + "dom" + ], + "typeRoots": [ + "node_modules/@types" + ] + }, + "exclude": [ + "dist", + "node_modules" + ] +} diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts index 23003c216833..a2e245084ac7 100644 --- a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts @@ -2034,15 +2034,6 @@ export const FakeApiAxiosParamCreator = function (configuration?: Configuration) localVarQueryParameter['enum_query_double'] = enumQueryDouble; } - if (enumHeaderStringArray) { - let mapped = enumHeaderStringArray.map(value => ("Array<'>' | '$'>" !== "Array") ? JSON.stringify(value) : (value || "")); - localVarHeaderParameter['enum_header_string_array'] = mapped.join(COLLECTION_FORMATS["csv"]); - } - - if (enumHeaderString != null) { - localVarHeaderParameter['enum_header_string'] = String(enumHeaderString); - } - if (enumFormStringArray) { localVarFormParams.set('enum_form_string_array', enumFormStringArray.join(COLLECTION_FORMATS.csv)); } @@ -2055,6 +2046,13 @@ export const FakeApiAxiosParamCreator = function (configuration?: Configuration) localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + if (enumHeaderStringArray) { + let mapped = enumHeaderStringArray.map(value => ("Array<'>' | '$'>" !== "Array") ? JSON.stringify(value) : (value || "")); + localVarHeaderParameter['enum_header_string_array'] = mapped.join(COLLECTION_FORMATS["csv"]); + } + if (enumHeaderString != null) { + localVarHeaderParameter['enum_header_string'] = String(enumHeaderString); + } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -2116,20 +2114,18 @@ export const FakeApiAxiosParamCreator = function (configuration?: Configuration) localVarQueryParameter['int64_group'] = int64Group; } + + if (requiredBooleanGroup != null) { localVarHeaderParameter['required_boolean_group'] = typeof requiredBooleanGroup === 'string' ? requiredBooleanGroup : JSON.stringify(requiredBooleanGroup); } - if (booleanGroup != null) { localVarHeaderParameter['boolean_group'] = typeof booleanGroup === 'string' ? booleanGroup : JSON.stringify(booleanGroup); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -2387,13 +2383,12 @@ export const FakeApiAxiosParamCreator = function (configuration?: Configuration) localVarQueryParameter['queryUnique'] = Array.from(queryUnique); } + + if (headerUnique) { let mapped = Array.from(headerUnique).map(value => ("Set" !== "Set") ? JSON.stringify(value) : (value || "")); localVarHeaderParameter['headerUnique'] = mapped.join(COLLECTION_FORMATS["csv"]); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -3391,12 +3386,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces-and-with-single-request-param/api.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces-and-with-single-request-param/api.ts index d471c3665d84..3866dac8281f 100644 --- a/samples/client/petstore/typescript-axios/builds/with-interfaces-and-with-single-request-param/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces-and-with-single-request-param/api.ts @@ -320,12 +320,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts index e3035a1de518..f420a14d982f 100644 --- a/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts @@ -320,12 +320,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/builds/with-node-imports/api.ts b/samples/client/petstore/typescript-axios/builds/with-node-imports/api.ts index 8f972c32b2e4..1e960d666b57 100644 --- a/samples/client/petstore/typescript-axios/builds/with-node-imports/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-node-imports/api.ts @@ -324,12 +324,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts index 4814af94ce40..7d1587e114d9 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts @@ -99,12 +99,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts index df0c45abc78d..a8605bb76b54 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts @@ -320,12 +320,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts index 8b6af8686545..d2c2e92a5de9 100644 --- a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts @@ -320,12 +320,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/builds/with-string-enums/api.ts b/samples/client/petstore/typescript-axios/builds/with-string-enums/api.ts index b9f8757a661c..ef7d47558d90 100644 --- a/samples/client/petstore/typescript-axios/builds/with-string-enums/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-string-enums/api.ts @@ -324,12 +324,11 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey != null) { localVarHeaderParameter['api_key'] = String(apiKey); } - - - setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; diff --git a/samples/client/petstore/typescript-axios/tests/with-complex-headers/package-lock.json b/samples/client/petstore/typescript-axios/tests/with-complex-headers/package-lock.json new file mode 100644 index 000000000000..d3169825fc0b --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/with-complex-headers/package-lock.json @@ -0,0 +1,2821 @@ +{ + "name": "typescript-axios-test-with-complex-headers", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "typescript-axios-test-with-complex-headers", + "version": "1.0.0", + "hasInstallScript": true, + "license": "ISC", + "dependencies": { + "@openapitools/typescript-axios-petstore": "file:../../builds/with-complex-headers" + }, + "devDependencies": { + "@types/chai": "^4.2.14", + "@types/mocha": "^8.2.0", + "@types/node": "^14.14.14", + "axios": "*", + "browserify": "^17.0.0", + "chai": "^4.2.0", + "mocha": "^8.2.1", + "ts-node": "^9.1.1", + "typescript": "^4.1.2" + } + }, + "../../builds/with-complex-headers": {}, + "node_modules/@openapitools/typescript-axios-petstore": { + "resolved": "../../builds/with-complex-headers", + "link": true + }, + "node_modules/@types/chai": { + "version": "4.3.20", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/mocha": { + "version": "8.2.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "14.18.63", + "dev": true, + "license": "MIT" + }, + "node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "dev": true, + "license": "ISC" + }, + "node_modules/acorn": { + "version": "7.4.1", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-node": { + "version": "1.8.2", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "acorn": "^7.0.0", + "acorn-walk": "^7.0.0", + "xtend": "^4.0.2" + } + }, + "node_modules/acorn-walk": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/argparse": { + "version": "2.0.1", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/asn1.js": { + "version": "4.10.1", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/asn1.js/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/assert": { + "version": "1.5.1", + "dev": true, + "license": "MIT", + "dependencies": { + "object.assign": "^4.1.4", + "util": "^0.10.4" + } + }, + "node_modules/assert/node_modules/inherits": { + "version": "2.0.3", + "dev": true, + "license": "ISC" + }, + "node_modules/assert/node_modules/util": { + "version": "0.10.4", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "2.0.3" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "dev": true, + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axios": { + "version": "1.7.7", + "dev": true, + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bn.js": { + "version": "5.2.1", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/browser-pack": { + "version": "6.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "combine-source-map": "~0.8.0", + "defined": "^1.0.0", + "JSONStream": "^1.0.3", + "safe-buffer": "^5.1.1", + "through2": "^2.0.0", + "umd": "^3.0.0" + }, + "bin": { + "browser-pack": "bin/cmd.js" + } + }, + "node_modules/browser-resolve": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve": "^1.17.0" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "dev": true, + "license": "ISC" + }, + "node_modules/browserify": { + "version": "17.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "assert": "^1.4.0", + "browser-pack": "^6.0.1", + "browser-resolve": "^2.0.0", + "browserify-zlib": "~0.2.0", + "buffer": "~5.2.1", + "cached-path-relative": "^1.0.0", + "concat-stream": "^1.6.0", + "console-browserify": "^1.1.0", + "constants-browserify": "~1.0.0", + "crypto-browserify": "^3.0.0", + "defined": "^1.0.0", + "deps-sort": "^2.0.1", + "domain-browser": "^1.2.0", + "duplexer2": "~0.1.2", + "events": "^3.0.0", + "glob": "^7.1.0", + "hasown": "^2.0.0", + "htmlescape": "^1.1.0", + "https-browserify": "^1.0.0", + "inherits": "~2.0.1", + "insert-module-globals": "^7.2.1", + "JSONStream": "^1.0.3", + "labeled-stream-splicer": "^2.0.0", + "mkdirp-classic": "^0.5.2", + "module-deps": "^6.2.3", + "os-browserify": "~0.3.0", + "parents": "^1.0.1", + "path-browserify": "^1.0.0", + "process": "~0.11.0", + "punycode": "^1.3.2", + "querystring-es3": "~0.2.0", + "read-only-stream": "^2.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.1.4", + "shasum-object": "^1.0.0", + "shell-quote": "^1.6.1", + "stream-browserify": "^3.0.0", + "stream-http": "^3.0.0", + "string_decoder": "^1.1.1", + "subarg": "^1.0.0", + "syntax-error": "^1.1.1", + "through2": "^2.0.0", + "timers-browserify": "^1.0.1", + "tty-browserify": "0.0.1", + "url": "~0.11.0", + "util": "~0.12.0", + "vm-browserify": "^1.0.0", + "xtend": "^4.0.0" + }, + "bin": { + "browserify": "bin/cmd.js" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/browserify-aes": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/browserify-cipher": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "node_modules/browserify-des": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/browserify-rsa": { + "version": "4.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^5.2.1", + "randombytes": "^2.1.0", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/browserify-sign": { + "version": "4.2.3", + "dev": true, + "license": "ISC", + "dependencies": { + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.5", + "hash-base": "~3.0", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.7", + "readable-stream": "^2.3.8", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/browserify-zlib": { + "version": "0.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pako": "~1.0.5" + } + }, + "node_modules/buffer": { + "version": "5.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/buffer-xor": { + "version": "1.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/builtin-status-codes": { + "version": "3.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/cached-path-relative": { + "version": "1.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/call-bind": { + "version": "1.0.7", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chai": { + "version": "4.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/check-error": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "3.5.1", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.1" + } + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/combine-source-map": { + "version": "0.8.0", + "dev": true, + "license": "MIT", + "dependencies": { + "convert-source-map": "~1.1.0", + "inline-source-map": "~0.6.0", + "lodash.memoize": "~3.0.3", + "source-map": "~0.5.3" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-stream": { + "version": "1.6.2", + "dev": true, + "engines": [ + "node >= 0.8" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/console-browserify": { + "version": "1.2.0", + "dev": true + }, + "node_modules/constants-browserify": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/convert-source-map": { + "version": "1.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/create-ecdh": { + "version": "4.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + } + }, + "node_modules/create-ecdh/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/create-hash": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "dev": true, + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "dev": true, + "license": "MIT" + }, + "node_modules/crypto-browserify": { + "version": "3.12.1", + "dev": true, + "license": "MIT", + "dependencies": { + "browserify-cipher": "^1.0.1", + "browserify-sign": "^4.2.3", + "create-ecdh": "^4.0.4", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "diffie-hellman": "^5.0.3", + "hash-base": "~3.0.4", + "inherits": "^2.0.4", + "pbkdf2": "^3.1.2", + "public-encrypt": "^4.0.3", + "randombytes": "^2.1.0", + "randomfill": "^1.0.4" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/dash-ast": { + "version": "1.0.0", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/debug": { + "version": "4.3.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/decamelize": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-eql": { + "version": "4.1.4", + "dev": true, + "license": "MIT", + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/defined": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/deps-sort": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "JSONStream": "^1.0.3", + "shasum-object": "^1.0.0", + "subarg": "^1.0.0", + "through2": "^2.0.0" + }, + "bin": { + "deps-sort": "bin/cmd.js" + } + }, + "node_modules/des.js": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/detective": { + "version": "5.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn-node": "^1.8.2", + "defined": "^1.0.0", + "minimist": "^1.2.6" + }, + "bin": { + "detective": "bin/detective.js" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/diff": { + "version": "5.0.0", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diffie-hellman": { + "version": "5.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "node_modules/diffie-hellman/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/domain-browser": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4", + "npm": ">=1.2" + } + }, + "node_modules/duplexer2": { + "version": "0.1.4", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "readable-stream": "^2.0.2" + } + }, + "node_modules/elliptic": { + "version": "6.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/events": { + "version": "3.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/evp_bytestokey": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "dev": true, + "license": "MIT" + }, + "node_modules/fill-range": { + "version": "7.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "dev": true, + "license": "BSD-3-Clause", + "bin": { + "flat": "cli.js" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/form-data": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-assigned-identifiers": { + "version": "1.2.0", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-func-name": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/growl": { + "version": "1.10.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.x" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hash-base": { + "version": "3.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/he": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/htmlescape": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/https-browserify": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/ieee754": { + "version": "1.2.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/inflight": { + "version": "1.0.6", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "dev": true, + "license": "ISC" + }, + "node_modules/inline-source-map": { + "version": "0.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "source-map": "~0.5.3" + } + }, + "node_modules/insert-module-globals": { + "version": "7.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn-node": "^1.5.2", + "combine-source-map": "^0.8.0", + "concat-stream": "^1.6.1", + "is-buffer": "^1.1.0", + "JSONStream": "^1.0.3", + "path-is-absolute": "^1.0.1", + "process": "~0.11.0", + "through2": "^2.0.0", + "undeclared-identifiers": "^1.1.2", + "xtend": "^4.0.0" + }, + "bin": { + "insert-module-globals": "bin/cmd.js" + } + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "dev": true, + "license": "MIT" + }, + "node_modules/is-callable": { + "version": "1.2.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.15.1", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "dev": true, + "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.13", + "dev": true, + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/js-yaml": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "dev": true, + "engines": [ + "node >= 0.2.0" + ], + "license": "MIT" + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "dev": true, + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/labeled-stream-splicer": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "stream-splicer": "^2.0.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.memoize": { + "version": "3.0.4", + "dev": true, + "license": "MIT" + }, + "node_modules/log-symbols": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/loupe": { + "version": "2.3.7", + "dev": true, + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.1" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "dev": true, + "license": "ISC" + }, + "node_modules/md5.js": { + "version": "1.3.5", + "dev": true, + "license": "MIT", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/miller-rabin": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "bin": { + "miller-rabin": "bin/miller-rabin" + } + }, + "node_modules/miller-rabin/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/mime-db": { + "version": "1.52.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "dev": true, + "license": "ISC" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "dev": true, + "license": "MIT" + }, + "node_modules/mocha": { + "version": "8.4.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.1", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.6", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.0.0", + "log-symbols": "4.0.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.20", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 10.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "7.1.6", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "3.0.4", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/module-deps": { + "version": "6.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "browser-resolve": "^2.0.0", + "cached-path-relative": "^1.0.2", + "concat-stream": "~1.6.0", + "defined": "^1.0.0", + "detective": "^5.2.0", + "duplexer2": "^0.1.2", + "inherits": "^2.0.1", + "JSONStream": "^1.0.3", + "parents": "^1.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.4.0", + "stream-combiner2": "^1.1.1", + "subarg": "^1.0.0", + "through2": "^2.0.0", + "xtend": "^4.0.0" + }, + "bin": { + "module-deps": "bin/cmd.js" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.1.20", + "dev": true, + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.5", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/os-browserify": { + "version": "0.3.0", + "dev": true, + "license": "MIT" + }, + "node_modules/p-limit": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pako": { + "version": "1.0.11", + "dev": true, + "license": "(MIT AND Zlib)" + }, + "node_modules/parents": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "path-platform": "~0.11.15" + } + }, + "node_modules/parse-asn1": { + "version": "5.1.7", + "dev": true, + "license": "ISC", + "dependencies": { + "asn1.js": "^4.10.1", + "browserify-aes": "^1.2.0", + "evp_bytestokey": "^1.0.3", + "hash-base": "~3.0", + "pbkdf2": "^3.1.2", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/path-browserify": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/path-exists": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "dev": true, + "license": "MIT" + }, + "node_modules/path-platform": { + "version": "0.11.15", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/pathval": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/pbkdf2": { + "version": "3.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/process": { + "version": "0.11.10", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/public-encrypt": { + "version": "4.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/public-encrypt/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/punycode": { + "version": "1.4.1", + "dev": true, + "license": "MIT" + }, + "node_modules/qs": { + "version": "6.13.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/querystring-es3": { + "version": "0.2.1", + "dev": true, + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/randomfill": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "node_modules/read-only-stream": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.2" + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/readable-stream/node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/readdirp": { + "version": "3.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/serialize-javascript": { + "version": "5.0.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/sha.js": { + "version": "2.4.11", + "dev": true, + "license": "(MIT AND BSD-3-Clause)", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/shasum-object": { + "version": "1.0.0", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "fast-safe-stringify": "^2.0.7" + } + }, + "node_modules/shell-quote": { + "version": "1.8.1", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel": { + "version": "1.0.6", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/source-map": { + "version": "0.5.7", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/source-map-support/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stream-browserify": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" + } + }, + "node_modules/stream-browserify/node_modules/readable-stream": { + "version": "3.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/stream-combiner2": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "duplexer2": "~0.1.0", + "readable-stream": "^2.0.2" + } + }, + "node_modules/stream-http": { + "version": "3.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "xtend": "^4.0.2" + } + }, + "node_modules/stream-http/node_modules/readable-stream": { + "version": "3.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/stream-splicer": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-ansi": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/subarg": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.1.0" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/syntax-error": { + "version": "1.4.0", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn-node": "^1.2.0" + } + }, + "node_modules/through": { + "version": "2.3.8", + "dev": true, + "license": "MIT" + }, + "node_modules/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/timers-browserify": { + "version": "1.4.2", + "dev": true, + "dependencies": { + "process": "~0.11.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ts-node": { + "version": "9.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "typescript": ">=2.7" + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/tty-browserify": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/type-detect": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "dev": true, + "license": "MIT" + }, + "node_modules/typescript": { + "version": "4.9.5", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/umd": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "bin": { + "umd": "bin/cli.js" + } + }, + "node_modules/undeclared-identifiers": { + "version": "1.1.3", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "acorn-node": "^1.3.0", + "dash-ast": "^1.0.0", + "get-assigned-identifiers": "^1.2.0", + "simple-concat": "^1.0.0", + "xtend": "^4.0.1" + }, + "bin": { + "undeclared-identifiers": "bin.js" + } + }, + "node_modules/url": { + "version": "0.11.4", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^1.4.1", + "qs": "^6.12.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/util": { + "version": "0.12.5", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/vm-browserify": { + "version": "1.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/which": { + "version": "2.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.15", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wide-align": { + "version": "1.1.3", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^1.0.2 || 2" + } + }, + "node_modules/workerpool": { + "version": "6.1.0", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "dev": true, + "license": "ISC" + }, + "node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "16.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.4", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/samples/client/petstore/typescript-axios/tests/with-complex-headers/package.json b/samples/client/petstore/typescript-axios/tests/with-complex-headers/package.json new file mode 100644 index 000000000000..ce1ccc7a07b6 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/with-complex-headers/package.json @@ -0,0 +1,31 @@ +{ + "private": true, + "dependencies": { + "@openapitools/typescript-axios-petstore": "file:../../builds/with-complex-headers" + }, + "scripts": { + "preinstall": "npm --prefix ../../builds/with-complex-headers install && npm run build", + "test": "mocha test/*.ts --require ts-node/register --timeout 10000", + "build": "tsc", + "browserify": "browserify test -p [ tsify ] > ./dist/test.browserify-bundle.js" + }, + "devDependencies": { + "@types/chai": "^4.2.14", + "@types/mocha": "^8.2.0", + "@types/node": "^14.14.14", + "axios": "*", + "browserify": "^17.0.0", + "chai": "^4.2.0", + "mocha": "^8.2.1", + "ts-node": "^9.1.1", + "typescript": "^4.1.2" + }, + "name": "typescript-axios-test-with-complex-headers", + "version": "1.0.0", + "directories": { + "test": "test" + }, + "author": "", + "license": "ISC", + "description": "" + } diff --git a/samples/client/petstore/typescript-axios/tests/with-complex-headers/pom.xml b/samples/client/petstore/typescript-axios/tests/with-complex-headers/pom.xml new file mode 100644 index 000000000000..fca9e5a2bcec --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/with-complex-headers/pom.xml @@ -0,0 +1,59 @@ + + 4.0.0 + org.openapitools + TypeScriptAxiosPetstoreClientWithComplexHeadersTests + pom + 1.0-SNAPSHOT + TS Axios Petstore Test Client With Complex Headers + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + npm-install + pre-integration-test + + exec + + + npm + + install + + + + + npm-test + integration-test + + exec + + + npm + + test + + + + + + + + diff --git a/samples/client/petstore/typescript-axios/tests/with-complex-headers/test/PetApi.ts b/samples/client/petstore/typescript-axios/tests/with-complex-headers/test/PetApi.ts new file mode 100644 index 000000000000..b70308db2338 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/with-complex-headers/test/PetApi.ts @@ -0,0 +1,112 @@ +import { expect } from "chai"; +import { PetApi, Pet, PetStatusEnum, Category, ApiResponse } from "@openapitools/typescript-axios-petstore"; +import axios, {AxiosInstance, AxiosResponse} from "axios"; +import * as fs from "fs"; + +describe("PetApi", () => { + function runSuite(description: string, requestOptions?: any, customAxiosInstance?: AxiosInstance): void { + describe(description, () => { + let api: PetApi; + const fixture: Pet = createTestFixture(); + + beforeEach(() => { + api = new PetApi(undefined, undefined, customAxiosInstance); + }); + + it("should add and delete Pet", () => { + return api.addPet(fixture, requestOptions).then(() => {}); + }); + + it("should get Pet by ID", () => { + return api + .getPetById(fixture.id, requestOptions) + .then((result: AxiosResponse) => { + return expect(result.data).to.deep.equal(fixture); + }); + }); + + it("should update Pet by ID", () => { + return api + .getPetById(fixture.id, requestOptions) + .then((response: AxiosResponse) => { + const result = response.data; + result.name = "newname"; + return api.updatePet(result, requestOptions).then(() => { + return api + .getPetById(fixture.id, requestOptions) + .then((response: AxiosResponse) => { + return expect(response.data.name).to.deep.equal("newname"); + }); + }); + }); + }); + + it("should upload file with defined contentType", () => { + fs.writeFileSync("/tmp/file.txt", "file content"); + const fileObject = fs.readFileSync("/tmp/file.txt"); + return api + //@ts-ignore + .uploadFile(fixture.id, "text/plain", "text file", fileObject, requestOptions) + .then((response: AxiosResponse) => expect(response.status).to.eq(200)); + }); + + it("should upload file with default contentType", () => { + fs.writeFileSync("/tmp/file.txt", "file content"); + const fileObject = fs.readFileSync("/tmp/file.txt"); + return api + //@ts-ignore + .uploadFile(fixture.id, undefined, "text file", fileObject, requestOptions) + .then((response: AxiosResponse) => expect(response.status).to.eq(200)); + }); + + it("should delete Pet", () => { + return api.deletePet(fixture.id, requestOptions); + }); + + it("should not contain deleted Pet", () => { + return api.getPetById(fixture.id, requestOptions).then( + (result: AxiosResponse) => { + return expect(result.data).to.not.exist; + }, + (err: any) => { + return expect(err).to.exist; + } + ); + }); + }); + } + + runSuite("without custom request options"); + + runSuite("with custom request options", { + credentials: "include", + mode: "cors" + }); + + runSuite("without custom axios instance"); + + runSuite("with custom axios instance",{}, axios); + + runSuite("with custom request options and custom axios instance",{ + credentials: "include", + mode: "cors" + }, axios); +}); + +function createTestFixture(ts = Date.now()) { + const category: Category = { + id: ts, + name: `category${ts}` + }; + + const pet: Pet = { + id: ts, + name: `pet${ts}`, + category: category, + photoUrls: ["http://foo.bar.com/1", "http://foo.bar.com/2"], + status: PetStatusEnum.Available, + tags: [] + }; + + return pet; +} diff --git a/samples/client/petstore/typescript-axios/tests/with-complex-headers/test/index.ts b/samples/client/petstore/typescript-axios/tests/with-complex-headers/test/index.ts new file mode 100644 index 000000000000..231098e10162 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/with-complex-headers/test/index.ts @@ -0,0 +1 @@ +import './PetApi'; diff --git a/samples/client/petstore/typescript-axios/tests/with-complex-headers/tsconfig.json b/samples/client/petstore/typescript-axios/tests/with-complex-headers/tsconfig.json new file mode 100644 index 000000000000..2bca81353482 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/with-complex-headers/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "module": "CommonJS", + "target": "ES5", + "noImplicitAny": true, + "sourceMap": false, + "outDir": "dist", + "types": [ + "mocha", + "node" + ], + "lib": [ + "es6", + "dom" + ] + }, + "exclude": [ + "node_modules" + ] +} From 86758747c28980781233b344136e55a981c65c47 Mon Sep 17 00:00:00 2001 From: Jules Ivanic Date: Thu, 7 Nov 2024 19:50:51 +1100 Subject: [PATCH 2/7] Fix #20044 (#20045) --- .../src/main/resources/typescript-fetch/modelOneOf.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache index 9a9f56b5f3d8..0decac17419f 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache @@ -49,7 +49,7 @@ export function {{classname}}ToJSON(value?: {{classname}} | null): any { switch (value['{{discriminator.propertyName}}']) { {{#discriminator.mappedModels}} case '{{mappingName}}': - return {{modelName}}ToJSON(value); + return Object.assign({}, {{modelName}}ToJSON(value), { {{discriminator.propertyName}}: '{{mappingName}}' } as const); {{/discriminator.mappedModels}} default: throw new Error(`No variant of {{classname}} exists with '{{discriminator.propertyName}}=${value['{{discriminator.propertyName}}']}'`); From cfef948c11bb5228fc1aa0635254db6674c21f54 Mon Sep 17 00:00:00 2001 From: Linh Tran Tuan Date: Thu, 7 Nov 2024 19:39:51 +0900 Subject: [PATCH 3/7] [Rust-Axum] [Breaking Changes] Prevent Operation response with internal Error (#20047) * [Rust-Axum] Fix: prevent Operation returns Internal Server Error * Update --- .../main/resources/rust-axum/apis.mustache | 2 +- .../output/apikey-auths/src/apis/payments.rs | 6 +- .../output/multipart-v3/src/apis/default.rs | 6 +- .../output/openapi-v3/src/apis/default.rs | 59 +++++++-------- .../output/openapi-v3/src/apis/info_repo.rs | 2 +- .../output/openapi-v3/src/apis/repo.rs | 2 +- .../output/ops-v3/src/apis/default.rs | 74 +++++++++---------- .../src/apis/another_fake.rs | 2 +- .../src/apis/fake.rs | 26 +++---- .../src/apis/fake_classname_tags123.rs | 2 +- .../src/apis/pet.rs | 16 ++-- .../src/apis/store.rs | 8 +- .../src/apis/user.rs | 16 ++-- .../rust-axum/output/petstore/src/apis/pet.rs | 16 ++-- .../output/petstore/src/apis/store.rs | 8 +- .../output/petstore/src/apis/user.rs | 16 ++-- .../ping-bearer-auth/src/apis/default.rs | 2 +- .../rust-axum-header-uuid/src/apis/default.rs | 2 +- .../output/rust-axum-test/src/apis/default.rs | 18 ++--- .../src/apis/default.rs | 2 +- 20 files changed, 141 insertions(+), 144 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/rust-axum/apis.mustache b/modules/openapi-generator/src/main/resources/rust-axum/apis.mustache index a44f21379bf9..b897475dea79 100644 --- a/modules/openapi-generator/src/main/resources/rust-axum/apis.mustache +++ b/modules/openapi-generator/src/main/resources/rust-axum/apis.mustache @@ -72,7 +72,7 @@ pub trait {{classnamePascalCase}} { {{#x-consumes-multipart-related}} body: axum::body::Body, {{/x-consumes-multipart-related}} - ) -> Result<{{{operationId}}}Response, String>; + ) -> Result<{{{operationId}}}Response, ()>; {{/vendorExtensions}} {{^-last}} diff --git a/samples/server/petstore/rust-axum/output/apikey-auths/src/apis/payments.rs b/samples/server/petstore/rust-axum/output/apikey-auths/src/apis/payments.rs index 4d824e3a9c13..0c694b6d08e8 100644 --- a/samples/server/petstore/rust-axum/output/apikey-auths/src/apis/payments.rs +++ b/samples/server/petstore/rust-axum/output/apikey-auths/src/apis/payments.rs @@ -48,7 +48,7 @@ pub trait Payments { host: Host, cookies: CookieJar, path_params: models::GetPaymentMethodByIdPathParams, - ) -> Result; + ) -> Result; /// Get payment methods. /// @@ -58,7 +58,7 @@ pub trait Payments { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Make a payment. /// @@ -70,5 +70,5 @@ pub trait Payments { cookies: CookieJar, token_in_cookie: Option, body: Option, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/multipart-v3/src/apis/default.rs b/samples/server/petstore/rust-axum/output/multipart-v3/src/apis/default.rs index 27d8cf2ee301..ad21c532ae7e 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/multipart-v3/src/apis/default.rs @@ -42,7 +42,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: axum::body::Body, - ) -> Result; + ) -> Result; /// MultipartRequestPost - POST /multipart_request async fn multipart_request_post( @@ -51,7 +51,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: Multipart, - ) -> Result; + ) -> Result; /// MultipleIdenticalMimeTypesPost - POST /multiple-identical-mime-types async fn multiple_identical_mime_types_post( @@ -60,5 +60,5 @@ pub trait Default { host: Host, cookies: CookieJar, body: axum::body::Body, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs index c8908cfc14d8..0e7b62722ca2 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs @@ -282,7 +282,7 @@ pub trait Default { host: Host, cookies: CookieJar, query_params: models::AnyOfGetQueryParams, - ) -> Result; + ) -> Result; /// CallbackWithHeaderPost - POST /callback-with-header async fn callback_with_header_post( @@ -291,7 +291,7 @@ pub trait Default { host: Host, cookies: CookieJar, query_params: models::CallbackWithHeaderPostQueryParams, - ) -> Result; + ) -> Result; /// ComplexQueryParamGet - GET /complex-query-param async fn complex_query_param_get( @@ -300,7 +300,7 @@ pub trait Default { host: Host, cookies: CookieJar, query_params: models::ComplexQueryParamGetQueryParams, - ) -> Result; + ) -> Result; /// EnumInPathPathParamGet - GET /enum_in_path/{path_param} async fn enum_in_path_path_param_get( @@ -309,7 +309,7 @@ pub trait Default { host: Host, cookies: CookieJar, path_params: models::EnumInPathPathParamGetPathParams, - ) -> Result; + ) -> Result; /// Test a Form Post. /// @@ -320,7 +320,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: models::FormTestRequest, - ) -> Result; + ) -> Result; /// GetWithBooleanParameter - GET /get-with-bool async fn get_with_boolean_parameter( @@ -329,7 +329,7 @@ pub trait Default { host: Host, cookies: CookieJar, query_params: models::GetWithBooleanParameterQueryParams, - ) -> Result; + ) -> Result; /// JsonComplexQueryParamGet - GET /json-complex-query-param async fn json_complex_query_param_get( @@ -338,7 +338,7 @@ pub trait Default { host: Host, cookies: CookieJar, query_params: models::JsonComplexQueryParamGetQueryParams, - ) -> Result; + ) -> Result; /// MandatoryRequestHeaderGet - GET /mandatory-request-header async fn mandatory_request_header_get( @@ -347,7 +347,7 @@ pub trait Default { host: Host, cookies: CookieJar, header_params: models::MandatoryRequestHeaderGetHeaderParams, - ) -> Result; + ) -> Result; /// MergePatchJsonGet - GET /merge-patch-json async fn merge_patch_json_get( @@ -355,7 +355,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Get some stuff.. /// @@ -365,7 +365,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// MultipleAuthSchemeGet - GET /multiple_auth_scheme async fn multiple_auth_scheme_get( @@ -373,7 +373,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGet - GET /multiple-path-params-with-very-long-path-to-test-formatting/{path_param_a}/{path_param_b} async fn multiple_path_params_with_very_long_path_to_test_formatting_path_param_a_path_param_b_get( @@ -382,10 +382,7 @@ pub trait Default { host: Host, cookies: CookieJar, path_params: models::MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetPathParams, - ) -> Result< - MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetResponse, - String, - >; + ) -> Result; /// OneOfGet - GET /one-of async fn one_of_get( @@ -393,7 +390,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// OverrideServerGet - GET /override-server async fn override_server_get( @@ -401,7 +398,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Get some stuff with parameters.. /// @@ -412,7 +409,7 @@ pub trait Default { host: Host, cookies: CookieJar, query_params: models::ParamgetGetQueryParams, - ) -> Result; + ) -> Result; /// ReadonlyAuthSchemeGet - GET /readonly_auth_scheme async fn readonly_auth_scheme_get( @@ -420,7 +417,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// RegisterCallbackPost - POST /register-callback async fn register_callback_post( @@ -429,7 +426,7 @@ pub trait Default { host: Host, cookies: CookieJar, query_params: models::RegisterCallbackPostQueryParams, - ) -> Result; + ) -> Result; /// RequiredOctetStreamPut - PUT /required_octet_stream async fn required_octet_stream_put( @@ -438,7 +435,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: Bytes, - ) -> Result; + ) -> Result; /// ResponsesWithHeadersGet - GET /responses_with_headers async fn responses_with_headers_get( @@ -446,7 +443,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Rfc7807Get - GET /rfc7807 async fn rfc7807_get( @@ -454,7 +451,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// TwoFirstLetterHeaders - POST /operation-two-first-letter-headers async fn two_first_letter_headers( @@ -463,7 +460,7 @@ pub trait Default { host: Host, cookies: CookieJar, header_params: models::TwoFirstLetterHeadersHeaderParams, - ) -> Result; + ) -> Result; /// UntypedPropertyGet - GET /untyped_property async fn untyped_property_get( @@ -472,7 +469,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: Option, - ) -> Result; + ) -> Result; /// UuidGet - GET /uuid async fn uuid_get( @@ -480,7 +477,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// XmlExtraPost - POST /xml_extra async fn xml_extra_post( @@ -489,7 +486,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: Bytes, - ) -> Result; + ) -> Result; /// XmlOtherPost - POST /xml_other async fn xml_other_post( @@ -498,7 +495,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: Bytes, - ) -> Result; + ) -> Result; /// XmlOtherPut - PUT /xml_other async fn xml_other_put( @@ -507,7 +504,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: Bytes, - ) -> Result; + ) -> Result; /// Post an array. It's important we test apostrophes, so include one here.. /// @@ -518,7 +515,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: Bytes, - ) -> Result; + ) -> Result; /// XmlPut - PUT /xml async fn xml_put( @@ -527,5 +524,5 @@ pub trait Default { host: Host, cookies: CookieJar, body: Bytes, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/info_repo.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/info_repo.rs index bd68394bf230..c73db4a16d43 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/info_repo.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/info_repo.rs @@ -26,5 +26,5 @@ pub trait InfoRepo { host: Host, cookies: CookieJar, path_params: models::GetRepoInfoPathParams, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/repo.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/repo.rs index e08336d7799e..90d9a774f6e1 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/repo.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/repo.rs @@ -26,5 +26,5 @@ pub trait Repo { host: Host, cookies: CookieJar, body: models::ObjectParam, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/ops-v3/src/apis/default.rs b/samples/server/petstore/rust-axum/output/ops-v3/src/apis/default.rs index c24558c161db..387f4b3fa792 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/ops-v3/src/apis/default.rs @@ -313,7 +313,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op11Get - GET /op11 async fn op11_get( @@ -321,7 +321,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op12Get - GET /op12 async fn op12_get( @@ -329,7 +329,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op13Get - GET /op13 async fn op13_get( @@ -337,7 +337,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op14Get - GET /op14 async fn op14_get( @@ -345,7 +345,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op15Get - GET /op15 async fn op15_get( @@ -353,7 +353,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op16Get - GET /op16 async fn op16_get( @@ -361,7 +361,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op17Get - GET /op17 async fn op17_get( @@ -369,7 +369,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op18Get - GET /op18 async fn op18_get( @@ -377,7 +377,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op19Get - GET /op19 async fn op19_get( @@ -385,7 +385,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op1Get - GET /op1 async fn op1_get( @@ -393,7 +393,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op20Get - GET /op20 async fn op20_get( @@ -401,7 +401,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op21Get - GET /op21 async fn op21_get( @@ -409,7 +409,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op22Get - GET /op22 async fn op22_get( @@ -417,7 +417,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op23Get - GET /op23 async fn op23_get( @@ -425,7 +425,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op24Get - GET /op24 async fn op24_get( @@ -433,7 +433,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op25Get - GET /op25 async fn op25_get( @@ -441,7 +441,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op26Get - GET /op26 async fn op26_get( @@ -449,7 +449,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op27Get - GET /op27 async fn op27_get( @@ -457,7 +457,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op28Get - GET /op28 async fn op28_get( @@ -465,7 +465,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op29Get - GET /op29 async fn op29_get( @@ -473,7 +473,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op2Get - GET /op2 async fn op2_get( @@ -481,7 +481,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op30Get - GET /op30 async fn op30_get( @@ -489,7 +489,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op31Get - GET /op31 async fn op31_get( @@ -497,7 +497,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op32Get - GET /op32 async fn op32_get( @@ -505,7 +505,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op33Get - GET /op33 async fn op33_get( @@ -513,7 +513,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op34Get - GET /op34 async fn op34_get( @@ -521,7 +521,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op35Get - GET /op35 async fn op35_get( @@ -529,7 +529,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op36Get - GET /op36 async fn op36_get( @@ -537,7 +537,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op37Get - GET /op37 async fn op37_get( @@ -545,7 +545,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op3Get - GET /op3 async fn op3_get( @@ -553,7 +553,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op4Get - GET /op4 async fn op4_get( @@ -561,7 +561,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op5Get - GET /op5 async fn op5_get( @@ -569,7 +569,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op6Get - GET /op6 async fn op6_get( @@ -577,7 +577,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op7Get - GET /op7 async fn op7_get( @@ -585,7 +585,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op8Get - GET /op8 async fn op8_get( @@ -593,7 +593,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Op9Get - GET /op9 async fn op9_get( @@ -601,5 +601,5 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/another_fake.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/another_fake.rs index 99c6307abe80..f64e2e451bb9 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/another_fake.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/another_fake.rs @@ -28,5 +28,5 @@ pub trait AnotherFake { host: Host, cookies: CookieJar, body: models::Client, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake.rs index 38c5c477b253..22ad661101aa 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake.rs @@ -125,7 +125,7 @@ pub trait Fake { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// FakeOuterBooleanSerialize - POST /v2/fake/outer/boolean async fn fake_outer_boolean_serialize( @@ -134,7 +134,7 @@ pub trait Fake { host: Host, cookies: CookieJar, body: Option, - ) -> Result; + ) -> Result; /// FakeOuterCompositeSerialize - POST /v2/fake/outer/composite async fn fake_outer_composite_serialize( @@ -143,7 +143,7 @@ pub trait Fake { host: Host, cookies: CookieJar, body: Option, - ) -> Result; + ) -> Result; /// FakeOuterNumberSerialize - POST /v2/fake/outer/number async fn fake_outer_number_serialize( @@ -152,7 +152,7 @@ pub trait Fake { host: Host, cookies: CookieJar, body: Option, - ) -> Result; + ) -> Result; /// FakeOuterStringSerialize - POST /v2/fake/outer/string async fn fake_outer_string_serialize( @@ -161,7 +161,7 @@ pub trait Fake { host: Host, cookies: CookieJar, body: Option, - ) -> Result; + ) -> Result; /// FakeResponseWithNumericalDescription - GET /v2/fake/response-with-numerical-description async fn fake_response_with_numerical_description( @@ -169,7 +169,7 @@ pub trait Fake { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// HyphenParam - GET /v2/fake/hyphenParam/{hyphen-param} async fn hyphen_param( @@ -178,7 +178,7 @@ pub trait Fake { host: Host, cookies: CookieJar, path_params: models::HyphenParamPathParams, - ) -> Result; + ) -> Result; /// TestBodyWithQueryParams - PUT /v2/fake/body-with-query-params async fn test_body_with_query_params( @@ -188,7 +188,7 @@ pub trait Fake { cookies: CookieJar, query_params: models::TestBodyWithQueryParamsQueryParams, body: models::User, - ) -> Result; + ) -> Result; /// To test \"client\" model. /// @@ -199,7 +199,7 @@ pub trait Fake { host: Host, cookies: CookieJar, body: models::Client, - ) -> Result; + ) -> Result; /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트. /// @@ -210,7 +210,7 @@ pub trait Fake { host: Host, cookies: CookieJar, body: models::TestEndpointParametersRequest, - ) -> Result; + ) -> Result; /// To test enum parameters. /// @@ -223,7 +223,7 @@ pub trait Fake { header_params: models::TestEnumParametersHeaderParams, query_params: models::TestEnumParametersQueryParams, body: Option, - ) -> Result; + ) -> Result; /// test inline additionalProperties. /// @@ -234,7 +234,7 @@ pub trait Fake { host: Host, cookies: CookieJar, body: std::collections::HashMap, - ) -> Result; + ) -> Result; /// test json serialization of form data. /// @@ -245,5 +245,5 @@ pub trait Fake { host: Host, cookies: CookieJar, body: models::TestJsonFormDataRequest, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake_classname_tags123.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake_classname_tags123.rs index dbc5f4b6184f..100f9dc7ad59 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake_classname_tags123.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake_classname_tags123.rs @@ -28,5 +28,5 @@ pub trait FakeClassnameTags123 { host: Host, cookies: CookieJar, body: models::Client, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/pet.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/pet.rs index 169b621ede09..05bb94bdfe44 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/pet.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/pet.rs @@ -96,7 +96,7 @@ pub trait Pet { host: Host, cookies: CookieJar, body: models::Pet, - ) -> Result; + ) -> Result; /// Deletes a pet. /// @@ -108,7 +108,7 @@ pub trait Pet { cookies: CookieJar, header_params: models::DeletePetHeaderParams, path_params: models::DeletePetPathParams, - ) -> Result; + ) -> Result; /// Finds Pets by status. /// @@ -119,7 +119,7 @@ pub trait Pet { host: Host, cookies: CookieJar, query_params: models::FindPetsByStatusQueryParams, - ) -> Result; + ) -> Result; /// Finds Pets by tags. /// @@ -130,7 +130,7 @@ pub trait Pet { host: Host, cookies: CookieJar, query_params: models::FindPetsByTagsQueryParams, - ) -> Result; + ) -> Result; /// Find pet by ID. /// @@ -142,7 +142,7 @@ pub trait Pet { cookies: CookieJar, token_in_header: Option, path_params: models::GetPetByIdPathParams, - ) -> Result; + ) -> Result; /// Update an existing pet. /// @@ -153,7 +153,7 @@ pub trait Pet { host: Host, cookies: CookieJar, body: models::Pet, - ) -> Result; + ) -> Result; /// Updates a pet in the store with form data. /// @@ -165,7 +165,7 @@ pub trait Pet { cookies: CookieJar, path_params: models::UpdatePetWithFormPathParams, body: Option, - ) -> Result; + ) -> Result; /// uploads an image. /// @@ -177,5 +177,5 @@ pub trait Pet { cookies: CookieJar, path_params: models::UploadFilePathParams, body: Multipart, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/store.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/store.rs index 3616cc511a32..371f49d4ebe2 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/store.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/store.rs @@ -60,7 +60,7 @@ pub trait Store { host: Host, cookies: CookieJar, path_params: models::DeleteOrderPathParams, - ) -> Result; + ) -> Result; /// Returns pet inventories by status. /// @@ -71,7 +71,7 @@ pub trait Store { host: Host, cookies: CookieJar, token_in_header: Option, - ) -> Result; + ) -> Result; /// Find purchase order by ID. /// @@ -82,7 +82,7 @@ pub trait Store { host: Host, cookies: CookieJar, path_params: models::GetOrderByIdPathParams, - ) -> Result; + ) -> Result; /// Place an order for a pet. /// @@ -93,5 +93,5 @@ pub trait Store { host: Host, cookies: CookieJar, body: models::Order, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/user.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/user.rs index ba3e68d8424d..1aa623644320 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/user.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/user.rs @@ -98,7 +98,7 @@ pub trait User { host: Host, cookies: CookieJar, body: models::User, - ) -> Result; + ) -> Result; /// Creates list of users with given input array. /// @@ -109,7 +109,7 @@ pub trait User { host: Host, cookies: CookieJar, body: Vec, - ) -> Result; + ) -> Result; /// Creates list of users with given input array. /// @@ -120,7 +120,7 @@ pub trait User { host: Host, cookies: CookieJar, body: Vec, - ) -> Result; + ) -> Result; /// Delete user. /// @@ -131,7 +131,7 @@ pub trait User { host: Host, cookies: CookieJar, path_params: models::DeleteUserPathParams, - ) -> Result; + ) -> Result; /// Get user by user name. /// @@ -142,7 +142,7 @@ pub trait User { host: Host, cookies: CookieJar, path_params: models::GetUserByNamePathParams, - ) -> Result; + ) -> Result; /// Logs user into the system. /// @@ -153,7 +153,7 @@ pub trait User { host: Host, cookies: CookieJar, query_params: models::LoginUserQueryParams, - ) -> Result; + ) -> Result; /// Logs out current logged in user session. /// @@ -163,7 +163,7 @@ pub trait User { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Updated user. /// @@ -175,5 +175,5 @@ pub trait User { cookies: CookieJar, path_params: models::UpdateUserPathParams, body: models::User, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/petstore/src/apis/pet.rs b/samples/server/petstore/rust-axum/output/petstore/src/apis/pet.rs index 92335fa4400c..bedaffceeb74 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/apis/pet.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/apis/pet.rs @@ -100,7 +100,7 @@ pub trait Pet { host: Host, cookies: CookieJar, body: models::Pet, - ) -> Result; + ) -> Result; /// Deletes a pet. /// @@ -112,7 +112,7 @@ pub trait Pet { cookies: CookieJar, header_params: models::DeletePetHeaderParams, path_params: models::DeletePetPathParams, - ) -> Result; + ) -> Result; /// Finds Pets by status. /// @@ -123,7 +123,7 @@ pub trait Pet { host: Host, cookies: CookieJar, query_params: models::FindPetsByStatusQueryParams, - ) -> Result; + ) -> Result; /// Finds Pets by tags. /// @@ -134,7 +134,7 @@ pub trait Pet { host: Host, cookies: CookieJar, query_params: models::FindPetsByTagsQueryParams, - ) -> Result; + ) -> Result; /// Find pet by ID. /// @@ -146,7 +146,7 @@ pub trait Pet { cookies: CookieJar, token_in_header: Option, path_params: models::GetPetByIdPathParams, - ) -> Result; + ) -> Result; /// Update an existing pet. /// @@ -157,7 +157,7 @@ pub trait Pet { host: Host, cookies: CookieJar, body: models::Pet, - ) -> Result; + ) -> Result; /// Updates a pet in the store with form data. /// @@ -169,7 +169,7 @@ pub trait Pet { cookies: CookieJar, path_params: models::UpdatePetWithFormPathParams, body: Option, - ) -> Result; + ) -> Result; /// uploads an image. /// @@ -181,5 +181,5 @@ pub trait Pet { cookies: CookieJar, path_params: models::UploadFilePathParams, body: Multipart, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/petstore/src/apis/store.rs b/samples/server/petstore/rust-axum/output/petstore/src/apis/store.rs index 85093df815ba..555aba9d894e 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/apis/store.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/apis/store.rs @@ -60,7 +60,7 @@ pub trait Store { host: Host, cookies: CookieJar, path_params: models::DeleteOrderPathParams, - ) -> Result; + ) -> Result; /// Returns pet inventories by status. /// @@ -71,7 +71,7 @@ pub trait Store { host: Host, cookies: CookieJar, token_in_header: Option, - ) -> Result; + ) -> Result; /// Find purchase order by ID. /// @@ -82,7 +82,7 @@ pub trait Store { host: Host, cookies: CookieJar, path_params: models::GetOrderByIdPathParams, - ) -> Result; + ) -> Result; /// Place an order for a pet. /// @@ -93,5 +93,5 @@ pub trait Store { host: Host, cookies: CookieJar, body: models::Order, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/petstore/src/apis/user.rs b/samples/server/petstore/rust-axum/output/petstore/src/apis/user.rs index 3d8846495695..ae7a2373f196 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/apis/user.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/apis/user.rs @@ -100,7 +100,7 @@ pub trait User { cookies: CookieJar, token_in_header: Option, body: models::User, - ) -> Result; + ) -> Result; /// Creates list of users with given input array. /// @@ -112,7 +112,7 @@ pub trait User { cookies: CookieJar, token_in_header: Option, body: Vec, - ) -> Result; + ) -> Result; /// Creates list of users with given input array. /// @@ -124,7 +124,7 @@ pub trait User { cookies: CookieJar, token_in_header: Option, body: Vec, - ) -> Result; + ) -> Result; /// Delete user. /// @@ -136,7 +136,7 @@ pub trait User { cookies: CookieJar, token_in_header: Option, path_params: models::DeleteUserPathParams, - ) -> Result; + ) -> Result; /// Get user by user name. /// @@ -147,7 +147,7 @@ pub trait User { host: Host, cookies: CookieJar, path_params: models::GetUserByNamePathParams, - ) -> Result; + ) -> Result; /// Logs user into the system. /// @@ -158,7 +158,7 @@ pub trait User { host: Host, cookies: CookieJar, query_params: models::LoginUserQueryParams, - ) -> Result; + ) -> Result; /// Logs out current logged in user session. /// @@ -169,7 +169,7 @@ pub trait User { host: Host, cookies: CookieJar, token_in_header: Option, - ) -> Result; + ) -> Result; /// Updated user. /// @@ -182,5 +182,5 @@ pub trait User { token_in_header: Option, path_params: models::UpdateUserPathParams, body: models::User, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/apis/default.rs b/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/apis/default.rs index 3608ffa65572..cfb12ef7fd4d 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/apis/default.rs @@ -25,5 +25,5 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/apis/default.rs b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/apis/default.rs index cd590f6819ac..2c6c51c0d2c3 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/apis/default.rs @@ -26,5 +26,5 @@ pub trait Default { host: Host, cookies: CookieJar, header_params: models::UsersPostHeaderParams, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/src/apis/default.rs b/samples/server/petstore/rust-axum/output/rust-axum-test/src/apis/default.rs index 08985bd64e59..ba643a1d2f82 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/src/apis/default.rs @@ -89,7 +89,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// A dummy endpoint to make the spec valid.. /// @@ -99,7 +99,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// DummyPut - PUT /dummy async fn dummy_put( @@ -108,7 +108,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: models::FooDummyPutRequest, - ) -> Result; + ) -> Result; /// Get a file. /// @@ -118,7 +118,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// GetStructuredYaml - GET /get-structured-yaml async fn get_structured_yaml( @@ -126,7 +126,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Test HTML handling. /// @@ -137,7 +137,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: String, - ) -> Result; + ) -> Result; /// PostYaml - POST /post-yaml async fn post_yaml( @@ -146,7 +146,7 @@ pub trait Default { host: Host, cookies: CookieJar, body: String, - ) -> Result; + ) -> Result; /// Get an arbitrary JSON blob.. /// @@ -156,7 +156,7 @@ pub trait Default { method: Method, host: Host, cookies: CookieJar, - ) -> Result; + ) -> Result; /// Send an arbitrary JSON blob. /// @@ -167,5 +167,5 @@ pub trait Default { host: Host, cookies: CookieJar, body: crate::types::Object, - ) -> Result; + ) -> Result; } diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/apis/default.rs b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/apis/default.rs index a5b9394198a1..d9ef3904a0ca 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/apis/default.rs @@ -26,5 +26,5 @@ pub trait Default { host: Host, cookies: CookieJar, body: models::Email, - ) -> Result; + ) -> Result; } From e2553a4a9107012a2db5767998b9ff9f4aeecd2e Mon Sep 17 00:00:00 2001 From: Anders Lien Date: Thu, 7 Nov 2024 13:00:06 +0100 Subject: [PATCH 4/7] Copy escapeReservedWord implementation from python generator (#20035) --- .../codegen/languages/PythonFastAPIServerCodegen.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java index ea1fb0ba315f..0ea2e9690aac 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java @@ -326,4 +326,12 @@ public void postProcess() { @Override public String generatorLanguageVersion() { return "3.7"; } + + @Override + public String escapeReservedWord(String name) { + if (this.reservedWordsMappings().containsKey(name)) { + return this.reservedWordsMappings().get(name); + } + return "var_" + name; + } } From 7deecdc569ddb1c41289829b26d4c2afaefb3b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Tsch=C3=A4pp=C3=A4t?= <11425952+elendil-software@users.noreply.github.com> Date: Thu, 7 Nov 2024 13:28:29 +0100 Subject: [PATCH 5/7] [csharp] Add a server generator for FastEndpoints (#19690) * Add of a first working generator for FastEndpoints framework Generator that support the basics of a FastEndpoints project https://fast-endpoints.com/ * Add respose code documentation support * Add an option to enable use of problem details * Clean enum and model * Add an option to generate record for requests/models * Update sample * Add support of nullable types * Add option to enable authentication * Add option to generate validators * Clean readme.md file * Add option to enable response caching * update readme template * Add missing files references * Update generated sample * Add link to documentation * Add generator documentation * correctly support packageName supportingFiles additions moved to processOpts() * improve useAuthentication option handling Avoid to copy an empty file * processOpts, move call to parent at the end * Update generated sample * Refactor and fix super.processOpts(); call order * Handle the case of multi-line description * Rename field to match naming conventions * Add useApiVersioning option * Update generated sample * Add generator documentation * Fix record when model contains optional properties * Add configuration files for each option * Add sample project for each configuration * Add GitHub Action workflow for sample projects * Add FastEndpoints BindFrom attribute on path, query and form params * Update sample generated projects * Fix validator template * fix alphabetical order * Use fully qualified name for FastEndpoints * Add options to set GUID to be used in sln file * update sample projects * Update generators.md * Fix path in github workflow * Put readme, gitignore and solution file at the root of generated project * update sample projects * Remove the projectGuid option This Guid need to be constant, it is related to project type * update sample projects --- .../samples-aspnet-fastenpoints-server.yaml | 34 ++ ...aspnet-fastendpoints-useApiVersioning.yaml | 16 + ...spnet-fastendpoints-useAuthentication.yaml | 16 + ...spnet-fastendpoints-useProblemDetails.yaml | 16 + .../aspnet-fastendpoints-useRecords.yaml | 16 + ...pnet-fastendpoints-useResponseCaching.yaml | 16 + .../aspnet-fastendpoints-useValidators.yaml | 16 + bin/configs/aspnet-fastendpoints.yaml | 16 + docs/generators.md | 1 + docs/generators/aspnet-fastendpoints.md | 321 ++++++++++++ .../AspnetFastendpointsServerCodegen.java | 220 ++++++++ .../org.openapitools.codegen.CodegenConfig | 1 + .../Properties/launchSettings.json | 41 ++ .../appsettings.Development.json | 8 + .../aspnet-fastendpoints/appsettings.json | 9 + .../aspnet-fastendpoints/endpoint.mustache | 50 ++ .../endpointRequestType.mustache | 1 + .../endpointResponseType.mustache | 1 + .../endpointType.mustache | 1 + .../aspnet-fastendpoints/enumClass.mustache | 16 + .../resources/aspnet-fastendpoints/gitignore | 484 ++++++++++++++++++ .../loginRequest.mustache | 15 + .../aspnet-fastendpoints/model.mustache | 10 + .../aspnet-fastendpoints/modelClass.mustache | 16 + .../aspnet-fastendpoints/modelRecord.mustache | 13 + .../aspnet-fastendpoints/program.mustache | 45 ++ .../project.csproj.mustache | 15 + .../aspnet-fastendpoints/readme.mustache | 18 + .../aspnet-fastendpoints/request.mustache | 22 + .../requestClass.mustache | 42 ++ .../requestRecord.mustache | 11 + .../aspnet-fastendpoints/solution.mustache | 25 + .../userLoginEndpoint.mustache | 46 ++ .../fastendpoints-useApiVersioning/.gitignore | 484 ++++++++++++++++++ .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 21 + .../.openapi-generator/VERSION | 1 + .../Org.OpenAPITools.sln | 25 + .../fastendpoints-useApiVersioning/README.md | 16 + .../Features/PetApiEndpoint.cs | 316 ++++++++++++ .../Features/PetApiRequest.cs | 97 ++++ .../Features/StoreApiEndpoint.cs | 157 ++++++ .../Features/StoreApiRequest.cs | 35 ++ .../Features/UserApiEndpoint.cs | 310 +++++++++++ .../Features/UserApiRequest.cs | 77 +++ .../Org.OpenAPITools/Models/ApiResponse.cs | 14 + .../src/Org.OpenAPITools/Models/Category.cs | 13 + .../src/Org.OpenAPITools/Models/Order.cs | 41 ++ .../src/Org.OpenAPITools/Models/Pet.cs | 41 ++ .../src/Org.OpenAPITools/Models/Tag.cs | 13 + .../src/Org.OpenAPITools/Models/User.cs | 19 + .../Org.OpenAPITools/Org.OpenAPITools.csproj | 14 + .../src/Org.OpenAPITools/Program.cs | 39 ++ .../Properties/launchSettings.json | 41 ++ .../appsettings.Development.json | 8 + .../src/Org.OpenAPITools/appsettings.json | 9 + .../.gitignore | 484 ++++++++++++++++++ .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 23 + .../.openapi-generator/VERSION | 1 + .../Org.OpenAPITools.sln | 25 + .../fastendpoints-useAuthentication/README.md | 16 + .../Org.OpenAPITools/Features/LoginRequest.cs | 9 + .../Features/PetApiEndpoint.cs | 316 ++++++++++++ .../Features/PetApiRequest.cs | 97 ++++ .../Features/StoreApiEndpoint.cs | 157 ++++++ .../Features/StoreApiRequest.cs | 35 ++ .../Features/UserApiEndpoint.cs | 310 +++++++++++ .../Features/UserApiRequest.cs | 77 +++ .../Features/UserLoginEndpoint.cs | 45 ++ .../Org.OpenAPITools/Models/ApiResponse.cs | 14 + .../src/Org.OpenAPITools/Models/Category.cs | 13 + .../src/Org.OpenAPITools/Models/Order.cs | 41 ++ .../src/Org.OpenAPITools/Models/Pet.cs | 41 ++ .../src/Org.OpenAPITools/Models/Tag.cs | 13 + .../src/Org.OpenAPITools/Models/User.cs | 19 + .../Org.OpenAPITools/Org.OpenAPITools.csproj | 15 + .../src/Org.OpenAPITools/Program.cs | 40 ++ .../Properties/launchSettings.json | 41 ++ .../appsettings.Development.json | 8 + .../src/Org.OpenAPITools/appsettings.json | 9 + .../.gitignore | 484 ++++++++++++++++++ .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 21 + .../.openapi-generator/VERSION | 1 + .../Org.OpenAPITools.sln | 25 + .../fastendpoints-useProblemDetails/README.md | 16 + .../Features/PetApiEndpoint.cs | 316 ++++++++++++ .../Features/PetApiRequest.cs | 97 ++++ .../Features/StoreApiEndpoint.cs | 157 ++++++ .../Features/StoreApiRequest.cs | 35 ++ .../Features/UserApiEndpoint.cs | 310 +++++++++++ .../Features/UserApiRequest.cs | 77 +++ .../Org.OpenAPITools/Models/ApiResponse.cs | 14 + .../src/Org.OpenAPITools/Models/Category.cs | 13 + .../src/Org.OpenAPITools/Models/Order.cs | 41 ++ .../src/Org.OpenAPITools/Models/Pet.cs | 41 ++ .../src/Org.OpenAPITools/Models/Tag.cs | 13 + .../src/Org.OpenAPITools/Models/User.cs | 19 + .../Org.OpenAPITools/Org.OpenAPITools.csproj | 14 + .../src/Org.OpenAPITools/Program.cs | 37 ++ .../Properties/launchSettings.json | 41 ++ .../appsettings.Development.json | 8 + .../src/Org.OpenAPITools/appsettings.json | 9 + .../fastendpoints-useRecords/.gitignore | 484 ++++++++++++++++++ .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 21 + .../.openapi-generator/VERSION | 1 + .../Org.OpenAPITools.sln | 25 + .../aspnet/fastendpoints-useRecords/README.md | 16 + .../Features/PetApiEndpoint.cs | 316 ++++++++++++ .../Features/PetApiRequest.cs | 45 ++ .../Features/StoreApiEndpoint.cs | 157 ++++++ .../Features/StoreApiRequest.cs | 24 + .../Features/UserApiEndpoint.cs | 310 +++++++++++ .../Features/UserApiRequest.cs | 40 ++ .../Org.OpenAPITools/Models/ApiResponse.cs | 14 + .../src/Org.OpenAPITools/Models/Category.cs | 13 + .../src/Org.OpenAPITools/Models/Order.cs | 41 ++ .../src/Org.OpenAPITools/Models/Pet.cs | 39 ++ .../src/Org.OpenAPITools/Models/Tag.cs | 13 + .../src/Org.OpenAPITools/Models/User.cs | 19 + .../Org.OpenAPITools/Org.OpenAPITools.csproj | 14 + .../src/Org.OpenAPITools/Program.cs | 37 ++ .../Properties/launchSettings.json | 41 ++ .../appsettings.Development.json | 8 + .../src/Org.OpenAPITools/appsettings.json | 9 + .../.gitignore | 484 ++++++++++++++++++ .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 21 + .../.openapi-generator/VERSION | 1 + .../Org.OpenAPITools.sln | 25 + .../README.md | 16 + .../Features/PetApiEndpoint.cs | 316 ++++++++++++ .../Features/PetApiRequest.cs | 97 ++++ .../Features/StoreApiEndpoint.cs | 157 ++++++ .../Features/StoreApiRequest.cs | 35 ++ .../Features/UserApiEndpoint.cs | 310 +++++++++++ .../Features/UserApiRequest.cs | 77 +++ .../Org.OpenAPITools/Models/ApiResponse.cs | 14 + .../src/Org.OpenAPITools/Models/Category.cs | 13 + .../src/Org.OpenAPITools/Models/Order.cs | 41 ++ .../src/Org.OpenAPITools/Models/Pet.cs | 41 ++ .../src/Org.OpenAPITools/Models/Tag.cs | 13 + .../src/Org.OpenAPITools/Models/User.cs | 19 + .../Org.OpenAPITools/Org.OpenAPITools.csproj | 14 + .../src/Org.OpenAPITools/Program.cs | 38 ++ .../Properties/launchSettings.json | 41 ++ .../appsettings.Development.json | 8 + .../src/Org.OpenAPITools/appsettings.json | 9 + .../fastendpoints-useValidators/.gitignore | 484 ++++++++++++++++++ .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 21 + .../.openapi-generator/VERSION | 1 + .../Org.OpenAPITools.sln | 25 + .../fastendpoints-useValidators/README.md | 16 + .../Features/PetApiEndpoint.cs | 316 ++++++++++++ .../Features/PetApiRequest.cs | 170 ++++++ .../Features/StoreApiEndpoint.cs | 157 ++++++ .../Features/StoreApiRequest.cs | 71 +++ .../Features/UserApiEndpoint.cs | 310 +++++++++++ .../Features/UserApiRequest.cs | 151 ++++++ .../Org.OpenAPITools/Models/ApiResponse.cs | 14 + .../src/Org.OpenAPITools/Models/Category.cs | 13 + .../src/Org.OpenAPITools/Models/Order.cs | 41 ++ .../src/Org.OpenAPITools/Models/Pet.cs | 41 ++ .../src/Org.OpenAPITools/Models/Tag.cs | 13 + .../src/Org.OpenAPITools/Models/User.cs | 19 + .../Org.OpenAPITools/Org.OpenAPITools.csproj | 14 + .../src/Org.OpenAPITools/Program.cs | 37 ++ .../Properties/launchSettings.json | 41 ++ .../appsettings.Development.json | 8 + .../src/Org.OpenAPITools/appsettings.json | 9 + .../petstore/aspnet/fastendpoints/.gitignore | 484 ++++++++++++++++++ .../fastendpoints/.openapi-generator-ignore | 23 + .../fastendpoints/.openapi-generator/FILES | 21 + .../fastendpoints/.openapi-generator/VERSION | 1 + .../aspnet/fastendpoints/Org.OpenAPITools.sln | 25 + .../petstore/aspnet/fastendpoints/README.md | 16 + .../Features/PetApiEndpoint.cs | 316 ++++++++++++ .../Features/PetApiRequest.cs | 97 ++++ .../Features/StoreApiEndpoint.cs | 157 ++++++ .../Features/StoreApiRequest.cs | 35 ++ .../Features/UserApiEndpoint.cs | 310 +++++++++++ .../Features/UserApiRequest.cs | 77 +++ .../Org.OpenAPITools/Models/ApiResponse.cs | 14 + .../src/Org.OpenAPITools/Models/Category.cs | 13 + .../src/Org.OpenAPITools/Models/Order.cs | 41 ++ .../src/Org.OpenAPITools/Models/Pet.cs | 41 ++ .../src/Org.OpenAPITools/Models/Tag.cs | 13 + .../src/Org.OpenAPITools/Models/User.cs | 19 + .../Org.OpenAPITools/Org.OpenAPITools.csproj | 14 + .../src/Org.OpenAPITools/Program.cs | 37 ++ .../Properties/launchSettings.json | 41 ++ .../appsettings.Development.json | 8 + .../src/Org.OpenAPITools/appsettings.json | 9 + 196 files changed, 14406 insertions(+) create mode 100644 .github/workflows/samples-aspnet-fastenpoints-server.yaml create mode 100644 bin/configs/aspnet-fastendpoints-useApiVersioning.yaml create mode 100644 bin/configs/aspnet-fastendpoints-useAuthentication.yaml create mode 100644 bin/configs/aspnet-fastendpoints-useProblemDetails.yaml create mode 100644 bin/configs/aspnet-fastendpoints-useRecords.yaml create mode 100644 bin/configs/aspnet-fastendpoints-useResponseCaching.yaml create mode 100644 bin/configs/aspnet-fastendpoints-useValidators.yaml create mode 100644 bin/configs/aspnet-fastendpoints.yaml create mode 100644 docs/generators/aspnet-fastendpoints.md create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspnetFastendpointsServerCodegen.java create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/Properties/launchSettings.json create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/appsettings.Development.json create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/appsettings.json create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpoint.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointRequestType.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointResponseType.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointType.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/enumClass.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/gitignore create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/loginRequest.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/modelClass.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/modelRecord.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/program.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/project.csproj.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/readme.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/request.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/requestClass.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/requestRecord.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/solution.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnet-fastendpoints/userLoginEndpoint.mustache create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.gitignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator-ignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/FILES create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/VERSION create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/Org.OpenAPITools.sln create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/README.md create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/PetApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/PetApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/StoreApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/UserApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/UserApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/ApiResponse.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Category.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Order.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Pet.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Tag.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/User.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Program.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Properties/launchSettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/appsettings.Development.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/appsettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/.gitignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator-ignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/FILES create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/VERSION create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/Org.OpenAPITools.sln create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/README.md create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/LoginRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/PetApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/PetApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/StoreApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserLoginEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/ApiResponse.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Category.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Order.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Pet.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Tag.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/User.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Program.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Properties/launchSettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/appsettings.Development.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/appsettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.gitignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator-ignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/FILES create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/VERSION create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/Org.OpenAPITools.sln create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/README.md create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/PetApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/PetApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/StoreApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/UserApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/UserApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/ApiResponse.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Category.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Order.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Pet.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Tag.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/User.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Program.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Properties/launchSettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/appsettings.Development.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/appsettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/.gitignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator-ignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/FILES create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/VERSION create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/Org.OpenAPITools.sln create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/README.md create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/PetApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/PetApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/StoreApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/UserApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/UserApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/ApiResponse.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Category.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Order.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Pet.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Tag.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/User.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Program.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Properties/launchSettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/appsettings.Development.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/appsettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.gitignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator-ignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/FILES create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/VERSION create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/Org.OpenAPITools.sln create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/README.md create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/PetApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/PetApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/StoreApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/UserApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/UserApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/ApiResponse.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Category.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Order.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Pet.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Tag.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/User.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Program.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Properties/launchSettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/appsettings.Development.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/appsettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/.gitignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator-ignore create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/FILES create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/VERSION create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/Org.OpenAPITools.sln create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/README.md create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/PetApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/PetApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/StoreApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/UserApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/UserApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/ApiResponse.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Category.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Order.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Pet.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Tag.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/User.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Program.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Properties/launchSettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/appsettings.Development.json create mode 100644 samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/appsettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints/.gitignore create mode 100644 samples/server/petstore/aspnet/fastendpoints/.openapi-generator-ignore create mode 100644 samples/server/petstore/aspnet/fastendpoints/.openapi-generator/FILES create mode 100644 samples/server/petstore/aspnet/fastendpoints/.openapi-generator/VERSION create mode 100644 samples/server/petstore/aspnet/fastendpoints/Org.OpenAPITools.sln create mode 100644 samples/server/petstore/aspnet/fastendpoints/README.md create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/PetApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/PetApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/StoreApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/UserApiEndpoint.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/UserApiRequest.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/ApiResponse.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Category.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Order.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Pet.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Tag.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/User.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Program.cs create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Properties/launchSettings.json create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/appsettings.Development.json create mode 100644 samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/appsettings.json diff --git a/.github/workflows/samples-aspnet-fastenpoints-server.yaml b/.github/workflows/samples-aspnet-fastenpoints-server.yaml new file mode 100644 index 000000000000..6f7890a0e213 --- /dev/null +++ b/.github/workflows/samples-aspnet-fastenpoints-server.yaml @@ -0,0 +1,34 @@ +name: Samples C# .Net 8 FastEndpoints Server + +on: + push: + paths: + - samples/server/petstore/aspnet/fastendpoints/** + - samples/server/petstore/aspnet/fastendpoints-*/** + pull_request: + paths: + - samples/server/petstore/aspnet/fastendpoints/** + - samples/server/petstore/aspnet/fastendpoints-*/** +jobs: + build: + name: Build .Net 8 FastEndpoints servers + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sample: + - samples/server/petstore/aspnet/fastendpoints + - samples/server/petstore/aspnet/fastendpoints-useApiVersioning + - samples/server/petstore/aspnet/fastendpoints-useAuthentication + - samples/server/petstore/aspnet/fastendpoints-useProblemDetails + - samples/server/petstore/aspnet/fastendpoints-useRecords + - samples/server/petstore/aspnet/fastendpoints-useResponseCaching + - samples/server/petstore/aspnet/fastendpoints-useValidators + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4.0.1 + with: + dotnet-version: '8.0.x' + - name: Build + working-directory: ${{ matrix.sample }} + run: dotnet build Org.OpenAPITools.sln diff --git a/bin/configs/aspnet-fastendpoints-useApiVersioning.yaml b/bin/configs/aspnet-fastendpoints-useApiVersioning.yaml new file mode 100644 index 000000000000..1872150639a8 --- /dev/null +++ b/bin/configs/aspnet-fastendpoints-useApiVersioning.yaml @@ -0,0 +1,16 @@ +generatorName: aspnet-fastendpoints +outputDir: samples/server/petstore/aspnet/fastendpoints-useApiVersioning +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/aspnet-fastendpoints +additionalProperties: + hideGenerationTimestamp: "true" + useProblemDetails: "false" + useRecords: "false" + useAuthentication: "false" + useValidators: "false" + useResponseCaching: "false" + useApiVersioning: "true" + routePrefix: "api" + versionPrefix: "v" + solutionGuid: "{1EC59EB0-DA5B-40C0-8E49-A3E0829DBBFC}" + projectConfigurationGuid: "{9685C490-9B77-4EE2-BE4D-811F52665E8F}" \ No newline at end of file diff --git a/bin/configs/aspnet-fastendpoints-useAuthentication.yaml b/bin/configs/aspnet-fastendpoints-useAuthentication.yaml new file mode 100644 index 000000000000..6206b5602ce9 --- /dev/null +++ b/bin/configs/aspnet-fastendpoints-useAuthentication.yaml @@ -0,0 +1,16 @@ +generatorName: aspnet-fastendpoints +outputDir: samples/server/petstore/aspnet/fastendpoints-useAuthentication +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/aspnet-fastendpoints +additionalProperties: + hideGenerationTimestamp: "true" + useProblemDetails: "false" + useRecords: "false" + useAuthentication: "true" + useValidators: "false" + useResponseCaching: "false" + useApiVersioning: "false" + routePrefix: "api" + versionPrefix: "v" + solutionGuid: "{10D45F9B-F270-480C-9DA9-720AA62526A4}" + projectConfigurationGuid: "{3FA19D58-AE7C-45E5-B00E-7482026D1816}" \ No newline at end of file diff --git a/bin/configs/aspnet-fastendpoints-useProblemDetails.yaml b/bin/configs/aspnet-fastendpoints-useProblemDetails.yaml new file mode 100644 index 000000000000..6c3aacf5a644 --- /dev/null +++ b/bin/configs/aspnet-fastendpoints-useProblemDetails.yaml @@ -0,0 +1,16 @@ +generatorName: aspnet-fastendpoints +outputDir: samples/server/petstore/aspnet/fastendpoints-useProblemDetails +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/aspnet-fastendpoints +additionalProperties: + hideGenerationTimestamp: "true" + useProblemDetails: "true" + useRecords: "false" + useAuthentication: "false" + useValidators: "false" + useResponseCaching: "false" + useApiVersioning: "false" + routePrefix: "api" + versionPrefix: "v" + solutionGuid: "{EA9B735E-72CA-44C4-BB28-358BDECE60C8}" + projectConfigurationGuid: "{74D68BAC-36F5-43FC-BE9A-F3E660EECF5D}" \ No newline at end of file diff --git a/bin/configs/aspnet-fastendpoints-useRecords.yaml b/bin/configs/aspnet-fastendpoints-useRecords.yaml new file mode 100644 index 000000000000..cd903058dde6 --- /dev/null +++ b/bin/configs/aspnet-fastendpoints-useRecords.yaml @@ -0,0 +1,16 @@ +generatorName: aspnet-fastendpoints +outputDir: samples/server/petstore/aspnet/fastendpoints-useRecords +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/aspnet-fastendpoints +additionalProperties: + hideGenerationTimestamp: "true" + useProblemDetails: "false" + useRecords: "true" + useAuthentication: "false" + useValidators: "false" + useResponseCaching: "false" + useApiVersioning: "false" + routePrefix: "api" + versionPrefix: "v" + solutionGuid: "{C5D2BEB0-AB74-433F-BC14-DA66CAC82C10}" + projectConfigurationGuid: "{D465FD3B-3146-4661-BB50-522608AA3967}" \ No newline at end of file diff --git a/bin/configs/aspnet-fastendpoints-useResponseCaching.yaml b/bin/configs/aspnet-fastendpoints-useResponseCaching.yaml new file mode 100644 index 000000000000..0887cf8ab521 --- /dev/null +++ b/bin/configs/aspnet-fastendpoints-useResponseCaching.yaml @@ -0,0 +1,16 @@ +generatorName: aspnet-fastendpoints +outputDir: samples/server/petstore/aspnet/fastendpoints-useResponseCaching +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/aspnet-fastendpoints +additionalProperties: + hideGenerationTimestamp: "true" + useProblemDetails: "false" + useRecords: "false" + useAuthentication: "false" + useValidators: "false" + useResponseCaching: "true" + useApiVersioning: "false" + routePrefix: "api" + versionPrefix: "v" + solutionGuid: "{BC56C2A3-ACC5-4ED0-AD8F-CD1831B8A467}" + projectConfigurationGuid: "{5D19ACAB-8830-47FD-BAFA-C0985DF9F5F3}" \ No newline at end of file diff --git a/bin/configs/aspnet-fastendpoints-useValidators.yaml b/bin/configs/aspnet-fastendpoints-useValidators.yaml new file mode 100644 index 000000000000..60f4dd5fc71c --- /dev/null +++ b/bin/configs/aspnet-fastendpoints-useValidators.yaml @@ -0,0 +1,16 @@ +generatorName: aspnet-fastendpoints +outputDir: samples/server/petstore/aspnet/fastendpoints-useValidators +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/aspnet-fastendpoints +additionalProperties: + hideGenerationTimestamp: "true" + useProblemDetails: "false" + useRecords: "false" + useAuthentication: "false" + useValidators: "true" + useResponseCaching: "false" + useApiVersioning: "false" + routePrefix: "api" + versionPrefix: "v" + solutionGuid: "{C7818EE1-09E2-4349-9696-8B1A9119974A}" + projectConfigurationGuid: "{39B801D8-74AA-465D-A637-4A2FFB905378}" \ No newline at end of file diff --git a/bin/configs/aspnet-fastendpoints.yaml b/bin/configs/aspnet-fastendpoints.yaml new file mode 100644 index 000000000000..34e5465f0c30 --- /dev/null +++ b/bin/configs/aspnet-fastendpoints.yaml @@ -0,0 +1,16 @@ +generatorName: aspnet-fastendpoints +outputDir: samples/server/petstore/aspnet/fastendpoints +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/aspnet-fastendpoints +additionalProperties: + hideGenerationTimestamp: "true" + useProblemDetails: "false" + useRecords: "false" + useAuthentication: "false" + useValidators: "false" + useResponseCaching: "false" + useApiVersioning: "false" + routePrefix: "api" + versionPrefix: "v" + solutionGuid: "{4BC03566-F5F9-4E45-A835-8FA3B2B524B9}" + projectConfigurationGuid: "{5F32A09C-5CB7-4917-83AB-CD7D1A04FF49}" \ No newline at end of file diff --git a/docs/generators.md b/docs/generators.md index eea91149e51c..d020898328d1 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -84,6 +84,7 @@ The following generators are available: ## SERVER generators * [ada-server](generators/ada-server.md) +* [aspnet-fastendpoints](generators/aspnet-fastendpoints.md) * [aspnetcore](generators/aspnetcore.md) * [cpp-pistache-server](generators/cpp-pistache-server.md) * [cpp-qt-qhttpengine-server](generators/cpp-qt-qhttpengine-server.md) diff --git a/docs/generators/aspnet-fastendpoints.md b/docs/generators/aspnet-fastendpoints.md new file mode 100644 index 000000000000..75a31639bdba --- /dev/null +++ b/docs/generators/aspnet-fastendpoints.md @@ -0,0 +1,321 @@ +--- +title: Documentation for the aspnet-fastendpoints Generator +--- + +## METADATA + +| Property | Value | Notes | +| -------- | ----- | ----- | +| generator name | aspnet-fastendpoints | pass this to the generate command after -g | +| generator stability | STABLE | | +| generator type | SERVER | | +| generator language | C# | | +| generator default templating engine | mustache | | +| helpTxt | Generates a server for FastEndpoints (https://fast-endpoints.com/). | | + +## CONFIG OPTIONS +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| +|apiVersion|The version of the API. Used only if useApiVersioning is true| |1| +|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| +|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| +|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|projectConfigurationGuid|The project configuration GUID to be used in the solution file (auto generated if not provided)| |null| +|routePrefix|The route prefix for the API. Used only if useApiVersioning is true| |api| +|solutionGuid|The solution GUID to be used in the solution file (auto generated if not provided)| |null| +|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| +|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| +|useApiVersioning|Enable API versioning (https://fast-endpoints.com/docs/api-versioning).| |false| +|useAuthentication|Enable authentication (https://fast-endpoints.com/docs/security).| |false| +|useProblemDetails|Enable RFC compatible error responses (https://fast-endpoints.com/docs/configuration-settings#rfc7807-rfc9457-compatible-problem-details).| |false| +|useRecords|Use record instead of class for the requests and response.| |false| +|useResponseCaching|Enable response caching (https://fast-endpoints.com/docs/response-caching).| |false| +|useValidators|Enable request validators (https://fast-endpoints.com/docs/validation).| |false| +|versioningPrefix|The versioning prefix for the API. Used only if useApiVersioning is true| |v| + +## IMPORT MAPPING + +| Type/Alias | Imports | +| ---------- | ------- | + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | +|array|List| +|list|List| +|map|Dictionary| + + +## LANGUAGE PRIMITIVES + +
    +
  • Boolean
  • +
  • Collection
  • +
  • DateOnly
  • +
  • DateOnly?
  • +
  • DateTime
  • +
  • DateTime?
  • +
  • DateTimeOffset
  • +
  • DateTimeOffset?
  • +
  • Decimal
  • +
  • Dictionary
  • +
  • Double
  • +
  • Float
  • +
  • Guid
  • +
  • Guid?
  • +
  • ICollection
  • +
  • Int32
  • +
  • Int64
  • +
  • List
  • +
  • Object
  • +
  • String
  • +
  • System.IO.Stream
  • +
  • bool
  • +
  • bool?
  • +
  • byte[]
  • +
  • decimal
  • +
  • decimal?
  • +
  • double
  • +
  • double?
  • +
  • float
  • +
  • float?
  • +
  • int
  • +
  • int?
  • +
  • long
  • +
  • long?
  • +
  • string
  • +
  • uint
  • +
  • uint?
  • +
  • ulong
  • +
  • ulong?
  • +
+ +## RESERVED WORDS + +
    +
  • Client
  • +
  • Configuration
  • +
  • Environment
  • +
  • OperatingSystem
  • +
  • TimeZone
  • +
  • Version
  • +
  • abstract
  • +
  • as
  • +
  • base
  • +
  • bool
  • +
  • break
  • +
  • byte
  • +
  • case
  • +
  • catch
  • +
  • char
  • +
  • checked
  • +
  • class
  • +
  • client
  • +
  • const
  • +
  • continue
  • +
  • decimal
  • +
  • default
  • +
  • delegate
  • +
  • do
  • +
  • double
  • +
  • else
  • +
  • enum
  • +
  • event
  • +
  • explicit
  • +
  • extern
  • +
  • false
  • +
  • finally
  • +
  • fixed
  • +
  • float
  • +
  • for
  • +
  • foreach
  • +
  • goto
  • +
  • if
  • +
  • implicit
  • +
  • in
  • +
  • int
  • +
  • interface
  • +
  • internal
  • +
  • is
  • +
  • localVarFileParams
  • +
  • localVarFormParams
  • +
  • localVarHeaderParams
  • +
  • localVarHttpContentType
  • +
  • localVarHttpContentTypes
  • +
  • localVarHttpHeaderAccept
  • +
  • localVarHttpHeaderAccepts
  • +
  • localVarPath
  • +
  • localVarPathParams
  • +
  • localVarPostBody
  • +
  • localVarQueryParams
  • +
  • localVarResponse
  • +
  • localVarStatusCode
  • +
  • lock
  • +
  • long
  • +
  • namespace
  • +
  • new
  • +
  • null
  • +
  • object
  • +
  • operator
  • +
  • out
  • +
  • override
  • +
  • parameter
  • +
  • params
  • +
  • private
  • +
  • protected
  • +
  • public
  • +
  • readonly
  • +
  • ref
  • +
  • return
  • +
  • sbyte
  • +
  • sealed
  • +
  • short
  • +
  • sizeof
  • +
  • stackalloc
  • +
  • static
  • +
  • string
  • +
  • struct
  • +
  • switch
  • +
  • system
  • +
  • this
  • +
  • throw
  • +
  • true
  • +
  • try
  • +
  • typeof
  • +
  • uint
  • +
  • ulong
  • +
  • unchecked
  • +
  • unsafe
  • +
  • ushort
  • +
  • using
  • +
  • virtual
  • +
  • void
  • +
  • volatile
  • +
  • while
  • +
+ +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✗|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✗|ToolingExtension +|MockServer|✗|ToolingExtension + +### Data Type Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Custom|✗|OAS2,OAS3 +|Int32|✓|OAS2,OAS3 +|Int64|✓|OAS2,OAS3 +|Float|✓|OAS2,OAS3 +|Double|✓|OAS2,OAS3 +|Decimal|✓|ToolingExtension +|String|✓|OAS2,OAS3 +|Byte|✓|OAS2,OAS3 +|Binary|✓|OAS2,OAS3 +|Boolean|✓|OAS2,OAS3 +|Date|✓|OAS2,OAS3 +|DateTime|✓|OAS2,OAS3 +|Password|✓|OAS2,OAS3 +|File|✓|OAS2 +|Uuid|✗| +|Array|✓|OAS2,OAS3 +|Null|✗|OAS3 +|AnyType|✗|OAS2,OAS3 +|Object|✓|OAS2,OAS3 +|Maps|✓|ToolingExtension +|CollectionFormat|✓|OAS2 +|CollectionFormatMulti|✓|OAS2 +|Enum|✓|OAS2,OAS3 +|ArrayOfEnum|✓|ToolingExtension +|ArrayOfModel|✓|ToolingExtension +|ArrayOfCollectionOfPrimitives|✓|ToolingExtension +|ArrayOfCollectionOfModel|✓|ToolingExtension +|ArrayOfCollectionOfEnum|✓|ToolingExtension +|MapOfEnum|✓|ToolingExtension +|MapOfModel|✓|ToolingExtension +|MapOfCollectionOfPrimitives|✓|ToolingExtension +|MapOfCollectionOfModel|✓|ToolingExtension +|MapOfCollectionOfEnum|✓|ToolingExtension + +### Documentation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Readme|✗|ToolingExtension +|Model|✓|ToolingExtension +|Api|✓|ToolingExtension + +### Global Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Host|✓|OAS2,OAS3 +|BasePath|✓|OAS2,OAS3 +|Info|✓|OAS2,OAS3 +|Schemes|✗|OAS2,OAS3 +|PartialSchemes|✓|OAS2,OAS3 +|Consumes|✓|OAS2 +|Produces|✓|OAS2 +|ExternalDocumentation|✓|OAS2,OAS3 +|Examples|✓|OAS2,OAS3 +|XMLStructureDefinitions|✗|OAS2,OAS3 +|MultiServer|✗|OAS3 +|ParameterizedServer|✗|OAS3 +|ParameterStyling|✗|OAS3 +|Callbacks|✓|OAS3 +|LinkObjects|✗|OAS3 + +### Parameter Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Path|✓|OAS2,OAS3 +|Query|✓|OAS2,OAS3 +|Header|✓|OAS2,OAS3 +|Body|✓|OAS2 +|FormUnencoded|✓|OAS2 +|FormMultipart|✓|OAS2 +|Cookie|✓|OAS3 + +### Schema Support Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Simple|✓|OAS2,OAS3 +|Composite|✓|OAS2,OAS3 +|Polymorphism|✓|OAS2,OAS3 +|Union|✗|OAS3 +|allOf|✗|OAS2,OAS3 +|anyOf|✗|OAS3 +|oneOf|✗|OAS3 +|not|✗|OAS3 + +### Security Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 +|OpenIDConnect|✗|OAS3 +|BearerToken|✓|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 +|OAuth2_Password|✓|OAS2,OAS3 +|OAuth2_ClientCredentials|✓|OAS2,OAS3 +|OAuth2_AuthorizationCode|✓|OAS2,OAS3 +|SignatureAuth|✗|OAS3 +|AWSV4Signature|✗|ToolingExtension + +### Wire Format Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|JSON|✓|OAS2,OAS3 +|XML|✓|OAS2,OAS3 +|PROTOBUF|✗|ToolingExtension +|Custom|✗|OAS2,OAS3 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspnetFastendpointsServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspnetFastendpointsServerCodegen.java new file mode 100644 index 000000000000..2e4eb0e19a91 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspnetFastendpointsServerCodegen.java @@ -0,0 +1,220 @@ +package org.openapitools.codegen.languages; + +import org.openapitools.codegen.*; + +import java.io.File; +import java.util.*; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static java.util.UUID.randomUUID; + +public class AspnetFastendpointsServerCodegen extends AbstractCSharpCodegen implements CodegenConfig { + + public static final String PROJECT_NAME = "projectName"; + public static final String USE_PROBLEM_DETAILS = "useProblemDetails"; + public static final String USE_RECORDS = "useRecords"; + public static final String USE_AUTHENTICATION = "useAuthentication"; + public static final String USE_VALIDATORS = "useValidators"; + public static final String USE_RESPONSE_CACHING = "useResponseCaching"; + public static final String USE_API_VERSIONING = "useApiVersioning"; + public static final String ROUTE_PREFIX = "routePrefix"; + public static final String VERSIONING_PREFIX = "versioningPrefix"; + public static final String API_VERSION = "apiVersion"; + public static final String SOLUTION_GUID = "solutionGuid"; + public static final String PROJECT_CONFIGURATION_GUID = "projectConfigurationGuid"; + + private final Logger LOGGER = LoggerFactory.getLogger(AspnetFastendpointsServerCodegen.class); + + private boolean useProblemDetails = false; + private boolean useRecords = false; + private boolean useAuthentication = false; + private boolean useValidators = false; + private boolean useResponseCaching = false; + private boolean useApiVersioning = false; + private String routePrefix = "api"; + private String versioningPrefix = "v"; + private String apiVersion = "1"; + private String solutionGuid = null; + private String projectConfigurationGuid = null; + + + public CodegenType getTag() { + return CodegenType.SERVER; + } + + public String getName() { + return "aspnet-fastendpoints"; + } + + public String getHelp() { + return "Generates a server for FastEndpoints (https://fast-endpoints.com/)."; + } + + public AspnetFastendpointsServerCodegen() { + super(); + + outputFolder = "generated-code" + File.separator + "aspnet-fastendpoints"; + + embeddedTemplateDir = templateDir = "aspnet-fastendpoints"; + + modelTemplateFiles.put("model.mustache", ".cs"); + apiTemplateFiles.put("endpoint.mustache", "Endpoint.cs"); + apiTemplateFiles.put("request.mustache", "Request.cs"); + + addSwitch(USE_PROBLEM_DETAILS, "Enable RFC compatible error responses (https://fast-endpoints.com/docs/configuration-settings#rfc7807-rfc9457-compatible-problem-details).", useProblemDetails); + addSwitch(USE_RECORDS, "Use record instead of class for the requests and response.", useRecords); + addSwitch(USE_AUTHENTICATION, "Enable authentication (https://fast-endpoints.com/docs/security).", useAuthentication); + addSwitch(USE_VALIDATORS, "Enable request validators (https://fast-endpoints.com/docs/validation).", useValidators); + addSwitch(USE_RESPONSE_CACHING, "Enable response caching (https://fast-endpoints.com/docs/response-caching).", useResponseCaching); + addSwitch(USE_API_VERSIONING, "Enable API versioning (https://fast-endpoints.com/docs/api-versioning).", useApiVersioning); + addOption(ROUTE_PREFIX, "The route prefix for the API. Used only if useApiVersioning is true", routePrefix); + addOption(VERSIONING_PREFIX, "The versioning prefix for the API. Used only if useApiVersioning is true", versioningPrefix); + addOption(API_VERSION, "The version of the API. Used only if useApiVersioning is true", apiVersion); + addOption(SOLUTION_GUID, "The solution GUID to be used in the solution file (auto generated if not provided)", solutionGuid); + addOption(PROJECT_CONFIGURATION_GUID, "The project configuration GUID to be used in the solution file (auto generated if not provided)", projectConfigurationGuid); + } + + @Override + public void processOpts() { + + setPackageDescription(openAPI.getInfo().getDescription()); + + setUseProblemDetails(); + setUseRecordForRequest(); + setUseAuthentication(); + setUseValidators(); + setUseResponseCaching(); + setUseApiVersioning(); + setRoutePrefix(); + setVersioningPrefix(); + setApiVersion(); + setSolutionGuid(); + setProjectConfigurationGuid(); + + super.processOpts(); + + addSupportingFiles(); + } + + private void addSupportingFiles() { + apiPackage = "Features"; + modelPackage = "Models"; + String packageFolder = sourceFolder + File.separator + packageName; + + if(useAuthentication) { + supportingFiles.add(new SupportingFile("loginRequest.mustache", packageFolder + File.separator + apiPackage, "LoginRequest.cs")); + supportingFiles.add(new SupportingFile("userLoginEndpoint.mustache", packageFolder + File.separator + apiPackage, "UserLoginEndpoint.cs")); + } + + supportingFiles.add(new SupportingFile("readme.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); + supportingFiles.add(new SupportingFile("solution.mustache", "", packageName + ".sln")); + supportingFiles.add(new SupportingFile("project.csproj.mustache", packageFolder, packageName + ".csproj")); + supportingFiles.add(new SupportingFile("Properties" + File.separator + "launchSettings.json", packageFolder + File.separator + "Properties", "launchSettings.json")); + + supportingFiles.add(new SupportingFile("appsettings.json", packageFolder, "appsettings.json")); + supportingFiles.add(new SupportingFile("appsettings.Development.json", packageFolder, "appsettings.Development.json")); + + supportingFiles.add(new SupportingFile("program.mustache", packageFolder, "Program.cs")); + } + + @Override + protected void processOperation(CodegenOperation operation) { + super.processOperation(operation); + + // Converts, for example, PUT to Put for endpoint configuration + operation.httpMethod = operation.httpMethod.charAt(0) + operation.httpMethod.substring(1).toLowerCase(Locale.ROOT); + } + + private void setUseProblemDetails() { + if (additionalProperties.containsKey(USE_PROBLEM_DETAILS)) { + useProblemDetails = convertPropertyToBooleanAndWriteBack(USE_PROBLEM_DETAILS); + } else { + additionalProperties.put(USE_PROBLEM_DETAILS, useProblemDetails); + } + } + + private void setUseRecordForRequest() { + if (additionalProperties.containsKey(USE_RECORDS)) { + useRecords = convertPropertyToBooleanAndWriteBack(USE_RECORDS); + } else { + additionalProperties.put(USE_RECORDS, useRecords); + } + } + + private void setUseAuthentication() { + if (additionalProperties.containsKey(USE_AUTHENTICATION)) { + useAuthentication = convertPropertyToBooleanAndWriteBack(USE_AUTHENTICATION); + } else { + additionalProperties.put(USE_AUTHENTICATION, useAuthentication); + } + } + + private void setUseValidators() { + if (additionalProperties.containsKey(USE_VALIDATORS)) { + useValidators = convertPropertyToBooleanAndWriteBack(USE_VALIDATORS); + } else { + additionalProperties.put(USE_VALIDATORS, useValidators); + } + } + + private void setUseResponseCaching() { + if (additionalProperties.containsKey(USE_RESPONSE_CACHING)) { + useResponseCaching = convertPropertyToBooleanAndWriteBack(USE_RESPONSE_CACHING); + } else { + additionalProperties.put(USE_RESPONSE_CACHING, useResponseCaching); + } + } + + private void setUseApiVersioning() { + if (additionalProperties.containsKey(USE_API_VERSIONING)) { + useApiVersioning = convertPropertyToBooleanAndWriteBack(USE_API_VERSIONING); + } else { + additionalProperties.put(USE_API_VERSIONING, useApiVersioning); + } + } + + private void setRoutePrefix() { + if (additionalProperties.containsKey(ROUTE_PREFIX)) { + routePrefix = (String) additionalProperties.get(ROUTE_PREFIX); + } else { + additionalProperties.put(ROUTE_PREFIX, routePrefix); + } + } + + private void setVersioningPrefix() { + if (additionalProperties.containsKey(VERSIONING_PREFIX)) { + versioningPrefix = (String) additionalProperties.get(VERSIONING_PREFIX); + } else { + additionalProperties.put(VERSIONING_PREFIX, versioningPrefix); + } + } + + private void setApiVersion() { + if (additionalProperties.containsKey(API_VERSION)) { + apiVersion = (String) additionalProperties.get(API_VERSION); + } else { + additionalProperties.put(API_VERSION, apiVersion); + } + } + + private void setSolutionGuid() { + if (additionalProperties.containsKey(SOLUTION_GUID)) { + solutionGuid = (String) additionalProperties.get(SOLUTION_GUID); + } else { + solutionGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}"; + additionalProperties.put(SOLUTION_GUID, solutionGuid); + } + } + + private void setProjectConfigurationGuid() { + if (additionalProperties.containsKey(PROJECT_CONFIGURATION_GUID)) { + projectConfigurationGuid = (String) additionalProperties.get(PROJECT_CONFIGURATION_GUID); + } else { + projectConfigurationGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}"; + additionalProperties.put(PROJECT_CONFIGURATION_GUID, projectConfigurationGuid); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig index 2f8c6c6074c2..c29f01b9e6a1 100644 --- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig +++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig @@ -4,6 +4,7 @@ org.openapitools.codegen.languages.AndroidClientCodegen org.openapitools.codegen.languages.Apache2ConfigCodegen org.openapitools.codegen.languages.ApexClientCodegen org.openapitools.codegen.languages.AsciidocDocumentationCodegen +org.openapitools.codegen.languages.AspnetFastendpointsServerCodegen org.openapitools.codegen.languages.AspNetServerCodegen org.openapitools.codegen.languages.AvroSchemaCodegen org.openapitools.codegen.languages.BashClientCodegen diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/Properties/launchSettings.json b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/Properties/launchSettings.json new file mode 100644 index 000000000000..5b816a8d6069 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52621", + "sslPort": 44314 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7047;http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/appsettings.Development.json b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/appsettings.Development.json new file mode 100644 index 000000000000..b0bacf42851f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/appsettings.json b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/appsettings.json new file mode 100644 index 000000000000..223027717b49 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpoint.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpoint.mustache new file mode 100644 index 000000000000..ee89de7c32b7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpoint.mustache @@ -0,0 +1,50 @@ +using {{packageName}}.Models; + +namespace {{packageName}}.{{apiPackage}}; + +{{#operations}} + + {{#operation}} + +/// +/// {{summary}} +/// +{{#isDeprecated}}[Obsolete]{{/isDeprecated}} +public class {{operationId}}Endpoint : {{>endpointType}}{{>endpointRequestType}}{{>endpointResponseType}} +{ + public override void Configure() + { + {{httpMethod}}("{{{basePathWithoutHost}}}{{{path}}}"); + {{#useApiVersioning}}Version({{apiVersion}});{{/useApiVersioning}} + {{#useResponseCaching}}ResponseCache(60);{{/useResponseCaching}} + {{^useAuthentication}}AllowAnonymous();{{/useAuthentication}}{{#useAuthentication}}//TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization{{/useAuthentication}} + {{#allParams}}{{#isFile}}AllowFileUploads();{{/isFile}}{{/allParams}} + Description(x => + { + x.WithTags("{{#tags}}{{name}}{{/tags}}");{{#responses}}{{^is2xx}} + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblem{{#useProblemDetails}}Details{{/useProblemDetails}}{{^useProblemDetails}}FE{{/useProblemDetails}}(x, {{code}});{{/is2xx}}{{/responses}} + }); + + Summary(s => { + s.Summary = "{{summary}}"; + {{#allParams}} + s.RequestParam(r => r.{{#isBodyParam}}{{paramName}}{{/isBodyParam}}{{^isBodyParam}}{{nameInPascalCase}}{{/isBodyParam}}, "{{description}}"); + {{/allParams}} + {{#responses}} + s.Responses[{{code}}] = "{{message}}"; + {{/responses}} + }); + } + + public override async Task HandleAsync({{#allParams}}{{#-first}}{{operationId}}Request req, {{/-first}}{{/allParams}}CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + {{/operation}} +{{/operations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointRequestType.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointRequestType.mustache new file mode 100644 index 000000000000..4d85b7f0c42d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointRequestType.mustache @@ -0,0 +1 @@ +{{#allParams}}{{#-first}}<{{operationId}}Request{{#returnType}}, {{/returnType}}{{^returnType}}>{{/returnType}}{{/-first}}{{/allParams}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointResponseType.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointResponseType.mustache new file mode 100644 index 000000000000..5007ef919881 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointResponseType.mustache @@ -0,0 +1 @@ +{{#returnType}}{{#allParams}}{{/allParams}}{{^allParams}}<{{/allParams}}{{#returnTypeIsPrimitive}}{{&returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}{{#generateModelDocs}}{{&returnType}}{{/generateModelDocs}}{{^generateModelDocs}}{{&returnType}}{{/generateModelDocs}}{{/returnTypeIsPrimitive}}>{{/returnType}}{{^returnType}}{{/returnType}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointType.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointType.mustache new file mode 100644 index 000000000000..f46725fb6d62 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/endpointType.mustache @@ -0,0 +1 @@ +{{#allParams}}{{#-first}}FastEndpoints.Endpoint{{/-first}}{{/allParams}}{{^allParams}}FastEndpoints.EndpointWithoutRequest{{/allParams}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/enumClass.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/enumClass.mustache new file mode 100644 index 000000000000..c5d6a235dbef --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/enumClass.mustache @@ -0,0 +1,16 @@ + + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{{description}}} + /// + {{#description}} + /// {{{.}}} + {{/description}} + public enum {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} + { + {{#allowableValues}}{{#enumVars}} + /// + /// Enum {{name}} for {{{value}}} + /// + {{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}}, + {{/-last}}{{/enumVars}}{{/allowableValues}} + } diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/gitignore b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/gitignore new file mode 100644 index 000000000000..104b54414e4d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/gitignore @@ -0,0 +1,484 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from `dotnet new gitignore` + +# dotenv files +.env + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.idea + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/loginRequest.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/loginRequest.mustache new file mode 100644 index 000000000000..95b51e6b221e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/loginRequest.mustache @@ -0,0 +1,15 @@ +{{#useAuthentication}} + +namespace {{packageName}}.{{apiPackage}}; + +{{#useRecords}} +public record LoginRequest(string Username, string Password); +{{/useRecords}} +{{^useRecords}} +public class LoginRequest +{ + public string Username { get; set; } + public string Password { get; set; } +} +{{/useRecords}} +{{/useAuthentication}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/model.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/model.mustache new file mode 100644 index 000000000000..8ef5cf8748e5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/model.mustache @@ -0,0 +1,10 @@ +{{#models}} + {{#model}} +namespace {{packageName}}.{{modelPackage}}; +{{#isEnum}}{{>enumClass}}{{/isEnum}}{{^isEnum}} +{{#useRecords}}{{>modelRecord}}{{/useRecords}} +{{^useRecords}}{{>modelClass}}{{/useRecords}} + +{{/isEnum}} + {{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/modelClass.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/modelClass.mustache new file mode 100644 index 000000000000..7430ab227509 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/modelClass.mustache @@ -0,0 +1,16 @@ +/// +/// {{description}} +/// +public class {{classname}} {{#parent}}: {{{.}}}{{/parent}} +{ +{{#vars}} + {{#isEnum}}{{^complexType}}{{>enumClass}}{{/complexType}} +{{/isEnum}} +{{#isEnum}} + public {{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}} {{name}} { get; set; }{{#defaultValue}} = {{{.}}};{{/defaultValue}} +{{/isEnum}} +{{^isEnum}} +public {{{dataType}}}{{#nullableReferenceTypes}}{{^isContainer}}{{^required}}{{^isNullable}}?{{/isNullable}}{{/required}}{{/isContainer}}{{/nullableReferenceTypes}} {{name}} { get; set; }{{#defaultValue}} = {{{.}}};{{/defaultValue}} +{{/isEnum}} +{{/vars}} +} diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/modelRecord.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/modelRecord.mustache new file mode 100644 index 000000000000..6a426d097b60 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/modelRecord.mustache @@ -0,0 +1,13 @@ +/// +/// {{description}} +/// +public record {{classname}}({{#requiredVars}}{{#isEnum}}{{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isEnum}}{{^isEnum}}{{{dataType}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isEnum}}{{^-last}},{{/-last}}{{/requiredVars}}) {{#parent}}: {{{.}}}{{/parent}} +{ +{{#optionalVars}} + public {{#isEnum}}{{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}} {{name}} {get; init; }{{#defaultValue}} = {{{.}}};{{/defaultValue}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}}?{{/isNullable}} {{name}} {get; init; }{{#defaultValue}} = {{{.}}};{{/defaultValue}}{{/isEnum}} +{{/optionalVars}} +{{#vars}} + {{#isEnum}}{{^complexType}}{{>enumClass}}{{/complexType}} +{{/isEnum}} +{{/vars}} +} diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/program.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/program.mustache new file mode 100644 index 000000000000..3d86e63ea5d7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/program.mustache @@ -0,0 +1,45 @@ +using FastEndpoints;{{#useAuthentication}} +using FastEndpoints.Security;{{/useAuthentication}} +using FastEndpoints.Swagger; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services + {{#useAuthentication}}.AddAuthenticationJwtBearer(s => s.SigningKey = "The secret used to sign tokens") //TODO set the signing key + .AddAuthorization(){{/useAuthentication}} + .AddFastEndpoints() + .SwaggerDocument(o => + { + o.DocumentSettings = s => + { + s.DocumentName = "{{{appName}}}{{^appName}}{{packageName}}{{/appName}}"; + s.Title = "{{{appName}}}{{^appName}}{{packageName}}{{/appName}}"; + s.Description = """ +{{{packageDescription}}} +"""; + s.Version = "{{{version}}}{{^version}}v1{{/version}}"; + }; + o.AutoTagPathSegmentIndex = 0; + }) + {{#useResponseCaching}}.AddResponseCaching(){{/useResponseCaching}} +; + +var app = builder.Build(); + +app + {{#useAuthentication}}.UseAuthentication() + .UseAuthorization(){{/useAuthentication}}{{#useResponseCaching}} + .UseResponseCaching(){{/useResponseCaching}} + .UseFastEndpoints(x => + { + {{#useProblemDetails}}x.Errors.UseProblemDetails();{{/useProblemDetails}} + {{#useApiVersioning}} + x.Endpoints.RoutePrefix = "{{routePrefix}}"; + x.Versioning.Prefix = "{{versioningPrefix}}"; + {{/useApiVersioning}} + }) + .UseSwaggerGen(); + +app.UseHttpsRedirection(); + +app.Run(); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/project.csproj.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/project.csproj.mustache new file mode 100644 index 000000000000..7aed6080edc7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/project.csproj.mustache @@ -0,0 +1,15 @@ + + + + net8.0 + enable + enable + + + + {{#useAuthentication}} + {{/useAuthentication}} + + + + diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/readme.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/readme.mustache new file mode 100644 index 000000000000..7bb4d6a3b70d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/readme.mustache @@ -0,0 +1,18 @@ +# {{packageName}} - FastEndpoints ASP.NET Server +{{#appDescriptionWithNewLines}} +{{{.}}} +{{/appDescriptionWithNewLines}} + +## Documentation + +This generated project include basic configuration for FastEndpoints ASP.NET Server. +For more information regarding FastEndpoints, please visit the [FastEndpoints website](https://fast-endpoints.com). + +## Enabled Features + +The following feature have been enabled in this project : +{{^useProblemDetails}}{{^useAuthentication}}{{^useValidators}}{{^useResponseCaching}}- No additional features enabled{{/useResponseCaching}}{{/useValidators}}{{/useAuthentication}}{{/useProblemDetails}} +{{#useProblemDetails}}- [Problem Details](https://fast-endpoints.com/docs/configuration-settings#rfc7807-rfc9457-compatible-problem-details){{/useProblemDetails}} +{{#useAuthentication}}- [Authentication](https://fast-endpoints.com/docs/security){{/useAuthentication}} +{{#useValidators}}- [Validation](https://fast-endpoints.com/docs/validation){{/useValidators}} +{{#useResponseCaching}}- [Response Caching](https://fast-endpoints.com/docs/response-caching){{/useResponseCaching}} diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/request.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/request.mustache new file mode 100644 index 000000000000..5dec0a656f86 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/request.mustache @@ -0,0 +1,22 @@ +{{#useValidators}}using FluentValidation;{{/useValidators}} +using {{packageName}}.Models; + +namespace {{packageName}}.{{apiPackage}}; + +{{#useRecords}}{{>requestRecord}}{{/useRecords}} +{{^useRecords}}{{>requestClass}}{{/useRecords}} + +{{#useValidators}} +{{#operations}}{{#operation}} +public class {{operationId}}RequestValidator : FastEndpoints.Validator<{{operationId}}Request> +{ + public {{operationId}}RequestValidator() + { + {{#requiredParams}} + RuleFor(x => x.{{#isBodyParam}}{{paramName}}{{/isBodyParam}}{{^isBodyParam}}{{nameInPascalCase}}{{/isBodyParam}}).NotEmpty(); + {{/requiredParams}} + } +} + +{{/operation}}{{/operations}} +{{/useValidators}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/requestClass.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/requestClass.mustache new file mode 100644 index 000000000000..1af7172fda03 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/requestClass.mustache @@ -0,0 +1,42 @@ +{{#operations}} + {{#operation}} +public class {{operationId}}Request +{ + {{#pathParams}} + /// + /// {{description}} + /// + [FastEndpoints.BindFrom("{{baseName}}")] + public {{&dataType}}{{^required}}{{#isNullable}}?{{/isNullable}}{{/required}} {{nameInPascalCase}} { get; set; } + {{/pathParams}} + {{#queryParams}} + /// + /// {{description}} + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("{{baseName}}")] + public {{&dataType}}{{^required}}{{#isNullable}}?{{/isNullable}}{{/required}} {{nameInPascalCase}} { get; set; } + {{/queryParams}} + {{#bodyParams}} + /// + /// {{description}} + /// + [FastEndpoints.FromBody] + public {{&dataType}}{{^required}}{{#isNullable}}?{{/isNullable}}{{/required}} {{paramName}} { get; set; } + {{/bodyParams}} + {{#formParams}} + /// + /// {{description}} + /// + [FastEndpoints.BindFrom("{{baseName}}")] + public {{&dataType}}{{^required}}{{#isNullable}}?{{/isNullable}}{{/required}} {{nameInPascalCase}} { get; set; } + {{/formParams}} + {{#headerParams}} + /// + /// {{description}} + /// + [FastEndpoints.FromHeader] + public {{&dataType}}{{^required}}{{#isNullable}}?{{/isNullable}}{{/required}} {{nameInPascalCase}} { get; set; } + {{/headerParams}} +} + {{/operation}} +{{/operations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/requestRecord.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/requestRecord.mustache new file mode 100644 index 000000000000..69885c8b0afd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/requestRecord.mustache @@ -0,0 +1,11 @@ +{{#operations}} +{{#operation}} +public record {{operationId}}Request({{#requiredParams}}{{#isPathParam}}[property: FastEndpoints.BindFrom("{{baseName}}")] {{&dataType}} {{nameInPascalCase}}{{/isPathParam}}{{#isQueryParam}}[property: FastEndpoints.QueryParam, FastEndpoints.BindFrom("{{baseName}}")] {{&dataType}} {{nameInPascalCase}}{{/isQueryParam}}{{#isBodyParam}}[property: FastEndpoints.FromBody] {{&dataType}} {{paramName}}{{/isBodyParam}}{{#isFormParam}}[property: FastEndpoints.BindFrom("{{baseName}}")]{{&dataType}} {{nameInPascalCase}}{{/isFormParam}}{{#isHeaderParam}}[property: FastEndpoints.FromHeader] {{&dataType}} {{nameInPascalCase}}{{/isHeaderParam}}{{^-last}}{{^isCookieParam}}, {{/isCookieParam}}{{/-last}}{{/requiredParams}}) +{ +{{#optionalParams}} + {{#isPathParam}}[FastEndpoints.BindFrom("{{baseName}}")] public {{&dataType}}{{#isNullable}}?{{/isNullable}} {{nameInPascalCase}} {get; init; }{{/isPathParam}}{{#isQueryParam}}[property: FastEndpoints.QueryParam, FastEndpoints.BindFrom("{{baseName}}")] public {{&dataType}}{{#isNullable}}?{{/isNullable}} {{nameInPascalCase}} {get; init; }{{/isQueryParam}}{{#isBodyParam}}[property: FastEndpoints.FromBody] public {{&dataType}}{{#isNullable}}?{{/isNullable}} {{paramName}} {get; init; }{{/isBodyParam}}{{#isFormParam}}[FastEndpoints.BindFrom("{{baseName}}")] public {{&dataType}}{{#isNullable}}?{{/isNullable}} {{nameInPascalCase}} {get; init; }{{/isFormParam}}{{#isHeaderParam}}[property: FastEndpoints.FromHeader] public {{&dataType}}{{#isNullable}}?{{/isNullable}} {{nameInPascalCase}} {get; init; }{{/isHeaderParam}} +{{/optionalParams}} +} + +{{/operation}} +{{/operations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/solution.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/solution.mustache new file mode 100644 index 000000000000..386501b07302 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/solution.mustache @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35122.118 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "{{packageName}}", "src\{{packageName}}\{{packageName}}.csproj", "{{projectConfigurationGuid}}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {{projectConfigurationGuid}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {{projectConfigurationGuid}}.Debug|Any CPU.Build.0 = Debug|Any CPU + {{projectConfigurationGuid}}.Release|Any CPU.ActiveCfg = Release|Any CPU + {{projectConfigurationGuid}}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {{solutionGuid}} + EndGlobalSection +EndGlobal diff --git a/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/userLoginEndpoint.mustache b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/userLoginEndpoint.mustache new file mode 100644 index 000000000000..714ed436d017 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnet-fastendpoints/userLoginEndpoint.mustache @@ -0,0 +1,46 @@ +{{#useAuthentication}} +using FastEndpoints; +using FastEndpoints.Security; + +namespace {{packageName}}.{{apiPackage}}; + +//TODO: This is a placeholder for the actual login request endpoint +// For more information : https://fast-endpoints.com/docs/security +public class UserLoginEndpoint : Endpoint +{ + public override void Configure() + { + Post("/api/login"); + AllowAnonymous(); + } + + public override async Task HandleAsync(LoginRequest req, CancellationToken ct) + { + bool credentialsAreValid = true; //TODO call your authentication service + + if (credentialsAreValid) + { + var jwtToken = JwtBearer.CreateToken( + o => + { + o.SigningKey = "A secret token signing key"; + o.ExpireAt = DateTime.UtcNow.AddDays(1); + o.User.Roles.Add("Manager", "Auditor"); + o.User.Claims.Add(("UserName", req.Username)); + o.User["UserId"] = "001"; //indexer based claim setting + }); + + await SendAsync( + new + { + req.Username, + Token = jwtToken + }); + } + else + { + ThrowError("The supplied credentials are invalid!"); + } + } +} +{{/useAuthentication}} \ No newline at end of file diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.gitignore b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.gitignore new file mode 100644 index 000000000000..104b54414e4d --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.gitignore @@ -0,0 +1,484 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from `dotnet new gitignore` + +# dotenv files +.env + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.idea + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator-ignore b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.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/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/FILES new file mode 100644 index 000000000000..a48edd621111 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/FILES @@ -0,0 +1,21 @@ +.gitignore +.openapi-generator-ignore +Org.OpenAPITools.sln +README.md +src/Org.OpenAPITools/Features/PetApiEndpoint.cs +src/Org.OpenAPITools/Features/PetApiRequest.cs +src/Org.OpenAPITools/Features/StoreApiEndpoint.cs +src/Org.OpenAPITools/Features/StoreApiRequest.cs +src/Org.OpenAPITools/Features/UserApiEndpoint.cs +src/Org.OpenAPITools/Features/UserApiRequest.cs +src/Org.OpenAPITools/Models/ApiResponse.cs +src/Org.OpenAPITools/Models/Category.cs +src/Org.OpenAPITools/Models/Order.cs +src/Org.OpenAPITools/Models/Pet.cs +src/Org.OpenAPITools/Models/Tag.cs +src/Org.OpenAPITools/Models/User.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/Program.cs +src/Org.OpenAPITools/Properties/launchSettings.json +src/Org.OpenAPITools/appsettings.Development.json +src/Org.OpenAPITools/appsettings.json diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/VERSION b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/VERSION new file mode 100644 index 000000000000..6935482704c1 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.10.0-SNAPSHOT diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/Org.OpenAPITools.sln b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/Org.OpenAPITools.sln new file mode 100644 index 000000000000..157b88bbc52e --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/Org.OpenAPITools.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35122.118 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{9685C490-9B77-4EE2-BE4D-811F52665E8F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9685C490-9B77-4EE2-BE4D-811F52665E8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9685C490-9B77-4EE2-BE4D-811F52665E8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9685C490-9B77-4EE2-BE4D-811F52665E8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9685C490-9B77-4EE2-BE4D-811F52665E8F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1EC59EB0-DA5B-40C0-8E49-A3E0829DBBFC} + EndGlobalSection +EndGlobal diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/README.md b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/README.md new file mode 100644 index 000000000000..9a63b1e91fa3 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/README.md @@ -0,0 +1,16 @@ +# Org.OpenAPITools - FastEndpoints ASP.NET Server +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Documentation + +This generated project include basic configuration for FastEndpoints ASP.NET Server. +For more information regarding FastEndpoints, please visit the [FastEndpoints website](https://fast-endpoints.com). + +## Enabled Features + +The following feature have been enabled in this project : +- No additional features enabled + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/PetApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/PetApiEndpoint.cs new file mode 100644 index 000000000000..2e44aeb01c7c --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/PetApiEndpoint.cs @@ -0,0 +1,316 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Add a new pet to the store +/// + +public class AddPetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Add a new pet to the store"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(AddPetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Deletes a pet +/// + +public class DeletePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/pet/{petId}"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Deletes a pet"; + s.RequestParam(r => r.PetId, "Pet id to delete"); + s.RequestParam(r => r.ApiKey, ""); + s.Responses[400] = "Invalid pet value"; + }); + } + + public override async Task HandleAsync(DeletePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by status +/// + +public class FindPetsByStatusEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByStatus"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by status"; + s.RequestParam(r => r.Status, "Status values that need to be considered for filter"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid status value"; + }); + } + + public override async Task HandleAsync(FindPetsByStatusRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by tags +/// +[Obsolete] +public class FindPetsByTagsEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByTags"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by tags"; + s.RequestParam(r => r.Tags, "Tags to filter by"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid tag value"; + }); + } + + public override async Task HandleAsync(FindPetsByTagsRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find pet by ID +/// + +public class GetPetByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/pet/{petId}"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find pet by ID"; + s.RequestParam(r => r.PetId, "ID of pet to return"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + }); + } + + public override async Task HandleAsync(GetPetByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Update an existing pet +/// + +public class UpdatePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/pet"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Update an existing pet"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + s.Responses[405] = "Validation exception"; + }); + } + + public override async Task HandleAsync(UpdatePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updates a pet in the store with form data +/// + +public class UpdatePetWithFormEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Updates a pet in the store with form data"; + s.RequestParam(r => r.PetId, "ID of pet that needs to be updated"); + s.RequestParam(r => r.Name, "Updated name of the pet"); + s.RequestParam(r => r.Status, "Updated status of the pet"); + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(UpdatePetWithFormRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// uploads an image +/// + +public class UploadFileEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}/uploadImage"); + Version(1); + + AllowAnonymous(); + AllowFileUploads(); + Description(x => + { + x.WithTags("pet"); + }); + + Summary(s => { + s.Summary = "uploads an image"; + s.RequestParam(r => r.PetId, "ID of pet to update"); + s.RequestParam(r => r.AdditionalMetadata, "Additional data to pass to server"); + s.RequestParam(r => r.File, "file to upload"); + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(UploadFileRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/PetApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/PetApiRequest.cs new file mode 100644 index 000000000000..64f1fae70020 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/PetApiRequest.cs @@ -0,0 +1,97 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class AddPetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class DeletePetRequest +{ + /// + /// Pet id to delete + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// + /// + [FastEndpoints.FromHeader] + public string? ApiKey { get; set; } +} +public class FindPetsByStatusRequest +{ + /// + /// Status values that need to be considered for filter + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("status")] + public List Status { get; set; } +} +public class FindPetsByTagsRequest +{ + /// + /// Tags to filter by + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("tags")] + public List Tags { get; set; } +} +public class GetPetByIdRequest +{ + /// + /// ID of pet to return + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } +} +public class UpdatePetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class UpdatePetWithFormRequest +{ + /// + /// ID of pet that needs to be updated + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Updated name of the pet + /// + [FastEndpoints.BindFrom("name")] + public string? Name { get; set; } + /// + /// Updated status of the pet + /// + [FastEndpoints.BindFrom("status")] + public string? Status { get; set; } +} +public class UploadFileRequest +{ + /// + /// ID of pet to update + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Additional data to pass to server + /// + [FastEndpoints.BindFrom("additionalMetadata")] + public string? AdditionalMetadata { get; set; } + /// + /// file to upload + /// + [FastEndpoints.BindFrom("file")] + public System.IO.Stream? File { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs new file mode 100644 index 000000000000..fffc9b62c649 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs @@ -0,0 +1,157 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Delete purchase order by ID +/// + +public class DeleteOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/store/order/{orderId}"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of the order that needs to be deleted"); + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(DeleteOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Returns pet inventories by status +/// + +public class GetInventoryEndpoint : FastEndpoints.EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/v2/store/inventory"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + }); + + Summary(s => { + s.Summary = "Returns pet inventories by status"; + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find purchase order by ID +/// + +public class GetOrderByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/store/order/{orderId}"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of pet that needs to be fetched"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(GetOrderByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Place an order for a pet +/// + +public class PlaceOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/store/order"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Place an order for a pet"; + s.RequestParam(r => r.order, "order placed for purchasing the pet"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid Order"; + }); + } + + public override async Task HandleAsync(PlaceOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/StoreApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/StoreApiRequest.cs new file mode 100644 index 000000000000..2fabb077c420 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/StoreApiRequest.cs @@ -0,0 +1,35 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class DeleteOrderRequest +{ + /// + /// ID of the order that needs to be deleted + /// + [FastEndpoints.BindFrom("orderId")] + public string OrderId { get; set; } +} +public class GetInventoryRequest +{ +} +public class GetOrderByIdRequest +{ + /// + /// ID of pet that needs to be fetched + /// + [FastEndpoints.BindFrom("orderId")] + public long OrderId { get; set; } +} +public class PlaceOrderRequest +{ + /// + /// order placed for purchasing the pet + /// + [FastEndpoints.FromBody] + public Order order { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/UserApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/UserApiEndpoint.cs new file mode 100644 index 000000000000..92c6e68fcbde --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/UserApiEndpoint.cs @@ -0,0 +1,310 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Create user +/// + +public class CreateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Create user"; + s.RequestParam(r => r.user, "Created user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithArrayInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithArray"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithArrayInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithListInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithList"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithListInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Delete user +/// + +public class DeleteUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/user/{username}"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete user"; + s.RequestParam(r => r.Username, "The name that needs to be deleted"); + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(DeleteUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Get user by user name +/// + +public class GetUserByNameEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/{username}"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Get user by user name"; + s.RequestParam(r => r.Username, "The name that needs to be fetched. Use user1 for testing."); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(GetUserByNameRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs user into the system +/// + +public class LoginUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/login"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Logs user into the system"; + s.RequestParam(r => r.Username, "The user name for login"); + s.RequestParam(r => r.Password, "The password for login in clear text"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username/password supplied"; + }); + } + + public override async Task HandleAsync(LoginUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs out current logged in user session +/// + +public class LogoutUserEndpoint : FastEndpoints.EndpointWithoutRequest +{ + public override void Configure() + { + Get("/v2/user/logout"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Logs out current logged in user session"; + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updated user +/// + +public class UpdateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/user/{username}"); + Version(1); + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Updated user"; + s.RequestParam(r => r.Username, "name that need to be deleted"); + s.RequestParam(r => r.user, "Updated user object"); + s.Responses[400] = "Invalid user supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(UpdateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/UserApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/UserApiRequest.cs new file mode 100644 index 000000000000..90a7b22694f0 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Features/UserApiRequest.cs @@ -0,0 +1,77 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class CreateUserRequest +{ + /// + /// Created user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} +public class CreateUsersWithArrayInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class CreateUsersWithListInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class DeleteUserRequest +{ + /// + /// The name that needs to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class GetUserByNameRequest +{ + /// + /// The name that needs to be fetched. Use user1 for testing. + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class LoginUserRequest +{ + /// + /// The user name for login + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// The password for login in clear text + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("password")] + public string Password { get; set; } +} +public class LogoutUserRequest +{ +} +public class UpdateUserRequest +{ + /// + /// name that need to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// Updated user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/ApiResponse.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/ApiResponse.cs new file mode 100644 index 000000000000..3a60d51a90c4 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/ApiResponse.cs @@ -0,0 +1,14 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// Describes the result of uploading an image resource +/// +public class ApiResponse +{ + public int Code { get; set; } + public string Type { get; set; } + public string Message { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Category.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Category.cs new file mode 100644 index 000000000000..047bd8c0b2ae --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Category.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A category for a pet +/// +public class Category +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Order.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Order.cs new file mode 100644 index 000000000000..24d09c159a91 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Order.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// An order for a pets from the pet store +/// +public class Order +{ + public long Id { get; set; } + public long PetId { get; set; } + public int Quantity { get; set; } + public DateTime ShipDate { get; set; } + + /// + /// Order Status + /// + /// Order Status + public enum StatusEnum + { + + /// + /// Enum PlacedEnum for placed + /// + PlacedEnum = 1, + + /// + /// Enum ApprovedEnum for approved + /// + ApprovedEnum = 2, + + /// + /// Enum DeliveredEnum for delivered + /// + DeliveredEnum = 3 + } + + public StatusEnum Status { get; set; } + public bool Complete { get; set; } = false; +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Pet.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Pet.cs new file mode 100644 index 000000000000..73bf2b9cc1d3 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Pet.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A pet for sale in the pet store +/// +public class Pet +{ + public long Id { get; set; } + public Category Category { get; set; } + public string Name { get; set; } + public List PhotoUrls { get; set; } + public List Tags { get; set; } + + /// + /// pet status in the store + /// + /// pet status in the store + public enum StatusEnum + { + + /// + /// Enum AvailableEnum for available + /// + AvailableEnum = 1, + + /// + /// Enum PendingEnum for pending + /// + PendingEnum = 2, + + /// + /// Enum SoldEnum for sold + /// + SoldEnum = 3 + } + + public StatusEnum Status { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Tag.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Tag.cs new file mode 100644 index 000000000000..a1196dcb8f42 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/Tag.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A tag for a pet +/// +public class Tag +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/User.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/User.cs new file mode 100644 index 000000000000..61d5b852e0fc --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Models/User.cs @@ -0,0 +1,19 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A User who is purchasing from the pet store +/// +public class User +{ + public long Id { get; set; } + public string Username { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public string Phone { get; set; } + public int UserStatus { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..bda4876e3959 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Program.cs b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Program.cs new file mode 100644 index 000000000000..a630ea620845 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Program.cs @@ -0,0 +1,39 @@ +using FastEndpoints; +using FastEndpoints.Swagger; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services + + .AddFastEndpoints() + .SwaggerDocument(o => + { + o.DocumentSettings = s => + { + s.DocumentName = "OpenAPI Petstore"; + s.Title = "OpenAPI Petstore"; + s.Description = """ +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +"""; + s.Version = "1.0.0"; + }; + o.AutoTagPathSegmentIndex = 0; + }) + +; + +var app = builder.Build(); + +app + + .UseFastEndpoints(x => + { + + x.Endpoints.RoutePrefix = "api"; + x.Versioning.Prefix = "v"; + }) + .UseSwaggerGen(); + +app.UseHttpsRedirection(); + +app.Run(); \ No newline at end of file diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Properties/launchSettings.json b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Properties/launchSettings.json new file mode 100644 index 000000000000..5b816a8d6069 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52621", + "sslPort": 44314 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7047;http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/appsettings.Development.json b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/appsettings.Development.json new file mode 100644 index 000000000000..b0bacf42851f --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/appsettings.json b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/appsettings.json new file mode 100644 index 000000000000..223027717b49 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/src/Org.OpenAPITools/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.gitignore b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.gitignore new file mode 100644 index 000000000000..104b54414e4d --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.gitignore @@ -0,0 +1,484 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from `dotnet new gitignore` + +# dotenv files +.env + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.idea + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator-ignore b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.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/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/FILES new file mode 100644 index 000000000000..aa462debdf48 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/FILES @@ -0,0 +1,23 @@ +.gitignore +.openapi-generator-ignore +Org.OpenAPITools.sln +README.md +src/Org.OpenAPITools/Features/LoginRequest.cs +src/Org.OpenAPITools/Features/PetApiEndpoint.cs +src/Org.OpenAPITools/Features/PetApiRequest.cs +src/Org.OpenAPITools/Features/StoreApiEndpoint.cs +src/Org.OpenAPITools/Features/StoreApiRequest.cs +src/Org.OpenAPITools/Features/UserApiEndpoint.cs +src/Org.OpenAPITools/Features/UserApiRequest.cs +src/Org.OpenAPITools/Features/UserLoginEndpoint.cs +src/Org.OpenAPITools/Models/ApiResponse.cs +src/Org.OpenAPITools/Models/Category.cs +src/Org.OpenAPITools/Models/Order.cs +src/Org.OpenAPITools/Models/Pet.cs +src/Org.OpenAPITools/Models/Tag.cs +src/Org.OpenAPITools/Models/User.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/Program.cs +src/Org.OpenAPITools/Properties/launchSettings.json +src/Org.OpenAPITools/appsettings.Development.json +src/Org.OpenAPITools/appsettings.json diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/VERSION b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/VERSION new file mode 100644 index 000000000000..6935482704c1 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.10.0-SNAPSHOT diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/Org.OpenAPITools.sln b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/Org.OpenAPITools.sln new file mode 100644 index 000000000000..cb70cb1651fe --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/Org.OpenAPITools.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35122.118 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{3FA19D58-AE7C-45E5-B00E-7482026D1816}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3FA19D58-AE7C-45E5-B00E-7482026D1816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3FA19D58-AE7C-45E5-B00E-7482026D1816}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3FA19D58-AE7C-45E5-B00E-7482026D1816}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3FA19D58-AE7C-45E5-B00E-7482026D1816}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {10D45F9B-F270-480C-9DA9-720AA62526A4} + EndGlobalSection +EndGlobal diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/README.md b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/README.md new file mode 100644 index 000000000000..85430a3085dd --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/README.md @@ -0,0 +1,16 @@ +# Org.OpenAPITools - FastEndpoints ASP.NET Server +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Documentation + +This generated project include basic configuration for FastEndpoints ASP.NET Server. +For more information regarding FastEndpoints, please visit the [FastEndpoints website](https://fast-endpoints.com). + +## Enabled Features + +The following feature have been enabled in this project : + + +- [Authentication](https://fast-endpoints.com/docs/security) + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/LoginRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/LoginRequest.cs new file mode 100644 index 000000000000..faf1191a7461 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/LoginRequest.cs @@ -0,0 +1,9 @@ + + +namespace Org.OpenAPITools.Features; + +public class LoginRequest +{ + public string Username { get; set; } + public string Password { get; set; } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/PetApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/PetApiEndpoint.cs new file mode 100644 index 000000000000..eafe59fff876 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/PetApiEndpoint.cs @@ -0,0 +1,316 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Add a new pet to the store +/// + +public class AddPetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Add a new pet to the store"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(AddPetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Deletes a pet +/// + +public class DeletePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/pet/{petId}"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Deletes a pet"; + s.RequestParam(r => r.PetId, "Pet id to delete"); + s.RequestParam(r => r.ApiKey, ""); + s.Responses[400] = "Invalid pet value"; + }); + } + + public override async Task HandleAsync(DeletePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by status +/// + +public class FindPetsByStatusEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByStatus"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by status"; + s.RequestParam(r => r.Status, "Status values that need to be considered for filter"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid status value"; + }); + } + + public override async Task HandleAsync(FindPetsByStatusRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by tags +/// +[Obsolete] +public class FindPetsByTagsEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByTags"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by tags"; + s.RequestParam(r => r.Tags, "Tags to filter by"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid tag value"; + }); + } + + public override async Task HandleAsync(FindPetsByTagsRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find pet by ID +/// + +public class GetPetByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/pet/{petId}"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find pet by ID"; + s.RequestParam(r => r.PetId, "ID of pet to return"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + }); + } + + public override async Task HandleAsync(GetPetByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Update an existing pet +/// + +public class UpdatePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/pet"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Update an existing pet"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + s.Responses[405] = "Validation exception"; + }); + } + + public override async Task HandleAsync(UpdatePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updates a pet in the store with form data +/// + +public class UpdatePetWithFormEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Updates a pet in the store with form data"; + s.RequestParam(r => r.PetId, "ID of pet that needs to be updated"); + s.RequestParam(r => r.Name, "Updated name of the pet"); + s.RequestParam(r => r.Status, "Updated status of the pet"); + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(UpdatePetWithFormRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// uploads an image +/// + +public class UploadFileEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}/uploadImage"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + AllowFileUploads(); + Description(x => + { + x.WithTags("pet"); + }); + + Summary(s => { + s.Summary = "uploads an image"; + s.RequestParam(r => r.PetId, "ID of pet to update"); + s.RequestParam(r => r.AdditionalMetadata, "Additional data to pass to server"); + s.RequestParam(r => r.File, "file to upload"); + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(UploadFileRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/PetApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/PetApiRequest.cs new file mode 100644 index 000000000000..64f1fae70020 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/PetApiRequest.cs @@ -0,0 +1,97 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class AddPetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class DeletePetRequest +{ + /// + /// Pet id to delete + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// + /// + [FastEndpoints.FromHeader] + public string? ApiKey { get; set; } +} +public class FindPetsByStatusRequest +{ + /// + /// Status values that need to be considered for filter + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("status")] + public List Status { get; set; } +} +public class FindPetsByTagsRequest +{ + /// + /// Tags to filter by + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("tags")] + public List Tags { get; set; } +} +public class GetPetByIdRequest +{ + /// + /// ID of pet to return + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } +} +public class UpdatePetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class UpdatePetWithFormRequest +{ + /// + /// ID of pet that needs to be updated + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Updated name of the pet + /// + [FastEndpoints.BindFrom("name")] + public string? Name { get; set; } + /// + /// Updated status of the pet + /// + [FastEndpoints.BindFrom("status")] + public string? Status { get; set; } +} +public class UploadFileRequest +{ + /// + /// ID of pet to update + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Additional data to pass to server + /// + [FastEndpoints.BindFrom("additionalMetadata")] + public string? AdditionalMetadata { get; set; } + /// + /// file to upload + /// + [FastEndpoints.BindFrom("file")] + public System.IO.Stream? File { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs new file mode 100644 index 000000000000..1b04f5b2be12 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs @@ -0,0 +1,157 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Delete purchase order by ID +/// + +public class DeleteOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/store/order/{orderId}"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of the order that needs to be deleted"); + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(DeleteOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Returns pet inventories by status +/// + +public class GetInventoryEndpoint : FastEndpoints.EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/v2/store/inventory"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("store"); + }); + + Summary(s => { + s.Summary = "Returns pet inventories by status"; + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find purchase order by ID +/// + +public class GetOrderByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/store/order/{orderId}"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of pet that needs to be fetched"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(GetOrderByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Place an order for a pet +/// + +public class PlaceOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/store/order"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Place an order for a pet"; + s.RequestParam(r => r.order, "order placed for purchasing the pet"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid Order"; + }); + } + + public override async Task HandleAsync(PlaceOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/StoreApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/StoreApiRequest.cs new file mode 100644 index 000000000000..2fabb077c420 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/StoreApiRequest.cs @@ -0,0 +1,35 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class DeleteOrderRequest +{ + /// + /// ID of the order that needs to be deleted + /// + [FastEndpoints.BindFrom("orderId")] + public string OrderId { get; set; } +} +public class GetInventoryRequest +{ +} +public class GetOrderByIdRequest +{ + /// + /// ID of pet that needs to be fetched + /// + [FastEndpoints.BindFrom("orderId")] + public long OrderId { get; set; } +} +public class PlaceOrderRequest +{ + /// + /// order placed for purchasing the pet + /// + [FastEndpoints.FromBody] + public Order order { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserApiEndpoint.cs new file mode 100644 index 000000000000..a5296646c9db --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserApiEndpoint.cs @@ -0,0 +1,310 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Create user +/// + +public class CreateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Create user"; + s.RequestParam(r => r.user, "Created user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithArrayInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithArray"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithArrayInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithListInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithList"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithListInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Delete user +/// + +public class DeleteUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/user/{username}"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete user"; + s.RequestParam(r => r.Username, "The name that needs to be deleted"); + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(DeleteUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Get user by user name +/// + +public class GetUserByNameEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/{username}"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Get user by user name"; + s.RequestParam(r => r.Username, "The name that needs to be fetched. Use user1 for testing."); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(GetUserByNameRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs user into the system +/// + +public class LoginUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/login"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Logs user into the system"; + s.RequestParam(r => r.Username, "The user name for login"); + s.RequestParam(r => r.Password, "The password for login in clear text"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username/password supplied"; + }); + } + + public override async Task HandleAsync(LoginUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs out current logged in user session +/// + +public class LogoutUserEndpoint : FastEndpoints.EndpointWithoutRequest +{ + public override void Configure() + { + Get("/v2/user/logout"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Logs out current logged in user session"; + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updated user +/// + +public class UpdateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/user/{username}"); + + + //TODO : authentication is enabled, you need to configure the authorizations : https://fast-endpoints.com/docs/security#endpoint-authorization + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Updated user"; + s.RequestParam(r => r.Username, "name that need to be deleted"); + s.RequestParam(r => r.user, "Updated user object"); + s.Responses[400] = "Invalid user supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(UpdateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserApiRequest.cs new file mode 100644 index 000000000000..90a7b22694f0 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserApiRequest.cs @@ -0,0 +1,77 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class CreateUserRequest +{ + /// + /// Created user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} +public class CreateUsersWithArrayInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class CreateUsersWithListInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class DeleteUserRequest +{ + /// + /// The name that needs to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class GetUserByNameRequest +{ + /// + /// The name that needs to be fetched. Use user1 for testing. + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class LoginUserRequest +{ + /// + /// The user name for login + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// The password for login in clear text + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("password")] + public string Password { get; set; } +} +public class LogoutUserRequest +{ +} +public class UpdateUserRequest +{ + /// + /// name that need to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// Updated user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserLoginEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserLoginEndpoint.cs new file mode 100644 index 000000000000..d35b1a38c3b8 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Features/UserLoginEndpoint.cs @@ -0,0 +1,45 @@ + +using FastEndpoints; +using FastEndpoints.Security; + +namespace Org.OpenAPITools.Features; + +//TODO: This is a placeholder for the actual login request endpoint +// For more information : https://fast-endpoints.com/docs/security +public class UserLoginEndpoint : Endpoint +{ + public override void Configure() + { + Post("/api/login"); + AllowAnonymous(); + } + + public override async Task HandleAsync(LoginRequest req, CancellationToken ct) + { + bool credentialsAreValid = true; //TODO call your authentication service + + if (credentialsAreValid) + { + var jwtToken = JwtBearer.CreateToken( + o => + { + o.SigningKey = "A secret token signing key"; + o.ExpireAt = DateTime.UtcNow.AddDays(1); + o.User.Roles.Add("Manager", "Auditor"); + o.User.Claims.Add(("UserName", req.Username)); + o.User["UserId"] = "001"; //indexer based claim setting + }); + + await SendAsync( + new + { + req.Username, + Token = jwtToken + }); + } + else + { + ThrowError("The supplied credentials are invalid!"); + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/ApiResponse.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/ApiResponse.cs new file mode 100644 index 000000000000..3a60d51a90c4 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/ApiResponse.cs @@ -0,0 +1,14 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// Describes the result of uploading an image resource +/// +public class ApiResponse +{ + public int Code { get; set; } + public string Type { get; set; } + public string Message { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Category.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Category.cs new file mode 100644 index 000000000000..047bd8c0b2ae --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Category.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A category for a pet +/// +public class Category +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Order.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Order.cs new file mode 100644 index 000000000000..24d09c159a91 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Order.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// An order for a pets from the pet store +/// +public class Order +{ + public long Id { get; set; } + public long PetId { get; set; } + public int Quantity { get; set; } + public DateTime ShipDate { get; set; } + + /// + /// Order Status + /// + /// Order Status + public enum StatusEnum + { + + /// + /// Enum PlacedEnum for placed + /// + PlacedEnum = 1, + + /// + /// Enum ApprovedEnum for approved + /// + ApprovedEnum = 2, + + /// + /// Enum DeliveredEnum for delivered + /// + DeliveredEnum = 3 + } + + public StatusEnum Status { get; set; } + public bool Complete { get; set; } = false; +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Pet.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Pet.cs new file mode 100644 index 000000000000..73bf2b9cc1d3 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Pet.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A pet for sale in the pet store +/// +public class Pet +{ + public long Id { get; set; } + public Category Category { get; set; } + public string Name { get; set; } + public List PhotoUrls { get; set; } + public List Tags { get; set; } + + /// + /// pet status in the store + /// + /// pet status in the store + public enum StatusEnum + { + + /// + /// Enum AvailableEnum for available + /// + AvailableEnum = 1, + + /// + /// Enum PendingEnum for pending + /// + PendingEnum = 2, + + /// + /// Enum SoldEnum for sold + /// + SoldEnum = 3 + } + + public StatusEnum Status { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Tag.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Tag.cs new file mode 100644 index 000000000000..a1196dcb8f42 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/Tag.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A tag for a pet +/// +public class Tag +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/User.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/User.cs new file mode 100644 index 000000000000..61d5b852e0fc --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Models/User.cs @@ -0,0 +1,19 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A User who is purchasing from the pet store +/// +public class User +{ + public long Id { get; set; } + public string Username { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public string Phone { get; set; } + public int UserStatus { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..963abb356a1a --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,15 @@ + + + + net8.0 + enable + enable + + + + + + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Program.cs b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Program.cs new file mode 100644 index 000000000000..6f309ac9bb32 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Program.cs @@ -0,0 +1,40 @@ +using FastEndpoints; +using FastEndpoints.Security; +using FastEndpoints.Swagger; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services + .AddAuthenticationJwtBearer(s => s.SigningKey = "The secret used to sign tokens") //TODO set the signing key + .AddAuthorization() + .AddFastEndpoints() + .SwaggerDocument(o => + { + o.DocumentSettings = s => + { + s.DocumentName = "OpenAPI Petstore"; + s.Title = "OpenAPI Petstore"; + s.Description = """ +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +"""; + s.Version = "1.0.0"; + }; + o.AutoTagPathSegmentIndex = 0; + }) + +; + +var app = builder.Build(); + +app + .UseAuthentication() + .UseAuthorization() + .UseFastEndpoints(x => + { + + }) + .UseSwaggerGen(); + +app.UseHttpsRedirection(); + +app.Run(); \ No newline at end of file diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Properties/launchSettings.json b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Properties/launchSettings.json new file mode 100644 index 000000000000..5b816a8d6069 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52621", + "sslPort": 44314 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7047;http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/appsettings.Development.json b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/appsettings.Development.json new file mode 100644 index 000000000000..b0bacf42851f --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/appsettings.json b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/appsettings.json new file mode 100644 index 000000000000..223027717b49 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/src/Org.OpenAPITools/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.gitignore b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.gitignore new file mode 100644 index 000000000000..104b54414e4d --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.gitignore @@ -0,0 +1,484 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from `dotnet new gitignore` + +# dotenv files +.env + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.idea + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator-ignore b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.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/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/FILES new file mode 100644 index 000000000000..a48edd621111 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/FILES @@ -0,0 +1,21 @@ +.gitignore +.openapi-generator-ignore +Org.OpenAPITools.sln +README.md +src/Org.OpenAPITools/Features/PetApiEndpoint.cs +src/Org.OpenAPITools/Features/PetApiRequest.cs +src/Org.OpenAPITools/Features/StoreApiEndpoint.cs +src/Org.OpenAPITools/Features/StoreApiRequest.cs +src/Org.OpenAPITools/Features/UserApiEndpoint.cs +src/Org.OpenAPITools/Features/UserApiRequest.cs +src/Org.OpenAPITools/Models/ApiResponse.cs +src/Org.OpenAPITools/Models/Category.cs +src/Org.OpenAPITools/Models/Order.cs +src/Org.OpenAPITools/Models/Pet.cs +src/Org.OpenAPITools/Models/Tag.cs +src/Org.OpenAPITools/Models/User.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/Program.cs +src/Org.OpenAPITools/Properties/launchSettings.json +src/Org.OpenAPITools/appsettings.Development.json +src/Org.OpenAPITools/appsettings.json diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/VERSION b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/VERSION new file mode 100644 index 000000000000..6935482704c1 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.10.0-SNAPSHOT diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/Org.OpenAPITools.sln b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/Org.OpenAPITools.sln new file mode 100644 index 000000000000..d9ea8e7e7e17 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/Org.OpenAPITools.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35122.118 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{74D68BAC-36F5-43FC-BE9A-F3E660EECF5D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {74D68BAC-36F5-43FC-BE9A-F3E660EECF5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {74D68BAC-36F5-43FC-BE9A-F3E660EECF5D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {74D68BAC-36F5-43FC-BE9A-F3E660EECF5D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {74D68BAC-36F5-43FC-BE9A-F3E660EECF5D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EA9B735E-72CA-44C4-BB28-358BDECE60C8} + EndGlobalSection +EndGlobal diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/README.md b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/README.md new file mode 100644 index 000000000000..bdeb80b9ae54 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/README.md @@ -0,0 +1,16 @@ +# Org.OpenAPITools - FastEndpoints ASP.NET Server +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Documentation + +This generated project include basic configuration for FastEndpoints ASP.NET Server. +For more information regarding FastEndpoints, please visit the [FastEndpoints website](https://fast-endpoints.com). + +## Enabled Features + +The following feature have been enabled in this project : + +- [Problem Details](https://fast-endpoints.com/docs/configuration-settings#rfc7807-rfc9457-compatible-problem-details) + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/PetApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/PetApiEndpoint.cs new file mode 100644 index 000000000000..62b9da431309 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/PetApiEndpoint.cs @@ -0,0 +1,316 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Add a new pet to the store +/// + +public class AddPetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 405); + }); + + Summary(s => { + s.Summary = "Add a new pet to the store"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(AddPetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Deletes a pet +/// + +public class DeletePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + }); + + Summary(s => { + s.Summary = "Deletes a pet"; + s.RequestParam(r => r.PetId, "Pet id to delete"); + s.RequestParam(r => r.ApiKey, ""); + s.Responses[400] = "Invalid pet value"; + }); + } + + public override async Task HandleAsync(DeletePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by status +/// + +public class FindPetsByStatusEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByStatus"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by status"; + s.RequestParam(r => r.Status, "Status values that need to be considered for filter"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid status value"; + }); + } + + public override async Task HandleAsync(FindPetsByStatusRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by tags +/// +[Obsolete] +public class FindPetsByTagsEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByTags"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by tags"; + s.RequestParam(r => r.Tags, "Tags to filter by"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid tag value"; + }); + } + + public override async Task HandleAsync(FindPetsByTagsRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find pet by ID +/// + +public class GetPetByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 404); + }); + + Summary(s => { + s.Summary = "Find pet by ID"; + s.RequestParam(r => r.PetId, "ID of pet to return"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + }); + } + + public override async Task HandleAsync(GetPetByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Update an existing pet +/// + +public class UpdatePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/pet"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 404); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 405); + }); + + Summary(s => { + s.Summary = "Update an existing pet"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + s.Responses[405] = "Validation exception"; + }); + } + + public override async Task HandleAsync(UpdatePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updates a pet in the store with form data +/// + +public class UpdatePetWithFormEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 405); + }); + + Summary(s => { + s.Summary = "Updates a pet in the store with form data"; + s.RequestParam(r => r.PetId, "ID of pet that needs to be updated"); + s.RequestParam(r => r.Name, "Updated name of the pet"); + s.RequestParam(r => r.Status, "Updated status of the pet"); + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(UpdatePetWithFormRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// uploads an image +/// + +public class UploadFileEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}/uploadImage"); + + + AllowAnonymous(); + AllowFileUploads(); + Description(x => + { + x.WithTags("pet"); + }); + + Summary(s => { + s.Summary = "uploads an image"; + s.RequestParam(r => r.PetId, "ID of pet to update"); + s.RequestParam(r => r.AdditionalMetadata, "Additional data to pass to server"); + s.RequestParam(r => r.File, "file to upload"); + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(UploadFileRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/PetApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/PetApiRequest.cs new file mode 100644 index 000000000000..64f1fae70020 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/PetApiRequest.cs @@ -0,0 +1,97 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class AddPetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class DeletePetRequest +{ + /// + /// Pet id to delete + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// + /// + [FastEndpoints.FromHeader] + public string? ApiKey { get; set; } +} +public class FindPetsByStatusRequest +{ + /// + /// Status values that need to be considered for filter + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("status")] + public List Status { get; set; } +} +public class FindPetsByTagsRequest +{ + /// + /// Tags to filter by + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("tags")] + public List Tags { get; set; } +} +public class GetPetByIdRequest +{ + /// + /// ID of pet to return + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } +} +public class UpdatePetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class UpdatePetWithFormRequest +{ + /// + /// ID of pet that needs to be updated + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Updated name of the pet + /// + [FastEndpoints.BindFrom("name")] + public string? Name { get; set; } + /// + /// Updated status of the pet + /// + [FastEndpoints.BindFrom("status")] + public string? Status { get; set; } +} +public class UploadFileRequest +{ + /// + /// ID of pet to update + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Additional data to pass to server + /// + [FastEndpoints.BindFrom("additionalMetadata")] + public string? AdditionalMetadata { get; set; } + /// + /// file to upload + /// + [FastEndpoints.BindFrom("file")] + public System.IO.Stream? File { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs new file mode 100644 index 000000000000..37b7bd2c6a00 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs @@ -0,0 +1,157 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Delete purchase order by ID +/// + +public class DeleteOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/store/order/{orderId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 404); + }); + + Summary(s => { + s.Summary = "Delete purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of the order that needs to be deleted"); + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(DeleteOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Returns pet inventories by status +/// + +public class GetInventoryEndpoint : FastEndpoints.EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/v2/store/inventory"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + }); + + Summary(s => { + s.Summary = "Returns pet inventories by status"; + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find purchase order by ID +/// + +public class GetOrderByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/store/order/{orderId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 404); + }); + + Summary(s => { + s.Summary = "Find purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of pet that needs to be fetched"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(GetOrderByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Place an order for a pet +/// + +public class PlaceOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/store/order"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + }); + + Summary(s => { + s.Summary = "Place an order for a pet"; + s.RequestParam(r => r.order, "order placed for purchasing the pet"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid Order"; + }); + } + + public override async Task HandleAsync(PlaceOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/StoreApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/StoreApiRequest.cs new file mode 100644 index 000000000000..2fabb077c420 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/StoreApiRequest.cs @@ -0,0 +1,35 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class DeleteOrderRequest +{ + /// + /// ID of the order that needs to be deleted + /// + [FastEndpoints.BindFrom("orderId")] + public string OrderId { get; set; } +} +public class GetInventoryRequest +{ +} +public class GetOrderByIdRequest +{ + /// + /// ID of pet that needs to be fetched + /// + [FastEndpoints.BindFrom("orderId")] + public long OrderId { get; set; } +} +public class PlaceOrderRequest +{ + /// + /// order placed for purchasing the pet + /// + [FastEndpoints.FromBody] + public Order order { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/UserApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/UserApiEndpoint.cs new file mode 100644 index 000000000000..509a2beda801 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/UserApiEndpoint.cs @@ -0,0 +1,310 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Create user +/// + +public class CreateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 0); + }); + + Summary(s => { + s.Summary = "Create user"; + s.RequestParam(r => r.user, "Created user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithArrayInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithArray"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithArrayInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithListInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithList"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithListInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Delete user +/// + +public class DeleteUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 404); + }); + + Summary(s => { + s.Summary = "Delete user"; + s.RequestParam(r => r.Username, "The name that needs to be deleted"); + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(DeleteUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Get user by user name +/// + +public class GetUserByNameEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 404); + }); + + Summary(s => { + s.Summary = "Get user by user name"; + s.RequestParam(r => r.Username, "The name that needs to be fetched. Use user1 for testing."); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(GetUserByNameRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs user into the system +/// + +public class LoginUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/login"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + }); + + Summary(s => { + s.Summary = "Logs user into the system"; + s.RequestParam(r => r.Username, "The user name for login"); + s.RequestParam(r => r.Password, "The password for login in clear text"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username/password supplied"; + }); + } + + public override async Task HandleAsync(LoginUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs out current logged in user session +/// + +public class LogoutUserEndpoint : FastEndpoints.EndpointWithoutRequest +{ + public override void Configure() + { + Get("/v2/user/logout"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 0); + }); + + Summary(s => { + s.Summary = "Logs out current logged in user session"; + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updated user +/// + +public class UpdateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemDetails(x, 404); + }); + + Summary(s => { + s.Summary = "Updated user"; + s.RequestParam(r => r.Username, "name that need to be deleted"); + s.RequestParam(r => r.user, "Updated user object"); + s.Responses[400] = "Invalid user supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(UpdateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/UserApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/UserApiRequest.cs new file mode 100644 index 000000000000..90a7b22694f0 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Features/UserApiRequest.cs @@ -0,0 +1,77 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class CreateUserRequest +{ + /// + /// Created user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} +public class CreateUsersWithArrayInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class CreateUsersWithListInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class DeleteUserRequest +{ + /// + /// The name that needs to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class GetUserByNameRequest +{ + /// + /// The name that needs to be fetched. Use user1 for testing. + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class LoginUserRequest +{ + /// + /// The user name for login + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// The password for login in clear text + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("password")] + public string Password { get; set; } +} +public class LogoutUserRequest +{ +} +public class UpdateUserRequest +{ + /// + /// name that need to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// Updated user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/ApiResponse.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/ApiResponse.cs new file mode 100644 index 000000000000..3a60d51a90c4 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/ApiResponse.cs @@ -0,0 +1,14 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// Describes the result of uploading an image resource +/// +public class ApiResponse +{ + public int Code { get; set; } + public string Type { get; set; } + public string Message { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Category.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Category.cs new file mode 100644 index 000000000000..047bd8c0b2ae --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Category.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A category for a pet +/// +public class Category +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Order.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Order.cs new file mode 100644 index 000000000000..24d09c159a91 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Order.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// An order for a pets from the pet store +/// +public class Order +{ + public long Id { get; set; } + public long PetId { get; set; } + public int Quantity { get; set; } + public DateTime ShipDate { get; set; } + + /// + /// Order Status + /// + /// Order Status + public enum StatusEnum + { + + /// + /// Enum PlacedEnum for placed + /// + PlacedEnum = 1, + + /// + /// Enum ApprovedEnum for approved + /// + ApprovedEnum = 2, + + /// + /// Enum DeliveredEnum for delivered + /// + DeliveredEnum = 3 + } + + public StatusEnum Status { get; set; } + public bool Complete { get; set; } = false; +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Pet.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Pet.cs new file mode 100644 index 000000000000..73bf2b9cc1d3 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Pet.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A pet for sale in the pet store +/// +public class Pet +{ + public long Id { get; set; } + public Category Category { get; set; } + public string Name { get; set; } + public List PhotoUrls { get; set; } + public List Tags { get; set; } + + /// + /// pet status in the store + /// + /// pet status in the store + public enum StatusEnum + { + + /// + /// Enum AvailableEnum for available + /// + AvailableEnum = 1, + + /// + /// Enum PendingEnum for pending + /// + PendingEnum = 2, + + /// + /// Enum SoldEnum for sold + /// + SoldEnum = 3 + } + + public StatusEnum Status { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Tag.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Tag.cs new file mode 100644 index 000000000000..a1196dcb8f42 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/Tag.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A tag for a pet +/// +public class Tag +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/User.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/User.cs new file mode 100644 index 000000000000..61d5b852e0fc --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Models/User.cs @@ -0,0 +1,19 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A User who is purchasing from the pet store +/// +public class User +{ + public long Id { get; set; } + public string Username { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public string Phone { get; set; } + public int UserStatus { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..bda4876e3959 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Program.cs b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Program.cs new file mode 100644 index 000000000000..88d68115a792 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Program.cs @@ -0,0 +1,37 @@ +using FastEndpoints; +using FastEndpoints.Swagger; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services + + .AddFastEndpoints() + .SwaggerDocument(o => + { + o.DocumentSettings = s => + { + s.DocumentName = "OpenAPI Petstore"; + s.Title = "OpenAPI Petstore"; + s.Description = """ +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +"""; + s.Version = "1.0.0"; + }; + o.AutoTagPathSegmentIndex = 0; + }) + +; + +var app = builder.Build(); + +app + + .UseFastEndpoints(x => + { + x.Errors.UseProblemDetails(); + }) + .UseSwaggerGen(); + +app.UseHttpsRedirection(); + +app.Run(); \ No newline at end of file diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Properties/launchSettings.json b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Properties/launchSettings.json new file mode 100644 index 000000000000..5b816a8d6069 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52621", + "sslPort": 44314 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7047;http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/appsettings.Development.json b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/appsettings.Development.json new file mode 100644 index 000000000000..b0bacf42851f --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/appsettings.json b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/appsettings.json new file mode 100644 index 000000000000..223027717b49 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/src/Org.OpenAPITools/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/.gitignore b/samples/server/petstore/aspnet/fastendpoints-useRecords/.gitignore new file mode 100644 index 000000000000..104b54414e4d --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/.gitignore @@ -0,0 +1,484 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from `dotnet new gitignore` + +# dotenv files +.env + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.idea + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator-ignore b/samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/.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/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/FILES new file mode 100644 index 000000000000..a48edd621111 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/FILES @@ -0,0 +1,21 @@ +.gitignore +.openapi-generator-ignore +Org.OpenAPITools.sln +README.md +src/Org.OpenAPITools/Features/PetApiEndpoint.cs +src/Org.OpenAPITools/Features/PetApiRequest.cs +src/Org.OpenAPITools/Features/StoreApiEndpoint.cs +src/Org.OpenAPITools/Features/StoreApiRequest.cs +src/Org.OpenAPITools/Features/UserApiEndpoint.cs +src/Org.OpenAPITools/Features/UserApiRequest.cs +src/Org.OpenAPITools/Models/ApiResponse.cs +src/Org.OpenAPITools/Models/Category.cs +src/Org.OpenAPITools/Models/Order.cs +src/Org.OpenAPITools/Models/Pet.cs +src/Org.OpenAPITools/Models/Tag.cs +src/Org.OpenAPITools/Models/User.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/Program.cs +src/Org.OpenAPITools/Properties/launchSettings.json +src/Org.OpenAPITools/appsettings.Development.json +src/Org.OpenAPITools/appsettings.json diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/VERSION b/samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/VERSION new file mode 100644 index 000000000000..6935482704c1 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.10.0-SNAPSHOT diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/Org.OpenAPITools.sln b/samples/server/petstore/aspnet/fastendpoints-useRecords/Org.OpenAPITools.sln new file mode 100644 index 000000000000..4aeb8e982e9d --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/Org.OpenAPITools.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35122.118 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{D465FD3B-3146-4661-BB50-522608AA3967}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D465FD3B-3146-4661-BB50-522608AA3967}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D465FD3B-3146-4661-BB50-522608AA3967}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D465FD3B-3146-4661-BB50-522608AA3967}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D465FD3B-3146-4661-BB50-522608AA3967}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C5D2BEB0-AB74-433F-BC14-DA66CAC82C10} + EndGlobalSection +EndGlobal diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/README.md b/samples/server/petstore/aspnet/fastendpoints-useRecords/README.md new file mode 100644 index 000000000000..9a63b1e91fa3 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/README.md @@ -0,0 +1,16 @@ +# Org.OpenAPITools - FastEndpoints ASP.NET Server +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Documentation + +This generated project include basic configuration for FastEndpoints ASP.NET Server. +For more information regarding FastEndpoints, please visit the [FastEndpoints website](https://fast-endpoints.com). + +## Enabled Features + +The following feature have been enabled in this project : +- No additional features enabled + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/PetApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/PetApiEndpoint.cs new file mode 100644 index 000000000000..c16f3bb68252 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/PetApiEndpoint.cs @@ -0,0 +1,316 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Add a new pet to the store +/// + +public class AddPetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Add a new pet to the store"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(AddPetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Deletes a pet +/// + +public class DeletePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Deletes a pet"; + s.RequestParam(r => r.PetId, "Pet id to delete"); + s.RequestParam(r => r.ApiKey, ""); + s.Responses[400] = "Invalid pet value"; + }); + } + + public override async Task HandleAsync(DeletePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by status +/// + +public class FindPetsByStatusEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByStatus"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by status"; + s.RequestParam(r => r.Status, "Status values that need to be considered for filter"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid status value"; + }); + } + + public override async Task HandleAsync(FindPetsByStatusRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by tags +/// +[Obsolete] +public class FindPetsByTagsEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByTags"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by tags"; + s.RequestParam(r => r.Tags, "Tags to filter by"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid tag value"; + }); + } + + public override async Task HandleAsync(FindPetsByTagsRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find pet by ID +/// + +public class GetPetByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find pet by ID"; + s.RequestParam(r => r.PetId, "ID of pet to return"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + }); + } + + public override async Task HandleAsync(GetPetByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Update an existing pet +/// + +public class UpdatePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/pet"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Update an existing pet"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + s.Responses[405] = "Validation exception"; + }); + } + + public override async Task HandleAsync(UpdatePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updates a pet in the store with form data +/// + +public class UpdatePetWithFormEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Updates a pet in the store with form data"; + s.RequestParam(r => r.PetId, "ID of pet that needs to be updated"); + s.RequestParam(r => r.Name, "Updated name of the pet"); + s.RequestParam(r => r.Status, "Updated status of the pet"); + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(UpdatePetWithFormRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// uploads an image +/// + +public class UploadFileEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}/uploadImage"); + + + AllowAnonymous(); + AllowFileUploads(); + Description(x => + { + x.WithTags("pet"); + }); + + Summary(s => { + s.Summary = "uploads an image"; + s.RequestParam(r => r.PetId, "ID of pet to update"); + s.RequestParam(r => r.AdditionalMetadata, "Additional data to pass to server"); + s.RequestParam(r => r.File, "file to upload"); + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(UploadFileRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/PetApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/PetApiRequest.cs new file mode 100644 index 000000000000..5d89c93f85c4 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/PetApiRequest.cs @@ -0,0 +1,45 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + +public record AddPetRequest([property: FastEndpoints.FromBody] Pet pet) +{ +} + +public record DeletePetRequest([property: FastEndpoints.BindFrom("petId")] long PetId) +{ + [property: FastEndpoints.FromHeader] public string? ApiKey {get; init; } +} + +public record FindPetsByStatusRequest([property: FastEndpoints.QueryParam, FastEndpoints.BindFrom("status")] List Status) +{ +} + +public record FindPetsByTagsRequest([property: FastEndpoints.QueryParam, FastEndpoints.BindFrom("tags")] List Tags) +{ +} + +public record GetPetByIdRequest([property: FastEndpoints.BindFrom("petId")] long PetId) +{ +} + +public record UpdatePetRequest([property: FastEndpoints.FromBody] Pet pet) +{ +} + +public record UpdatePetWithFormRequest([property: FastEndpoints.BindFrom("petId")] long PetId) +{ + [FastEndpoints.BindFrom("name")] public string? Name {get; init; } + [FastEndpoints.BindFrom("status")] public string? Status {get; init; } +} + +public record UploadFileRequest([property: FastEndpoints.BindFrom("petId")] long PetId) +{ + [FastEndpoints.BindFrom("additionalMetadata")] public string? AdditionalMetadata {get; init; } + [FastEndpoints.BindFrom("file")] public System.IO.Stream? File {get; init; } +} + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs new file mode 100644 index 000000000000..f4c803cf500a --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs @@ -0,0 +1,157 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Delete purchase order by ID +/// + +public class DeleteOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/store/order/{orderId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of the order that needs to be deleted"); + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(DeleteOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Returns pet inventories by status +/// + +public class GetInventoryEndpoint : FastEndpoints.EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/v2/store/inventory"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + }); + + Summary(s => { + s.Summary = "Returns pet inventories by status"; + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find purchase order by ID +/// + +public class GetOrderByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/store/order/{orderId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of pet that needs to be fetched"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(GetOrderByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Place an order for a pet +/// + +public class PlaceOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/store/order"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Place an order for a pet"; + s.RequestParam(r => r.order, "order placed for purchasing the pet"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid Order"; + }); + } + + public override async Task HandleAsync(PlaceOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/StoreApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/StoreApiRequest.cs new file mode 100644 index 000000000000..cca123003637 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/StoreApiRequest.cs @@ -0,0 +1,24 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + +public record DeleteOrderRequest([property: FastEndpoints.BindFrom("orderId")] string OrderId) +{ +} + +public record GetInventoryRequest() +{ +} + +public record GetOrderByIdRequest([property: FastEndpoints.BindFrom("orderId")] long OrderId) +{ +} + +public record PlaceOrderRequest([property: FastEndpoints.FromBody] Order order) +{ +} + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/UserApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/UserApiEndpoint.cs new file mode 100644 index 000000000000..53f62c803fc2 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/UserApiEndpoint.cs @@ -0,0 +1,310 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Create user +/// + +public class CreateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Create user"; + s.RequestParam(r => r.user, "Created user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithArrayInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithArray"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithArrayInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithListInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithList"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithListInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Delete user +/// + +public class DeleteUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete user"; + s.RequestParam(r => r.Username, "The name that needs to be deleted"); + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(DeleteUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Get user by user name +/// + +public class GetUserByNameEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Get user by user name"; + s.RequestParam(r => r.Username, "The name that needs to be fetched. Use user1 for testing."); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(GetUserByNameRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs user into the system +/// + +public class LoginUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/login"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Logs user into the system"; + s.RequestParam(r => r.Username, "The user name for login"); + s.RequestParam(r => r.Password, "The password for login in clear text"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username/password supplied"; + }); + } + + public override async Task HandleAsync(LoginUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs out current logged in user session +/// + +public class LogoutUserEndpoint : FastEndpoints.EndpointWithoutRequest +{ + public override void Configure() + { + Get("/v2/user/logout"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Logs out current logged in user session"; + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updated user +/// + +public class UpdateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Updated user"; + s.RequestParam(r => r.Username, "name that need to be deleted"); + s.RequestParam(r => r.user, "Updated user object"); + s.Responses[400] = "Invalid user supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(UpdateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/UserApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/UserApiRequest.cs new file mode 100644 index 000000000000..58556e2aadd5 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Features/UserApiRequest.cs @@ -0,0 +1,40 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + +public record CreateUserRequest([property: FastEndpoints.FromBody] User user) +{ +} + +public record CreateUsersWithArrayInputRequest([property: FastEndpoints.FromBody] List user) +{ +} + +public record CreateUsersWithListInputRequest([property: FastEndpoints.FromBody] List user) +{ +} + +public record DeleteUserRequest([property: FastEndpoints.BindFrom("username")] string Username) +{ +} + +public record GetUserByNameRequest([property: FastEndpoints.BindFrom("username")] string Username) +{ +} + +public record LoginUserRequest([property: FastEndpoints.QueryParam, FastEndpoints.BindFrom("username")] string Username, [property: FastEndpoints.QueryParam, FastEndpoints.BindFrom("password")] string Password) +{ +} + +public record LogoutUserRequest() +{ +} + +public record UpdateUserRequest([property: FastEndpoints.BindFrom("username")] string Username, [property: FastEndpoints.FromBody] User user) +{ +} + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/ApiResponse.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/ApiResponse.cs new file mode 100644 index 000000000000..e3c375ed330a --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/ApiResponse.cs @@ -0,0 +1,14 @@ +namespace Org.OpenAPITools.Models; + +/// +/// Describes the result of uploading an image resource +/// +public record ApiResponse() +{ + public int Code {get; init; } + public string Type {get; init; } + public string Message {get; init; } + } + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Category.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Category.cs new file mode 100644 index 000000000000..ed1b45ed54d9 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Category.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + +/// +/// A category for a pet +/// +public record Category() +{ + public long Id {get; init; } + public string Name {get; init; } + } + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Order.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Order.cs new file mode 100644 index 000000000000..5464c23b6082 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Order.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + +/// +/// An order for a pets from the pet store +/// +public record Order() +{ + public long Id {get; init; } + public long PetId {get; init; } + public int Quantity {get; init; } + public DateTime ShipDate {get; init; } + public StatusEnum Status {get; init; } + public bool Complete {get; init; } = false; + + /// + /// Order Status + /// + /// Order Status + public enum StatusEnum + { + + /// + /// Enum PlacedEnum for placed + /// + PlacedEnum = 1, + + /// + /// Enum ApprovedEnum for approved + /// + ApprovedEnum = 2, + + /// + /// Enum DeliveredEnum for delivered + /// + DeliveredEnum = 3 + } + + } + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Pet.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Pet.cs new file mode 100644 index 000000000000..ae0d3591140d --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Pet.cs @@ -0,0 +1,39 @@ +namespace Org.OpenAPITools.Models; + +/// +/// A pet for sale in the pet store +/// +public record Pet(string Name,List PhotoUrls) +{ + public long Id {get; init; } + public Category Category {get; init; } + public List Tags {get; init; } + public StatusEnum Status {get; init; } + + /// + /// pet status in the store + /// + /// pet status in the store + public enum StatusEnum + { + + /// + /// Enum AvailableEnum for available + /// + AvailableEnum = 1, + + /// + /// Enum PendingEnum for pending + /// + PendingEnum = 2, + + /// + /// Enum SoldEnum for sold + /// + SoldEnum = 3 + } + +} + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Tag.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Tag.cs new file mode 100644 index 000000000000..c9ac54c59ff7 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/Tag.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + +/// +/// A tag for a pet +/// +public record Tag() +{ + public long Id {get; init; } + public string Name {get; init; } + } + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/User.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/User.cs new file mode 100644 index 000000000000..cfcc7f886209 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Models/User.cs @@ -0,0 +1,19 @@ +namespace Org.OpenAPITools.Models; + +/// +/// A User who is purchasing from the pet store +/// +public record User() +{ + public long Id {get; init; } + public string Username {get; init; } + public string FirstName {get; init; } + public string LastName {get; init; } + public string Email {get; init; } + public string Password {get; init; } + public string Phone {get; init; } + public int UserStatus {get; init; } + } + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..bda4876e3959 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Program.cs b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Program.cs new file mode 100644 index 000000000000..0d9f468982c4 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Program.cs @@ -0,0 +1,37 @@ +using FastEndpoints; +using FastEndpoints.Swagger; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services + + .AddFastEndpoints() + .SwaggerDocument(o => + { + o.DocumentSettings = s => + { + s.DocumentName = "OpenAPI Petstore"; + s.Title = "OpenAPI Petstore"; + s.Description = """ +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +"""; + s.Version = "1.0.0"; + }; + o.AutoTagPathSegmentIndex = 0; + }) + +; + +var app = builder.Build(); + +app + + .UseFastEndpoints(x => + { + + }) + .UseSwaggerGen(); + +app.UseHttpsRedirection(); + +app.Run(); \ No newline at end of file diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Properties/launchSettings.json b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Properties/launchSettings.json new file mode 100644 index 000000000000..5b816a8d6069 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52621", + "sslPort": 44314 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7047;http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/appsettings.Development.json b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/appsettings.Development.json new file mode 100644 index 000000000000..b0bacf42851f --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/appsettings.json b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/appsettings.json new file mode 100644 index 000000000000..223027717b49 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/src/Org.OpenAPITools/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.gitignore b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.gitignore new file mode 100644 index 000000000000..104b54414e4d --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.gitignore @@ -0,0 +1,484 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from `dotnet new gitignore` + +# dotenv files +.env + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.idea + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator-ignore b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.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/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/FILES new file mode 100644 index 000000000000..a48edd621111 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/FILES @@ -0,0 +1,21 @@ +.gitignore +.openapi-generator-ignore +Org.OpenAPITools.sln +README.md +src/Org.OpenAPITools/Features/PetApiEndpoint.cs +src/Org.OpenAPITools/Features/PetApiRequest.cs +src/Org.OpenAPITools/Features/StoreApiEndpoint.cs +src/Org.OpenAPITools/Features/StoreApiRequest.cs +src/Org.OpenAPITools/Features/UserApiEndpoint.cs +src/Org.OpenAPITools/Features/UserApiRequest.cs +src/Org.OpenAPITools/Models/ApiResponse.cs +src/Org.OpenAPITools/Models/Category.cs +src/Org.OpenAPITools/Models/Order.cs +src/Org.OpenAPITools/Models/Pet.cs +src/Org.OpenAPITools/Models/Tag.cs +src/Org.OpenAPITools/Models/User.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/Program.cs +src/Org.OpenAPITools/Properties/launchSettings.json +src/Org.OpenAPITools/appsettings.Development.json +src/Org.OpenAPITools/appsettings.json diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/VERSION b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/VERSION new file mode 100644 index 000000000000..6935482704c1 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.10.0-SNAPSHOT diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/Org.OpenAPITools.sln b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/Org.OpenAPITools.sln new file mode 100644 index 000000000000..ba99447c3de9 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/Org.OpenAPITools.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35122.118 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{5D19ACAB-8830-47FD-BAFA-C0985DF9F5F3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5D19ACAB-8830-47FD-BAFA-C0985DF9F5F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5D19ACAB-8830-47FD-BAFA-C0985DF9F5F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D19ACAB-8830-47FD-BAFA-C0985DF9F5F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5D19ACAB-8830-47FD-BAFA-C0985DF9F5F3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BC56C2A3-ACC5-4ED0-AD8F-CD1831B8A467} + EndGlobalSection +EndGlobal diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/README.md b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/README.md new file mode 100644 index 000000000000..8674e6dd346c --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/README.md @@ -0,0 +1,16 @@ +# Org.OpenAPITools - FastEndpoints ASP.NET Server +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Documentation + +This generated project include basic configuration for FastEndpoints ASP.NET Server. +For more information regarding FastEndpoints, please visit the [FastEndpoints website](https://fast-endpoints.com). + +## Enabled Features + +The following feature have been enabled in this project : + + + + +- [Response Caching](https://fast-endpoints.com/docs/response-caching) diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/PetApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/PetApiEndpoint.cs new file mode 100644 index 000000000000..22336f075167 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/PetApiEndpoint.cs @@ -0,0 +1,316 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Add a new pet to the store +/// + +public class AddPetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Add a new pet to the store"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(AddPetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Deletes a pet +/// + +public class DeletePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/pet/{petId}"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Deletes a pet"; + s.RequestParam(r => r.PetId, "Pet id to delete"); + s.RequestParam(r => r.ApiKey, ""); + s.Responses[400] = "Invalid pet value"; + }); + } + + public override async Task HandleAsync(DeletePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by status +/// + +public class FindPetsByStatusEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByStatus"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by status"; + s.RequestParam(r => r.Status, "Status values that need to be considered for filter"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid status value"; + }); + } + + public override async Task HandleAsync(FindPetsByStatusRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by tags +/// +[Obsolete] +public class FindPetsByTagsEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByTags"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by tags"; + s.RequestParam(r => r.Tags, "Tags to filter by"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid tag value"; + }); + } + + public override async Task HandleAsync(FindPetsByTagsRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find pet by ID +/// + +public class GetPetByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/pet/{petId}"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find pet by ID"; + s.RequestParam(r => r.PetId, "ID of pet to return"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + }); + } + + public override async Task HandleAsync(GetPetByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Update an existing pet +/// + +public class UpdatePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/pet"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Update an existing pet"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + s.Responses[405] = "Validation exception"; + }); + } + + public override async Task HandleAsync(UpdatePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updates a pet in the store with form data +/// + +public class UpdatePetWithFormEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Updates a pet in the store with form data"; + s.RequestParam(r => r.PetId, "ID of pet that needs to be updated"); + s.RequestParam(r => r.Name, "Updated name of the pet"); + s.RequestParam(r => r.Status, "Updated status of the pet"); + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(UpdatePetWithFormRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// uploads an image +/// + +public class UploadFileEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}/uploadImage"); + + ResponseCache(60); + AllowAnonymous(); + AllowFileUploads(); + Description(x => + { + x.WithTags("pet"); + }); + + Summary(s => { + s.Summary = "uploads an image"; + s.RequestParam(r => r.PetId, "ID of pet to update"); + s.RequestParam(r => r.AdditionalMetadata, "Additional data to pass to server"); + s.RequestParam(r => r.File, "file to upload"); + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(UploadFileRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/PetApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/PetApiRequest.cs new file mode 100644 index 000000000000..64f1fae70020 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/PetApiRequest.cs @@ -0,0 +1,97 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class AddPetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class DeletePetRequest +{ + /// + /// Pet id to delete + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// + /// + [FastEndpoints.FromHeader] + public string? ApiKey { get; set; } +} +public class FindPetsByStatusRequest +{ + /// + /// Status values that need to be considered for filter + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("status")] + public List Status { get; set; } +} +public class FindPetsByTagsRequest +{ + /// + /// Tags to filter by + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("tags")] + public List Tags { get; set; } +} +public class GetPetByIdRequest +{ + /// + /// ID of pet to return + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } +} +public class UpdatePetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class UpdatePetWithFormRequest +{ + /// + /// ID of pet that needs to be updated + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Updated name of the pet + /// + [FastEndpoints.BindFrom("name")] + public string? Name { get; set; } + /// + /// Updated status of the pet + /// + [FastEndpoints.BindFrom("status")] + public string? Status { get; set; } +} +public class UploadFileRequest +{ + /// + /// ID of pet to update + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Additional data to pass to server + /// + [FastEndpoints.BindFrom("additionalMetadata")] + public string? AdditionalMetadata { get; set; } + /// + /// file to upload + /// + [FastEndpoints.BindFrom("file")] + public System.IO.Stream? File { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs new file mode 100644 index 000000000000..3cb0813fcf28 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs @@ -0,0 +1,157 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Delete purchase order by ID +/// + +public class DeleteOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/store/order/{orderId}"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of the order that needs to be deleted"); + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(DeleteOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Returns pet inventories by status +/// + +public class GetInventoryEndpoint : FastEndpoints.EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/v2/store/inventory"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + }); + + Summary(s => { + s.Summary = "Returns pet inventories by status"; + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find purchase order by ID +/// + +public class GetOrderByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/store/order/{orderId}"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of pet that needs to be fetched"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(GetOrderByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Place an order for a pet +/// + +public class PlaceOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/store/order"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Place an order for a pet"; + s.RequestParam(r => r.order, "order placed for purchasing the pet"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid Order"; + }); + } + + public override async Task HandleAsync(PlaceOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/StoreApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/StoreApiRequest.cs new file mode 100644 index 000000000000..2fabb077c420 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/StoreApiRequest.cs @@ -0,0 +1,35 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class DeleteOrderRequest +{ + /// + /// ID of the order that needs to be deleted + /// + [FastEndpoints.BindFrom("orderId")] + public string OrderId { get; set; } +} +public class GetInventoryRequest +{ +} +public class GetOrderByIdRequest +{ + /// + /// ID of pet that needs to be fetched + /// + [FastEndpoints.BindFrom("orderId")] + public long OrderId { get; set; } +} +public class PlaceOrderRequest +{ + /// + /// order placed for purchasing the pet + /// + [FastEndpoints.FromBody] + public Order order { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/UserApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/UserApiEndpoint.cs new file mode 100644 index 000000000000..d0cd5a4e9cd3 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/UserApiEndpoint.cs @@ -0,0 +1,310 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Create user +/// + +public class CreateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Create user"; + s.RequestParam(r => r.user, "Created user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithArrayInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithArray"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithArrayInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithListInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithList"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithListInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Delete user +/// + +public class DeleteUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/user/{username}"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete user"; + s.RequestParam(r => r.Username, "The name that needs to be deleted"); + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(DeleteUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Get user by user name +/// + +public class GetUserByNameEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/{username}"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Get user by user name"; + s.RequestParam(r => r.Username, "The name that needs to be fetched. Use user1 for testing."); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(GetUserByNameRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs user into the system +/// + +public class LoginUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/login"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Logs user into the system"; + s.RequestParam(r => r.Username, "The user name for login"); + s.RequestParam(r => r.Password, "The password for login in clear text"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username/password supplied"; + }); + } + + public override async Task HandleAsync(LoginUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs out current logged in user session +/// + +public class LogoutUserEndpoint : FastEndpoints.EndpointWithoutRequest +{ + public override void Configure() + { + Get("/v2/user/logout"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Logs out current logged in user session"; + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updated user +/// + +public class UpdateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/user/{username}"); + + ResponseCache(60); + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Updated user"; + s.RequestParam(r => r.Username, "name that need to be deleted"); + s.RequestParam(r => r.user, "Updated user object"); + s.Responses[400] = "Invalid user supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(UpdateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/UserApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/UserApiRequest.cs new file mode 100644 index 000000000000..90a7b22694f0 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Features/UserApiRequest.cs @@ -0,0 +1,77 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class CreateUserRequest +{ + /// + /// Created user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} +public class CreateUsersWithArrayInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class CreateUsersWithListInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class DeleteUserRequest +{ + /// + /// The name that needs to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class GetUserByNameRequest +{ + /// + /// The name that needs to be fetched. Use user1 for testing. + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class LoginUserRequest +{ + /// + /// The user name for login + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// The password for login in clear text + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("password")] + public string Password { get; set; } +} +public class LogoutUserRequest +{ +} +public class UpdateUserRequest +{ + /// + /// name that need to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// Updated user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/ApiResponse.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/ApiResponse.cs new file mode 100644 index 000000000000..3a60d51a90c4 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/ApiResponse.cs @@ -0,0 +1,14 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// Describes the result of uploading an image resource +/// +public class ApiResponse +{ + public int Code { get; set; } + public string Type { get; set; } + public string Message { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Category.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Category.cs new file mode 100644 index 000000000000..047bd8c0b2ae --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Category.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A category for a pet +/// +public class Category +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Order.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Order.cs new file mode 100644 index 000000000000..24d09c159a91 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Order.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// An order for a pets from the pet store +/// +public class Order +{ + public long Id { get; set; } + public long PetId { get; set; } + public int Quantity { get; set; } + public DateTime ShipDate { get; set; } + + /// + /// Order Status + /// + /// Order Status + public enum StatusEnum + { + + /// + /// Enum PlacedEnum for placed + /// + PlacedEnum = 1, + + /// + /// Enum ApprovedEnum for approved + /// + ApprovedEnum = 2, + + /// + /// Enum DeliveredEnum for delivered + /// + DeliveredEnum = 3 + } + + public StatusEnum Status { get; set; } + public bool Complete { get; set; } = false; +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Pet.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Pet.cs new file mode 100644 index 000000000000..73bf2b9cc1d3 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Pet.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A pet for sale in the pet store +/// +public class Pet +{ + public long Id { get; set; } + public Category Category { get; set; } + public string Name { get; set; } + public List PhotoUrls { get; set; } + public List Tags { get; set; } + + /// + /// pet status in the store + /// + /// pet status in the store + public enum StatusEnum + { + + /// + /// Enum AvailableEnum for available + /// + AvailableEnum = 1, + + /// + /// Enum PendingEnum for pending + /// + PendingEnum = 2, + + /// + /// Enum SoldEnum for sold + /// + SoldEnum = 3 + } + + public StatusEnum Status { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Tag.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Tag.cs new file mode 100644 index 000000000000..a1196dcb8f42 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/Tag.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A tag for a pet +/// +public class Tag +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/User.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/User.cs new file mode 100644 index 000000000000..61d5b852e0fc --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Models/User.cs @@ -0,0 +1,19 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A User who is purchasing from the pet store +/// +public class User +{ + public long Id { get; set; } + public string Username { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public string Phone { get; set; } + public int UserStatus { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..bda4876e3959 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Program.cs b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Program.cs new file mode 100644 index 000000000000..753c4cfd8236 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Program.cs @@ -0,0 +1,38 @@ +using FastEndpoints; +using FastEndpoints.Swagger; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services + + .AddFastEndpoints() + .SwaggerDocument(o => + { + o.DocumentSettings = s => + { + s.DocumentName = "OpenAPI Petstore"; + s.Title = "OpenAPI Petstore"; + s.Description = """ +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +"""; + s.Version = "1.0.0"; + }; + o.AutoTagPathSegmentIndex = 0; + }) + .AddResponseCaching() +; + +var app = builder.Build(); + +app + + .UseResponseCaching() + .UseFastEndpoints(x => + { + + }) + .UseSwaggerGen(); + +app.UseHttpsRedirection(); + +app.Run(); \ No newline at end of file diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Properties/launchSettings.json b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Properties/launchSettings.json new file mode 100644 index 000000000000..5b816a8d6069 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52621", + "sslPort": 44314 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7047;http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/appsettings.Development.json b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/appsettings.Development.json new file mode 100644 index 000000000000..b0bacf42851f --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/appsettings.json b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/appsettings.json new file mode 100644 index 000000000000..223027717b49 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/src/Org.OpenAPITools/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/.gitignore b/samples/server/petstore/aspnet/fastendpoints-useValidators/.gitignore new file mode 100644 index 000000000000..104b54414e4d --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/.gitignore @@ -0,0 +1,484 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from `dotnet new gitignore` + +# dotenv files +.env + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.idea + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator-ignore b/samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/.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/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/FILES new file mode 100644 index 000000000000..a48edd621111 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/FILES @@ -0,0 +1,21 @@ +.gitignore +.openapi-generator-ignore +Org.OpenAPITools.sln +README.md +src/Org.OpenAPITools/Features/PetApiEndpoint.cs +src/Org.OpenAPITools/Features/PetApiRequest.cs +src/Org.OpenAPITools/Features/StoreApiEndpoint.cs +src/Org.OpenAPITools/Features/StoreApiRequest.cs +src/Org.OpenAPITools/Features/UserApiEndpoint.cs +src/Org.OpenAPITools/Features/UserApiRequest.cs +src/Org.OpenAPITools/Models/ApiResponse.cs +src/Org.OpenAPITools/Models/Category.cs +src/Org.OpenAPITools/Models/Order.cs +src/Org.OpenAPITools/Models/Pet.cs +src/Org.OpenAPITools/Models/Tag.cs +src/Org.OpenAPITools/Models/User.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/Program.cs +src/Org.OpenAPITools/Properties/launchSettings.json +src/Org.OpenAPITools/appsettings.Development.json +src/Org.OpenAPITools/appsettings.json diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/VERSION b/samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/VERSION new file mode 100644 index 000000000000..6935482704c1 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.10.0-SNAPSHOT diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/Org.OpenAPITools.sln b/samples/server/petstore/aspnet/fastendpoints-useValidators/Org.OpenAPITools.sln new file mode 100644 index 000000000000..65acee29ff22 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/Org.OpenAPITools.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35122.118 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{39B801D8-74AA-465D-A637-4A2FFB905378}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {39B801D8-74AA-465D-A637-4A2FFB905378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {39B801D8-74AA-465D-A637-4A2FFB905378}.Debug|Any CPU.Build.0 = Debug|Any CPU + {39B801D8-74AA-465D-A637-4A2FFB905378}.Release|Any CPU.ActiveCfg = Release|Any CPU + {39B801D8-74AA-465D-A637-4A2FFB905378}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C7818EE1-09E2-4349-9696-8B1A9119974A} + EndGlobalSection +EndGlobal diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/README.md b/samples/server/petstore/aspnet/fastendpoints-useValidators/README.md new file mode 100644 index 000000000000..470d075bc345 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/README.md @@ -0,0 +1,16 @@ +# Org.OpenAPITools - FastEndpoints ASP.NET Server +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Documentation + +This generated project include basic configuration for FastEndpoints ASP.NET Server. +For more information regarding FastEndpoints, please visit the [FastEndpoints website](https://fast-endpoints.com). + +## Enabled Features + +The following feature have been enabled in this project : + + + +- [Validation](https://fast-endpoints.com/docs/validation) + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/PetApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/PetApiEndpoint.cs new file mode 100644 index 000000000000..c16f3bb68252 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/PetApiEndpoint.cs @@ -0,0 +1,316 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Add a new pet to the store +/// + +public class AddPetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Add a new pet to the store"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(AddPetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Deletes a pet +/// + +public class DeletePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Deletes a pet"; + s.RequestParam(r => r.PetId, "Pet id to delete"); + s.RequestParam(r => r.ApiKey, ""); + s.Responses[400] = "Invalid pet value"; + }); + } + + public override async Task HandleAsync(DeletePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by status +/// + +public class FindPetsByStatusEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByStatus"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by status"; + s.RequestParam(r => r.Status, "Status values that need to be considered for filter"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid status value"; + }); + } + + public override async Task HandleAsync(FindPetsByStatusRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by tags +/// +[Obsolete] +public class FindPetsByTagsEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByTags"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by tags"; + s.RequestParam(r => r.Tags, "Tags to filter by"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid tag value"; + }); + } + + public override async Task HandleAsync(FindPetsByTagsRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find pet by ID +/// + +public class GetPetByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find pet by ID"; + s.RequestParam(r => r.PetId, "ID of pet to return"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + }); + } + + public override async Task HandleAsync(GetPetByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Update an existing pet +/// + +public class UpdatePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/pet"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Update an existing pet"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + s.Responses[405] = "Validation exception"; + }); + } + + public override async Task HandleAsync(UpdatePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updates a pet in the store with form data +/// + +public class UpdatePetWithFormEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Updates a pet in the store with form data"; + s.RequestParam(r => r.PetId, "ID of pet that needs to be updated"); + s.RequestParam(r => r.Name, "Updated name of the pet"); + s.RequestParam(r => r.Status, "Updated status of the pet"); + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(UpdatePetWithFormRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// uploads an image +/// + +public class UploadFileEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}/uploadImage"); + + + AllowAnonymous(); + AllowFileUploads(); + Description(x => + { + x.WithTags("pet"); + }); + + Summary(s => { + s.Summary = "uploads an image"; + s.RequestParam(r => r.PetId, "ID of pet to update"); + s.RequestParam(r => r.AdditionalMetadata, "Additional data to pass to server"); + s.RequestParam(r => r.File, "file to upload"); + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(UploadFileRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/PetApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/PetApiRequest.cs new file mode 100644 index 000000000000..eba6e61c27b4 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/PetApiRequest.cs @@ -0,0 +1,170 @@ +using FluentValidation; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class AddPetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class DeletePetRequest +{ + /// + /// Pet id to delete + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// + /// + [FastEndpoints.FromHeader] + public string? ApiKey { get; set; } +} +public class FindPetsByStatusRequest +{ + /// + /// Status values that need to be considered for filter + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("status")] + public List Status { get; set; } +} +public class FindPetsByTagsRequest +{ + /// + /// Tags to filter by + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("tags")] + public List Tags { get; set; } +} +public class GetPetByIdRequest +{ + /// + /// ID of pet to return + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } +} +public class UpdatePetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class UpdatePetWithFormRequest +{ + /// + /// ID of pet that needs to be updated + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Updated name of the pet + /// + [FastEndpoints.BindFrom("name")] + public string? Name { get; set; } + /// + /// Updated status of the pet + /// + [FastEndpoints.BindFrom("status")] + public string? Status { get; set; } +} +public class UploadFileRequest +{ + /// + /// ID of pet to update + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Additional data to pass to server + /// + [FastEndpoints.BindFrom("additionalMetadata")] + public string? AdditionalMetadata { get; set; } + /// + /// file to upload + /// + [FastEndpoints.BindFrom("file")] + public System.IO.Stream? File { get; set; } +} + + + +public class AddPetRequestValidator : FastEndpoints.Validator +{ + public AddPetRequestValidator() + { + RuleFor(x => x.pet).NotEmpty(); + } +} + + +public class DeletePetRequestValidator : FastEndpoints.Validator +{ + public DeletePetRequestValidator() + { + RuleFor(x => x.PetId).NotEmpty(); + } +} + + +public class FindPetsByStatusRequestValidator : FastEndpoints.Validator +{ + public FindPetsByStatusRequestValidator() + { + RuleFor(x => x.Status).NotEmpty(); + } +} + + +public class FindPetsByTagsRequestValidator : FastEndpoints.Validator +{ + public FindPetsByTagsRequestValidator() + { + RuleFor(x => x.Tags).NotEmpty(); + } +} + + +public class GetPetByIdRequestValidator : FastEndpoints.Validator +{ + public GetPetByIdRequestValidator() + { + RuleFor(x => x.PetId).NotEmpty(); + } +} + + +public class UpdatePetRequestValidator : FastEndpoints.Validator +{ + public UpdatePetRequestValidator() + { + RuleFor(x => x.pet).NotEmpty(); + } +} + + +public class UpdatePetWithFormRequestValidator : FastEndpoints.Validator +{ + public UpdatePetWithFormRequestValidator() + { + RuleFor(x => x.PetId).NotEmpty(); + } +} + + +public class UploadFileRequestValidator : FastEndpoints.Validator +{ + public UploadFileRequestValidator() + { + RuleFor(x => x.PetId).NotEmpty(); + } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs new file mode 100644 index 000000000000..f4c803cf500a --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs @@ -0,0 +1,157 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Delete purchase order by ID +/// + +public class DeleteOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/store/order/{orderId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of the order that needs to be deleted"); + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(DeleteOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Returns pet inventories by status +/// + +public class GetInventoryEndpoint : FastEndpoints.EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/v2/store/inventory"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + }); + + Summary(s => { + s.Summary = "Returns pet inventories by status"; + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find purchase order by ID +/// + +public class GetOrderByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/store/order/{orderId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of pet that needs to be fetched"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(GetOrderByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Place an order for a pet +/// + +public class PlaceOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/store/order"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Place an order for a pet"; + s.RequestParam(r => r.order, "order placed for purchasing the pet"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid Order"; + }); + } + + public override async Task HandleAsync(PlaceOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/StoreApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/StoreApiRequest.cs new file mode 100644 index 000000000000..9195a66de1fd --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/StoreApiRequest.cs @@ -0,0 +1,71 @@ +using FluentValidation; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class DeleteOrderRequest +{ + /// + /// ID of the order that needs to be deleted + /// + [FastEndpoints.BindFrom("orderId")] + public string OrderId { get; set; } +} +public class GetInventoryRequest +{ +} +public class GetOrderByIdRequest +{ + /// + /// ID of pet that needs to be fetched + /// + [FastEndpoints.BindFrom("orderId")] + public long OrderId { get; set; } +} +public class PlaceOrderRequest +{ + /// + /// order placed for purchasing the pet + /// + [FastEndpoints.FromBody] + public Order order { get; set; } +} + + + +public class DeleteOrderRequestValidator : FastEndpoints.Validator +{ + public DeleteOrderRequestValidator() + { + RuleFor(x => x.OrderId).NotEmpty(); + } +} + + +public class GetInventoryRequestValidator : FastEndpoints.Validator +{ + public GetInventoryRequestValidator() + { + } +} + + +public class GetOrderByIdRequestValidator : FastEndpoints.Validator +{ + public GetOrderByIdRequestValidator() + { + RuleFor(x => x.OrderId).NotEmpty(); + } +} + + +public class PlaceOrderRequestValidator : FastEndpoints.Validator +{ + public PlaceOrderRequestValidator() + { + RuleFor(x => x.order).NotEmpty(); + } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/UserApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/UserApiEndpoint.cs new file mode 100644 index 000000000000..53f62c803fc2 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/UserApiEndpoint.cs @@ -0,0 +1,310 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Create user +/// + +public class CreateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Create user"; + s.RequestParam(r => r.user, "Created user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithArrayInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithArray"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithArrayInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithListInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithList"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithListInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Delete user +/// + +public class DeleteUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete user"; + s.RequestParam(r => r.Username, "The name that needs to be deleted"); + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(DeleteUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Get user by user name +/// + +public class GetUserByNameEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Get user by user name"; + s.RequestParam(r => r.Username, "The name that needs to be fetched. Use user1 for testing."); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(GetUserByNameRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs user into the system +/// + +public class LoginUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/login"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Logs user into the system"; + s.RequestParam(r => r.Username, "The user name for login"); + s.RequestParam(r => r.Password, "The password for login in clear text"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username/password supplied"; + }); + } + + public override async Task HandleAsync(LoginUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs out current logged in user session +/// + +public class LogoutUserEndpoint : FastEndpoints.EndpointWithoutRequest +{ + public override void Configure() + { + Get("/v2/user/logout"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Logs out current logged in user session"; + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updated user +/// + +public class UpdateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Updated user"; + s.RequestParam(r => r.Username, "name that need to be deleted"); + s.RequestParam(r => r.user, "Updated user object"); + s.Responses[400] = "Invalid user supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(UpdateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/UserApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/UserApiRequest.cs new file mode 100644 index 000000000000..64fb1d730a5b --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Features/UserApiRequest.cs @@ -0,0 +1,151 @@ +using FluentValidation; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class CreateUserRequest +{ + /// + /// Created user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} +public class CreateUsersWithArrayInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class CreateUsersWithListInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class DeleteUserRequest +{ + /// + /// The name that needs to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class GetUserByNameRequest +{ + /// + /// The name that needs to be fetched. Use user1 for testing. + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class LoginUserRequest +{ + /// + /// The user name for login + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// The password for login in clear text + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("password")] + public string Password { get; set; } +} +public class LogoutUserRequest +{ +} +public class UpdateUserRequest +{ + /// + /// name that need to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// Updated user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} + + + +public class CreateUserRequestValidator : FastEndpoints.Validator +{ + public CreateUserRequestValidator() + { + RuleFor(x => x.user).NotEmpty(); + } +} + + +public class CreateUsersWithArrayInputRequestValidator : FastEndpoints.Validator +{ + public CreateUsersWithArrayInputRequestValidator() + { + RuleFor(x => x.user).NotEmpty(); + } +} + + +public class CreateUsersWithListInputRequestValidator : FastEndpoints.Validator +{ + public CreateUsersWithListInputRequestValidator() + { + RuleFor(x => x.user).NotEmpty(); + } +} + + +public class DeleteUserRequestValidator : FastEndpoints.Validator +{ + public DeleteUserRequestValidator() + { + RuleFor(x => x.Username).NotEmpty(); + } +} + + +public class GetUserByNameRequestValidator : FastEndpoints.Validator +{ + public GetUserByNameRequestValidator() + { + RuleFor(x => x.Username).NotEmpty(); + } +} + + +public class LoginUserRequestValidator : FastEndpoints.Validator +{ + public LoginUserRequestValidator() + { + RuleFor(x => x.Username).NotEmpty(); + RuleFor(x => x.Password).NotEmpty(); + } +} + + +public class LogoutUserRequestValidator : FastEndpoints.Validator +{ + public LogoutUserRequestValidator() + { + } +} + + +public class UpdateUserRequestValidator : FastEndpoints.Validator +{ + public UpdateUserRequestValidator() + { + RuleFor(x => x.Username).NotEmpty(); + RuleFor(x => x.user).NotEmpty(); + } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/ApiResponse.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/ApiResponse.cs new file mode 100644 index 000000000000..3a60d51a90c4 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/ApiResponse.cs @@ -0,0 +1,14 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// Describes the result of uploading an image resource +/// +public class ApiResponse +{ + public int Code { get; set; } + public string Type { get; set; } + public string Message { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Category.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Category.cs new file mode 100644 index 000000000000..047bd8c0b2ae --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Category.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A category for a pet +/// +public class Category +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Order.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Order.cs new file mode 100644 index 000000000000..24d09c159a91 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Order.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// An order for a pets from the pet store +/// +public class Order +{ + public long Id { get; set; } + public long PetId { get; set; } + public int Quantity { get; set; } + public DateTime ShipDate { get; set; } + + /// + /// Order Status + /// + /// Order Status + public enum StatusEnum + { + + /// + /// Enum PlacedEnum for placed + /// + PlacedEnum = 1, + + /// + /// Enum ApprovedEnum for approved + /// + ApprovedEnum = 2, + + /// + /// Enum DeliveredEnum for delivered + /// + DeliveredEnum = 3 + } + + public StatusEnum Status { get; set; } + public bool Complete { get; set; } = false; +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Pet.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Pet.cs new file mode 100644 index 000000000000..73bf2b9cc1d3 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Pet.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A pet for sale in the pet store +/// +public class Pet +{ + public long Id { get; set; } + public Category Category { get; set; } + public string Name { get; set; } + public List PhotoUrls { get; set; } + public List Tags { get; set; } + + /// + /// pet status in the store + /// + /// pet status in the store + public enum StatusEnum + { + + /// + /// Enum AvailableEnum for available + /// + AvailableEnum = 1, + + /// + /// Enum PendingEnum for pending + /// + PendingEnum = 2, + + /// + /// Enum SoldEnum for sold + /// + SoldEnum = 3 + } + + public StatusEnum Status { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Tag.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Tag.cs new file mode 100644 index 000000000000..a1196dcb8f42 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/Tag.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A tag for a pet +/// +public class Tag +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/User.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/User.cs new file mode 100644 index 000000000000..61d5b852e0fc --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Models/User.cs @@ -0,0 +1,19 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A User who is purchasing from the pet store +/// +public class User +{ + public long Id { get; set; } + public string Username { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public string Phone { get; set; } + public int UserStatus { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..bda4876e3959 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Program.cs b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Program.cs new file mode 100644 index 000000000000..0d9f468982c4 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Program.cs @@ -0,0 +1,37 @@ +using FastEndpoints; +using FastEndpoints.Swagger; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services + + .AddFastEndpoints() + .SwaggerDocument(o => + { + o.DocumentSettings = s => + { + s.DocumentName = "OpenAPI Petstore"; + s.Title = "OpenAPI Petstore"; + s.Description = """ +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +"""; + s.Version = "1.0.0"; + }; + o.AutoTagPathSegmentIndex = 0; + }) + +; + +var app = builder.Build(); + +app + + .UseFastEndpoints(x => + { + + }) + .UseSwaggerGen(); + +app.UseHttpsRedirection(); + +app.Run(); \ No newline at end of file diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Properties/launchSettings.json b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Properties/launchSettings.json new file mode 100644 index 000000000000..5b816a8d6069 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52621", + "sslPort": 44314 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7047;http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/appsettings.Development.json b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/appsettings.Development.json new file mode 100644 index 000000000000..b0bacf42851f --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/appsettings.json b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/appsettings.json new file mode 100644 index 000000000000..223027717b49 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/src/Org.OpenAPITools/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/server/petstore/aspnet/fastendpoints/.gitignore b/samples/server/petstore/aspnet/fastendpoints/.gitignore new file mode 100644 index 000000000000..104b54414e4d --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/.gitignore @@ -0,0 +1,484 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from `dotnet new gitignore` + +# dotenv files +.env + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.idea + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp diff --git a/samples/server/petstore/aspnet/fastendpoints/.openapi-generator-ignore b/samples/server/petstore/aspnet/fastendpoints/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/.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/server/petstore/aspnet/fastendpoints/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints/.openapi-generator/FILES new file mode 100644 index 000000000000..a48edd621111 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/.openapi-generator/FILES @@ -0,0 +1,21 @@ +.gitignore +.openapi-generator-ignore +Org.OpenAPITools.sln +README.md +src/Org.OpenAPITools/Features/PetApiEndpoint.cs +src/Org.OpenAPITools/Features/PetApiRequest.cs +src/Org.OpenAPITools/Features/StoreApiEndpoint.cs +src/Org.OpenAPITools/Features/StoreApiRequest.cs +src/Org.OpenAPITools/Features/UserApiEndpoint.cs +src/Org.OpenAPITools/Features/UserApiRequest.cs +src/Org.OpenAPITools/Models/ApiResponse.cs +src/Org.OpenAPITools/Models/Category.cs +src/Org.OpenAPITools/Models/Order.cs +src/Org.OpenAPITools/Models/Pet.cs +src/Org.OpenAPITools/Models/Tag.cs +src/Org.OpenAPITools/Models/User.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/Program.cs +src/Org.OpenAPITools/Properties/launchSettings.json +src/Org.OpenAPITools/appsettings.Development.json +src/Org.OpenAPITools/appsettings.json diff --git a/samples/server/petstore/aspnet/fastendpoints/.openapi-generator/VERSION b/samples/server/petstore/aspnet/fastendpoints/.openapi-generator/VERSION new file mode 100644 index 000000000000..6935482704c1 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.10.0-SNAPSHOT diff --git a/samples/server/petstore/aspnet/fastendpoints/Org.OpenAPITools.sln b/samples/server/petstore/aspnet/fastendpoints/Org.OpenAPITools.sln new file mode 100644 index 000000000000..547e610a43b0 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/Org.OpenAPITools.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35122.118 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{5F32A09C-5CB7-4917-83AB-CD7D1A04FF49}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5F32A09C-5CB7-4917-83AB-CD7D1A04FF49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F32A09C-5CB7-4917-83AB-CD7D1A04FF49}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F32A09C-5CB7-4917-83AB-CD7D1A04FF49}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F32A09C-5CB7-4917-83AB-CD7D1A04FF49}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4BC03566-F5F9-4E45-A835-8FA3B2B524B9} + EndGlobalSection +EndGlobal diff --git a/samples/server/petstore/aspnet/fastendpoints/README.md b/samples/server/petstore/aspnet/fastendpoints/README.md new file mode 100644 index 000000000000..9a63b1e91fa3 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/README.md @@ -0,0 +1,16 @@ +# Org.OpenAPITools - FastEndpoints ASP.NET Server +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Documentation + +This generated project include basic configuration for FastEndpoints ASP.NET Server. +For more information regarding FastEndpoints, please visit the [FastEndpoints website](https://fast-endpoints.com). + +## Enabled Features + +The following feature have been enabled in this project : +- No additional features enabled + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/PetApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/PetApiEndpoint.cs new file mode 100644 index 000000000000..c16f3bb68252 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/PetApiEndpoint.cs @@ -0,0 +1,316 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Add a new pet to the store +/// + +public class AddPetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Add a new pet to the store"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(AddPetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Deletes a pet +/// + +public class DeletePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Deletes a pet"; + s.RequestParam(r => r.PetId, "Pet id to delete"); + s.RequestParam(r => r.ApiKey, ""); + s.Responses[400] = "Invalid pet value"; + }); + } + + public override async Task HandleAsync(DeletePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by status +/// + +public class FindPetsByStatusEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByStatus"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by status"; + s.RequestParam(r => r.Status, "Status values that need to be considered for filter"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid status value"; + }); + } + + public override async Task HandleAsync(FindPetsByStatusRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Finds Pets by tags +/// +[Obsolete] +public class FindPetsByTagsEndpoint : FastEndpoints.Endpoint> +{ + public override void Configure() + { + Get("/v2/pet/findByTags"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Finds Pets by tags"; + s.RequestParam(r => r.Tags, "Tags to filter by"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid tag value"; + }); + } + + public override async Task HandleAsync(FindPetsByTagsRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find pet by ID +/// + +public class GetPetByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find pet by ID"; + s.RequestParam(r => r.PetId, "ID of pet to return"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + }); + } + + public override async Task HandleAsync(GetPetByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Update an existing pet +/// + +public class UpdatePetEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/pet"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Update an existing pet"; + s.RequestParam(r => r.pet, "Pet object that needs to be added to the store"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Pet not found"; + s.Responses[405] = "Validation exception"; + }); + } + + public override async Task HandleAsync(UpdatePetRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updates a pet in the store with form data +/// + +public class UpdatePetWithFormEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("pet"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 405); + }); + + Summary(s => { + s.Summary = "Updates a pet in the store with form data"; + s.RequestParam(r => r.PetId, "ID of pet that needs to be updated"); + s.RequestParam(r => r.Name, "Updated name of the pet"); + s.RequestParam(r => r.Status, "Updated status of the pet"); + s.Responses[405] = "Invalid input"; + }); + } + + public override async Task HandleAsync(UpdatePetWithFormRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// uploads an image +/// + +public class UploadFileEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/pet/{petId}/uploadImage"); + + + AllowAnonymous(); + AllowFileUploads(); + Description(x => + { + x.WithTags("pet"); + }); + + Summary(s => { + s.Summary = "uploads an image"; + s.RequestParam(r => r.PetId, "ID of pet to update"); + s.RequestParam(r => r.AdditionalMetadata, "Additional data to pass to server"); + s.RequestParam(r => r.File, "file to upload"); + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(UploadFileRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/PetApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/PetApiRequest.cs new file mode 100644 index 000000000000..64f1fae70020 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/PetApiRequest.cs @@ -0,0 +1,97 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class AddPetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class DeletePetRequest +{ + /// + /// Pet id to delete + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// + /// + [FastEndpoints.FromHeader] + public string? ApiKey { get; set; } +} +public class FindPetsByStatusRequest +{ + /// + /// Status values that need to be considered for filter + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("status")] + public List Status { get; set; } +} +public class FindPetsByTagsRequest +{ + /// + /// Tags to filter by + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("tags")] + public List Tags { get; set; } +} +public class GetPetByIdRequest +{ + /// + /// ID of pet to return + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } +} +public class UpdatePetRequest +{ + /// + /// Pet object that needs to be added to the store + /// + [FastEndpoints.FromBody] + public Pet pet { get; set; } +} +public class UpdatePetWithFormRequest +{ + /// + /// ID of pet that needs to be updated + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Updated name of the pet + /// + [FastEndpoints.BindFrom("name")] + public string? Name { get; set; } + /// + /// Updated status of the pet + /// + [FastEndpoints.BindFrom("status")] + public string? Status { get; set; } +} +public class UploadFileRequest +{ + /// + /// ID of pet to update + /// + [FastEndpoints.BindFrom("petId")] + public long PetId { get; set; } + /// + /// Additional data to pass to server + /// + [FastEndpoints.BindFrom("additionalMetadata")] + public string? AdditionalMetadata { get; set; } + /// + /// file to upload + /// + [FastEndpoints.BindFrom("file")] + public System.IO.Stream? File { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs new file mode 100644 index 000000000000..f4c803cf500a --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/StoreApiEndpoint.cs @@ -0,0 +1,157 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Delete purchase order by ID +/// + +public class DeleteOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/store/order/{orderId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of the order that needs to be deleted"); + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(DeleteOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Returns pet inventories by status +/// + +public class GetInventoryEndpoint : FastEndpoints.EndpointWithoutRequest> +{ + public override void Configure() + { + Get("/v2/store/inventory"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + }); + + Summary(s => { + s.Summary = "Returns pet inventories by status"; + s.Responses[200] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Find purchase order by ID +/// + +public class GetOrderByIdEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/store/order/{orderId}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Find purchase order by ID"; + s.RequestParam(r => r.OrderId, "ID of pet that needs to be fetched"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid ID supplied"; + s.Responses[404] = "Order not found"; + }); + } + + public override async Task HandleAsync(GetOrderByIdRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Place an order for a pet +/// + +public class PlaceOrderEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/store/order"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("store"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Place an order for a pet"; + s.RequestParam(r => r.order, "order placed for purchasing the pet"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid Order"; + }); + } + + public override async Task HandleAsync(PlaceOrderRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/StoreApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/StoreApiRequest.cs new file mode 100644 index 000000000000..2fabb077c420 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/StoreApiRequest.cs @@ -0,0 +1,35 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class DeleteOrderRequest +{ + /// + /// ID of the order that needs to be deleted + /// + [FastEndpoints.BindFrom("orderId")] + public string OrderId { get; set; } +} +public class GetInventoryRequest +{ +} +public class GetOrderByIdRequest +{ + /// + /// ID of pet that needs to be fetched + /// + [FastEndpoints.BindFrom("orderId")] + public long OrderId { get; set; } +} +public class PlaceOrderRequest +{ + /// + /// order placed for purchasing the pet + /// + [FastEndpoints.FromBody] + public Order order { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/UserApiEndpoint.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/UserApiEndpoint.cs new file mode 100644 index 000000000000..53f62c803fc2 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/UserApiEndpoint.cs @@ -0,0 +1,310 @@ +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + + +/// +/// Create user +/// + +public class CreateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Create user"; + s.RequestParam(r => r.user, "Created user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithArrayInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithArray"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithArrayInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Creates list of users with given input array +/// + +public class CreateUsersWithListInputEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Post("/v2/user/createWithList"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Creates list of users with given input array"; + s.RequestParam(r => r.user, "List of user object"); + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CreateUsersWithListInputRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Delete user +/// + +public class DeleteUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Delete("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Delete user"; + s.RequestParam(r => r.Username, "The name that needs to be deleted"); + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(DeleteUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Get user by user name +/// + +public class GetUserByNameEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Get user by user name"; + s.RequestParam(r => r.Username, "The name that needs to be fetched. Use user1 for testing."); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(GetUserByNameRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs user into the system +/// + +public class LoginUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Get("/v2/user/login"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + }); + + Summary(s => { + s.Summary = "Logs user into the system"; + s.RequestParam(r => r.Username, "The user name for login"); + s.RequestParam(r => r.Password, "The password for login in clear text"); + s.Responses[200] = "successful operation"; + s.Responses[400] = "Invalid username/password supplied"; + }); + } + + public override async Task HandleAsync(LoginUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Logs out current logged in user session +/// + +public class LogoutUserEndpoint : FastEndpoints.EndpointWithoutRequest +{ + public override void Configure() + { + Get("/v2/user/logout"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 0); + }); + + Summary(s => { + s.Summary = "Logs out current logged in user session"; + s.Responses[0] = "successful operation"; + }); + } + + public override async Task HandleAsync(CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + + +/// +/// Updated user +/// + +public class UpdateUserEndpoint : FastEndpoints.Endpoint +{ + public override void Configure() + { + Put("/v2/user/{username}"); + + + AllowAnonymous(); + + Description(x => + { + x.WithTags("user"); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 400); + FastEndpoints.RouteHandlerBuilderExtensions.ProducesProblemFE(x, 404); + }); + + Summary(s => { + s.Summary = "Updated user"; + s.RequestParam(r => r.Username, "name that need to be deleted"); + s.RequestParam(r => r.user, "Updated user object"); + s.Responses[400] = "Invalid user supplied"; + s.Responses[404] = "User not found"; + }); + } + + public override async Task HandleAsync(UpdateUserRequest req, CancellationToken ct) + { + //Response = new() + //{ + //... + //}; + //return Task.CompletedTask; + } +} + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/UserApiRequest.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/UserApiRequest.cs new file mode 100644 index 000000000000..90a7b22694f0 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Features/UserApiRequest.cs @@ -0,0 +1,77 @@ + +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Features; + + +public class CreateUserRequest +{ + /// + /// Created user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} +public class CreateUsersWithArrayInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class CreateUsersWithListInputRequest +{ + /// + /// List of user object + /// + [FastEndpoints.FromBody] + public List user { get; set; } +} +public class DeleteUserRequest +{ + /// + /// The name that needs to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class GetUserByNameRequest +{ + /// + /// The name that needs to be fetched. Use user1 for testing. + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } +} +public class LoginUserRequest +{ + /// + /// The user name for login + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// The password for login in clear text + /// + [FastEndpoints.QueryParam, FastEndpoints.BindFrom("password")] + public string Password { get; set; } +} +public class LogoutUserRequest +{ +} +public class UpdateUserRequest +{ + /// + /// name that need to be deleted + /// + [FastEndpoints.BindFrom("username")] + public string Username { get; set; } + /// + /// Updated user object + /// + [FastEndpoints.FromBody] + public User user { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/ApiResponse.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/ApiResponse.cs new file mode 100644 index 000000000000..3a60d51a90c4 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/ApiResponse.cs @@ -0,0 +1,14 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// Describes the result of uploading an image resource +/// +public class ApiResponse +{ + public int Code { get; set; } + public string Type { get; set; } + public string Message { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Category.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Category.cs new file mode 100644 index 000000000000..047bd8c0b2ae --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Category.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A category for a pet +/// +public class Category +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Order.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Order.cs new file mode 100644 index 000000000000..24d09c159a91 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Order.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// An order for a pets from the pet store +/// +public class Order +{ + public long Id { get; set; } + public long PetId { get; set; } + public int Quantity { get; set; } + public DateTime ShipDate { get; set; } + + /// + /// Order Status + /// + /// Order Status + public enum StatusEnum + { + + /// + /// Enum PlacedEnum for placed + /// + PlacedEnum = 1, + + /// + /// Enum ApprovedEnum for approved + /// + ApprovedEnum = 2, + + /// + /// Enum DeliveredEnum for delivered + /// + DeliveredEnum = 3 + } + + public StatusEnum Status { get; set; } + public bool Complete { get; set; } = false; +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Pet.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Pet.cs new file mode 100644 index 000000000000..73bf2b9cc1d3 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Pet.cs @@ -0,0 +1,41 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A pet for sale in the pet store +/// +public class Pet +{ + public long Id { get; set; } + public Category Category { get; set; } + public string Name { get; set; } + public List PhotoUrls { get; set; } + public List Tags { get; set; } + + /// + /// pet status in the store + /// + /// pet status in the store + public enum StatusEnum + { + + /// + /// Enum AvailableEnum for available + /// + AvailableEnum = 1, + + /// + /// Enum PendingEnum for pending + /// + PendingEnum = 2, + + /// + /// Enum SoldEnum for sold + /// + SoldEnum = 3 + } + + public StatusEnum Status { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Tag.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Tag.cs new file mode 100644 index 000000000000..a1196dcb8f42 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/Tag.cs @@ -0,0 +1,13 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A tag for a pet +/// +public class Tag +{ + public long Id { get; set; } + public string Name { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/User.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/User.cs new file mode 100644 index 000000000000..61d5b852e0fc --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Models/User.cs @@ -0,0 +1,19 @@ +namespace Org.OpenAPITools.Models; + + +/// +/// A User who is purchasing from the pet store +/// +public class User +{ + public long Id { get; set; } + public string Username { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public string Phone { get; set; } + public int UserStatus { get; set; } +} + + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..bda4876e3959 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Program.cs b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Program.cs new file mode 100644 index 000000000000..0d9f468982c4 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Program.cs @@ -0,0 +1,37 @@ +using FastEndpoints; +using FastEndpoints.Swagger; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services + + .AddFastEndpoints() + .SwaggerDocument(o => + { + o.DocumentSettings = s => + { + s.DocumentName = "OpenAPI Petstore"; + s.Title = "OpenAPI Petstore"; + s.Description = """ +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +"""; + s.Version = "1.0.0"; + }; + o.AutoTagPathSegmentIndex = 0; + }) + +; + +var app = builder.Build(); + +app + + .UseFastEndpoints(x => + { + + }) + .UseSwaggerGen(); + +app.UseHttpsRedirection(); + +app.Run(); \ No newline at end of file diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Properties/launchSettings.json b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Properties/launchSettings.json new file mode 100644 index 000000000000..5b816a8d6069 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52621", + "sslPort": 44314 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7047;http://localhost:5198", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/appsettings.Development.json b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/appsettings.Development.json new file mode 100644 index 000000000000..b0bacf42851f --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/appsettings.json b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/appsettings.json new file mode 100644 index 000000000000..223027717b49 --- /dev/null +++ b/samples/server/petstore/aspnet/fastendpoints/src/Org.OpenAPITools/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} From 28e02fc1a2b7f7634d2e0ac71e093cb3138c282d Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 7 Nov 2024 20:33:49 +0800 Subject: [PATCH 6/7] update aspnet samples --- .../fastendpoints-useApiVersioning/.openapi-generator/FILES | 1 - .../fastendpoints-useAuthentication/.openapi-generator/FILES | 1 - .../fastendpoints-useProblemDetails/.openapi-generator/FILES | 1 - .../aspnet/fastendpoints-useRecords/.openapi-generator/FILES | 1 - .../fastendpoints-useResponseCaching/.openapi-generator/FILES | 1 - .../aspnet/fastendpoints-useValidators/.openapi-generator/FILES | 1 - .../petstore/aspnet/fastendpoints/.openapi-generator/FILES | 1 - 7 files changed, 7 deletions(-) diff --git a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/FILES index a48edd621111..572dc1a825a6 100644 --- a/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/FILES +++ b/samples/server/petstore/aspnet/fastendpoints-useApiVersioning/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md src/Org.OpenAPITools/Features/PetApiEndpoint.cs diff --git a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/FILES index aa462debdf48..6b4618e03a3c 100644 --- a/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/FILES +++ b/samples/server/petstore/aspnet/fastendpoints-useAuthentication/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md src/Org.OpenAPITools/Features/LoginRequest.cs diff --git a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/FILES index a48edd621111..572dc1a825a6 100644 --- a/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/FILES +++ b/samples/server/petstore/aspnet/fastendpoints-useProblemDetails/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md src/Org.OpenAPITools/Features/PetApiEndpoint.cs diff --git a/samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/FILES index a48edd621111..572dc1a825a6 100644 --- a/samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/FILES +++ b/samples/server/petstore/aspnet/fastendpoints-useRecords/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md src/Org.OpenAPITools/Features/PetApiEndpoint.cs diff --git a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/FILES index a48edd621111..572dc1a825a6 100644 --- a/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/FILES +++ b/samples/server/petstore/aspnet/fastendpoints-useResponseCaching/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md src/Org.OpenAPITools/Features/PetApiEndpoint.cs diff --git a/samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/FILES index a48edd621111..572dc1a825a6 100644 --- a/samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/FILES +++ b/samples/server/petstore/aspnet/fastendpoints-useValidators/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md src/Org.OpenAPITools/Features/PetApiEndpoint.cs diff --git a/samples/server/petstore/aspnet/fastendpoints/.openapi-generator/FILES b/samples/server/petstore/aspnet/fastendpoints/.openapi-generator/FILES index a48edd621111..572dc1a825a6 100644 --- a/samples/server/petstore/aspnet/fastendpoints/.openapi-generator/FILES +++ b/samples/server/petstore/aspnet/fastendpoints/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md src/Org.OpenAPITools/Features/PetApiEndpoint.cs From 2c38d0de35dbad9b0b7ea743601aa272c8deaf5a Mon Sep 17 00:00:00 2001 From: Jules Ivanic Date: Fri, 8 Nov 2024 00:33:33 +1100 Subject: [PATCH 7/7] [typescript-fetch][Fix] `oneOf` models are generated without `...ToJSONTyped` functions but models referencing still try to import (#20046) * Fix #19858 * re-generate the samples --- .../main/resources/typescript-fetch/modelGeneric.mustache | 8 ++++---- .../main/resources/typescript-fetch/modelOneOf.mustache | 6 +++++- .../self-import-issue/models/AbstractUserDto.ts | 8 ++++---- .../self-import-issue/models/BranchDto.ts | 8 ++++---- .../models/InternalAuthenticatedUserDto.ts | 8 ++++---- .../models/RemoteAuthenticatedUserDto.ts | 8 ++++---- .../typescript-fetch/builds/allOf-nullable/models/Club.ts | 8 ++++---- .../builds/allOf-nullable/models/Owner.ts | 8 ++++---- .../typescript-fetch/builds/allOf-readonly/models/Club.ts | 8 ++++---- .../builds/allOf-readonly/models/Owner.ts | 8 ++++---- .../default-v3.0/models/AdditionalPropertiesClass.ts | 8 ++++---- .../builds/default-v3.0/models/AllOfWithSingleRef.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/Animal.ts | 8 ++++---- .../default-v3.0/models/ArrayOfArrayOfNumberOnly.ts | 8 ++++---- .../builds/default-v3.0/models/ArrayOfNumberOnly.ts | 8 ++++---- .../builds/default-v3.0/models/ArrayTest.ts | 8 ++++---- .../builds/default-v3.0/models/Capitalization.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/Cat.ts | 8 ++++---- .../builds/default-v3.0/models/Category.ts | 8 ++++---- .../builds/default-v3.0/models/ChildWithNullable.ts | 8 ++++---- .../builds/default-v3.0/models/ClassModel.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/Client.ts | 8 ++++---- .../builds/default-v3.0/models/DeprecatedObject.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/Dog.ts | 8 ++++---- .../builds/default-v3.0/models/EnumArrays.ts | 8 ++++---- .../builds/default-v3.0/models/EnumTest.ts | 8 ++++---- .../default-v3.0/models/FakeBigDecimalMap200Response.ts | 8 ++++---- .../builds/default-v3.0/models/FileSchemaTestClass.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/Foo.ts | 8 ++++---- .../builds/default-v3.0/models/FooGetDefaultResponse.ts | 8 ++++---- .../builds/default-v3.0/models/FormatTest.ts | 8 ++++---- .../builds/default-v3.0/models/HasOnlyReadOnly.ts | 8 ++++---- .../builds/default-v3.0/models/HealthCheckResult.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/List.ts | 8 ++++---- .../builds/default-v3.0/models/MapTest.ts | 8 ++++---- .../models/MixedPropertiesAndAdditionalPropertiesClass.ts | 8 ++++---- .../builds/default-v3.0/models/Model200Response.ts | 8 ++++---- .../builds/default-v3.0/models/ModelApiResponse.ts | 8 ++++---- .../builds/default-v3.0/models/ModelFile.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/Name.ts | 8 ++++---- .../builds/default-v3.0/models/NullableClass.ts | 8 ++++---- .../builds/default-v3.0/models/NumberOnly.ts | 8 ++++---- .../default-v3.0/models/ObjectWithDeprecatedFields.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/Order.ts | 8 ++++---- .../builds/default-v3.0/models/OuterComposite.ts | 8 ++++---- .../default-v3.0/models/OuterObjectWithEnumProperty.ts | 8 ++++---- .../builds/default-v3.0/models/ParentWithNullable.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/Pet.ts | 8 ++++---- .../builds/default-v3.0/models/ReadOnlyFirst.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/Return.ts | 8 ++++---- .../builds/default-v3.0/models/SpecialModelName.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/Tag.ts | 8 ++++---- .../TestInlineFreeformAdditionalPropertiesRequest.ts | 8 ++++---- .../typescript-fetch/builds/default-v3.0/models/User.ts | 8 ++++---- .../typescript-fetch/builds/default/models/Category.ts | 8 ++++---- .../builds/default/models/ModelApiResponse.ts | 8 ++++---- .../typescript-fetch/builds/default/models/Order.ts | 8 ++++---- .../typescript-fetch/builds/default/models/Pet.ts | 8 ++++---- .../typescript-fetch/builds/default/models/Tag.ts | 8 ++++---- .../typescript-fetch/builds/default/models/User.ts | 8 ++++---- .../builds/enum/models/EnumPatternObject.ts | 8 ++++---- .../enum/models/FakeEnumRequestGetInline200Response.ts | 8 ++++---- .../builds/es6-target/src/models/Category.ts | 8 ++++---- .../builds/es6-target/src/models/ModelApiResponse.ts | 8 ++++---- .../builds/es6-target/src/models/Order.ts | 8 ++++---- .../typescript-fetch/builds/es6-target/src/models/Pet.ts | 8 ++++---- .../typescript-fetch/builds/es6-target/src/models/Tag.ts | 8 ++++---- .../typescript-fetch/builds/es6-target/src/models/User.ts | 8 ++++---- .../builds/multiple-parameters/models/Category.ts | 8 ++++---- .../builds/multiple-parameters/models/ModelApiResponse.ts | 8 ++++---- .../builds/multiple-parameters/models/Order.ts | 8 ++++---- .../builds/multiple-parameters/models/Pet.ts | 8 ++++---- .../builds/multiple-parameters/models/Tag.ts | 8 ++++---- .../builds/multiple-parameters/models/User.ts | 8 ++++---- .../typescript-fetch/builds/oneOf/models/TestA.ts | 8 ++++---- .../typescript-fetch/builds/oneOf/models/TestB.ts | 8 ++++---- .../typescript-fetch/builds/oneOf/models/TestResponse.ts | 6 +++++- .../prefix-parameter-interfaces/src/models/Category.ts | 8 ++++---- .../src/models/ModelApiResponse.ts | 8 ++++---- .../prefix-parameter-interfaces/src/models/Order.ts | 8 ++++---- .../builds/prefix-parameter-interfaces/src/models/Pet.ts | 8 ++++---- .../builds/prefix-parameter-interfaces/src/models/Tag.ts | 8 ++++---- .../builds/prefix-parameter-interfaces/src/models/User.ts | 8 ++++---- .../builds/sagas-and-records/src/models/Category.ts | 8 ++++---- .../src/models/DefaultMetaOnlyResponse.ts | 8 ++++---- .../src/models/FindPetsByStatusResponse.ts | 8 ++++---- .../src/models/FindPetsByUserResponse.ts | 8 ++++---- .../src/models/GetBehaviorPermissionsResponse.ts | 8 ++++---- .../src/models/GetBehaviorTypeResponse.ts | 8 ++++---- .../src/models/GetMatchingPartsResponse.ts | 8 ++++---- .../src/models/GetPetPartTypeResponse.ts | 8 ++++---- .../builds/sagas-and-records/src/models/ItemId.ts | 8 ++++---- .../builds/sagas-and-records/src/models/MatchingParts.ts | 8 ++++---- .../sagas-and-records/src/models/ModelApiResponse.ts | 8 ++++---- .../builds/sagas-and-records/src/models/ModelError.ts | 8 ++++---- .../builds/sagas-and-records/src/models/Order.ts | 8 ++++---- .../builds/sagas-and-records/src/models/Part.ts | 8 ++++---- .../builds/sagas-and-records/src/models/Pet.ts | 8 ++++---- .../sagas-and-records/src/models/PetRegionsResponse.ts | 8 ++++---- .../builds/sagas-and-records/src/models/ResponseMeta.ts | 8 ++++---- .../builds/sagas-and-records/src/models/Tag.ts | 8 ++++---- .../builds/sagas-and-records/src/models/User.ts | 8 ++++---- .../models/AdditionalPropertiesClass.ts | 8 ++++---- .../snakecase-discriminator/models/AllOfWithSingleRef.ts | 8 ++++---- .../builds/snakecase-discriminator/models/Animal.ts | 8 ++++---- .../models/ArrayOfArrayOfNumberOnly.ts | 8 ++++---- .../snakecase-discriminator/models/ArrayOfNumberOnly.ts | 8 ++++---- .../builds/snakecase-discriminator/models/ArrayTest.ts | 8 ++++---- .../snakecase-discriminator/models/Capitalization.ts | 8 ++++---- .../builds/snakecase-discriminator/models/Cat.ts | 8 ++++---- .../builds/snakecase-discriminator/models/Category.ts | 8 ++++---- .../builds/snakecase-discriminator/models/ClassModel.ts | 8 ++++---- .../builds/snakecase-discriminator/models/Client.ts | 8 ++++---- .../snakecase-discriminator/models/DeprecatedObject.ts | 8 ++++---- .../builds/snakecase-discriminator/models/Dog.ts | 8 ++++---- .../builds/snakecase-discriminator/models/EnumArrays.ts | 8 ++++---- .../builds/snakecase-discriminator/models/EnumTest.ts | 8 ++++---- .../models/FakeBigDecimalMap200Response.ts | 8 ++++---- .../snakecase-discriminator/models/FileSchemaTestClass.ts | 8 ++++---- .../builds/snakecase-discriminator/models/Foo.ts | 8 ++++---- .../models/FooGetDefaultResponse.ts | 8 ++++---- .../builds/snakecase-discriminator/models/FormatTest.ts | 8 ++++---- .../snakecase-discriminator/models/HasOnlyReadOnly.ts | 8 ++++---- .../snakecase-discriminator/models/HealthCheckResult.ts | 8 ++++---- .../builds/snakecase-discriminator/models/List.ts | 8 ++++---- .../builds/snakecase-discriminator/models/MapTest.ts | 8 ++++---- .../models/MixedPropertiesAndAdditionalPropertiesClass.ts | 8 ++++---- .../snakecase-discriminator/models/Model200Response.ts | 8 ++++---- .../snakecase-discriminator/models/ModelApiResponse.ts | 8 ++++---- .../builds/snakecase-discriminator/models/ModelFile.ts | 8 ++++---- .../builds/snakecase-discriminator/models/Name.ts | 8 ++++---- .../snakecase-discriminator/models/NullableClass.ts | 8 ++++---- .../builds/snakecase-discriminator/models/NumberOnly.ts | 8 ++++---- .../models/ObjectWithDeprecatedFields.ts | 8 ++++---- .../builds/snakecase-discriminator/models/Order.ts | 8 ++++---- .../snakecase-discriminator/models/OuterComposite.ts | 8 ++++---- .../models/OuterObjectWithEnumProperty.ts | 8 ++++---- .../builds/snakecase-discriminator/models/Pet.ts | 8 ++++---- .../snakecase-discriminator/models/ReadOnlyFirst.ts | 8 ++++---- .../builds/snakecase-discriminator/models/Return.ts | 8 ++++---- .../snakecase-discriminator/models/SpecialModelName.ts | 8 ++++---- .../builds/snakecase-discriminator/models/Tag.ts | 8 ++++---- .../builds/snakecase-discriminator/models/User.ts | 8 ++++---- .../builds/validation-attributes/models/Category.ts | 8 ++++---- .../validation-attributes/models/ModelApiResponse.ts | 8 ++++---- .../builds/validation-attributes/models/Order.ts | 8 ++++---- .../builds/validation-attributes/models/Pet.ts | 8 ++++---- .../builds/validation-attributes/models/Tag.ts | 8 ++++---- .../builds/validation-attributes/models/User.ts | 8 ++++---- .../builds/with-interfaces/models/Category.ts | 8 ++++---- .../builds/with-interfaces/models/ModelApiResponse.ts | 8 ++++---- .../builds/with-interfaces/models/Order.ts | 8 ++++---- .../typescript-fetch/builds/with-interfaces/models/Pet.ts | 8 ++++---- .../typescript-fetch/builds/with-interfaces/models/Tag.ts | 8 ++++---- .../builds/with-interfaces/models/User.ts | 8 ++++---- .../builds/with-npm-version/src/models/Category.ts | 8 ++++---- .../with-npm-version/src/models/ModelApiResponse.ts | 8 ++++---- .../builds/with-npm-version/src/models/Order.ts | 8 ++++---- .../builds/with-npm-version/src/models/Pet.ts | 8 ++++---- .../builds/with-npm-version/src/models/Tag.ts | 8 ++++---- .../builds/with-npm-version/src/models/User.ts | 8 ++++---- .../builds/with-string-enums/models/EnumPatternObject.ts | 8 ++++---- .../models/FakeEnumRequestGetInline200Response.ts | 8 ++++---- 163 files changed, 654 insertions(+), 646 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache index bf91a7f3db67..9ad18a9ccc76 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache @@ -108,11 +108,11 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole {{/hasVars}} } - export function {{classname}}ToJSON(json: any): {{classname}} { - return {{classname}}ToJSONTyped(json, false); - } +export function {{classname}}ToJSON(json: any): {{classname}} { + return {{classname}}ToJSONTyped(json, false); +} - export function {{classname}}ToJSONTyped(value?: {{#hasReadOnly}}Omit<{{classname}}, {{#readOnlyVars}}'{{baseName}}'{{^-last}}|{{/-last}}{{/readOnlyVars}}>{{/hasReadOnly}}{{^hasReadOnly}}{{classname}}{{/hasReadOnly}} | null, ignoreDiscriminator: boolean = false): any { +export function {{classname}}ToJSONTyped(value?: {{#hasReadOnly}}Omit<{{classname}}, {{#readOnlyVars}}'{{baseName}}'{{^-last}}|{{/-last}}{{/readOnlyVars}}>{{/hasReadOnly}}{{^hasReadOnly}}{{classname}}{{/hasReadOnly}} | null, ignoreDiscriminator: boolean = false): any { {{#hasVars}} if (value == null) { return value; diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache index 0decac17419f..c02a0df9da73 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache @@ -41,7 +41,11 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole {{/discriminator}} } -export function {{classname}}ToJSON(value?: {{classname}} | null): any { +export function {{classname}}ToJSON(json: any): any { + return {{classname}}ToJSONTyped(json, false); +} + +export function {{classname}}ToJSONTyped(value?: {{classname}} | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/others/typescript-fetch/self-import-issue/models/AbstractUserDto.ts b/samples/client/others/typescript-fetch/self-import-issue/models/AbstractUserDto.ts index 53bf52f50bb9..29e0d20f36f3 100644 --- a/samples/client/others/typescript-fetch/self-import-issue/models/AbstractUserDto.ts +++ b/samples/client/others/typescript-fetch/self-import-issue/models/AbstractUserDto.ts @@ -80,11 +80,11 @@ export function AbstractUserDtoFromJSONTyped(json: any, ignoreDiscriminator: boo }; } - export function AbstractUserDtoToJSON(json: any): AbstractUserDto { - return AbstractUserDtoToJSONTyped(json, false); - } +export function AbstractUserDtoToJSON(json: any): AbstractUserDto { + return AbstractUserDtoToJSONTyped(json, false); +} - export function AbstractUserDtoToJSONTyped(value?: AbstractUserDto | null, ignoreDiscriminator: boolean = false): any { +export function AbstractUserDtoToJSONTyped(value?: AbstractUserDto | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/others/typescript-fetch/self-import-issue/models/BranchDto.ts b/samples/client/others/typescript-fetch/self-import-issue/models/BranchDto.ts index 5de31fa073f8..2eeefff17c66 100644 --- a/samples/client/others/typescript-fetch/self-import-issue/models/BranchDto.ts +++ b/samples/client/others/typescript-fetch/self-import-issue/models/BranchDto.ts @@ -48,11 +48,11 @@ export function BranchDtoFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function BranchDtoToJSON(json: any): BranchDto { - return BranchDtoToJSONTyped(json, false); - } +export function BranchDtoToJSON(json: any): BranchDto { + return BranchDtoToJSONTyped(json, false); +} - export function BranchDtoToJSONTyped(value?: BranchDto | null, ignoreDiscriminator: boolean = false): any { +export function BranchDtoToJSONTyped(value?: BranchDto | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/others/typescript-fetch/self-import-issue/models/InternalAuthenticatedUserDto.ts b/samples/client/others/typescript-fetch/self-import-issue/models/InternalAuthenticatedUserDto.ts index 14a4f768ac4f..7a8e69f01231 100644 --- a/samples/client/others/typescript-fetch/self-import-issue/models/InternalAuthenticatedUserDto.ts +++ b/samples/client/others/typescript-fetch/self-import-issue/models/InternalAuthenticatedUserDto.ts @@ -51,11 +51,11 @@ export function InternalAuthenticatedUserDtoFromJSONTyped(json: any, ignoreDiscr return json; } - export function InternalAuthenticatedUserDtoToJSON(json: any): InternalAuthenticatedUserDto { - return InternalAuthenticatedUserDtoToJSONTyped(json, false); - } +export function InternalAuthenticatedUserDtoToJSON(json: any): InternalAuthenticatedUserDto { + return InternalAuthenticatedUserDtoToJSONTyped(json, false); +} - export function InternalAuthenticatedUserDtoToJSONTyped(value?: InternalAuthenticatedUserDto | null, ignoreDiscriminator: boolean = false): any { +export function InternalAuthenticatedUserDtoToJSONTyped(value?: InternalAuthenticatedUserDto | null, ignoreDiscriminator: boolean = false): any { return value; } diff --git a/samples/client/others/typescript-fetch/self-import-issue/models/RemoteAuthenticatedUserDto.ts b/samples/client/others/typescript-fetch/self-import-issue/models/RemoteAuthenticatedUserDto.ts index 6791e2e1216f..4fb8c1916e9d 100644 --- a/samples/client/others/typescript-fetch/self-import-issue/models/RemoteAuthenticatedUserDto.ts +++ b/samples/client/others/typescript-fetch/self-import-issue/models/RemoteAuthenticatedUserDto.ts @@ -51,11 +51,11 @@ export function RemoteAuthenticatedUserDtoFromJSONTyped(json: any, ignoreDiscrim return json; } - export function RemoteAuthenticatedUserDtoToJSON(json: any): RemoteAuthenticatedUserDto { - return RemoteAuthenticatedUserDtoToJSONTyped(json, false); - } +export function RemoteAuthenticatedUserDtoToJSON(json: any): RemoteAuthenticatedUserDto { + return RemoteAuthenticatedUserDtoToJSONTyped(json, false); +} - export function RemoteAuthenticatedUserDtoToJSONTyped(value?: RemoteAuthenticatedUserDto | null, ignoreDiscriminator: boolean = false): any { +export function RemoteAuthenticatedUserDtoToJSONTyped(value?: RemoteAuthenticatedUserDto | null, ignoreDiscriminator: boolean = false): any { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts index cce6b72e169a..840229f07010 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.ts @@ -56,11 +56,11 @@ export function ClubFromJSONTyped(json: any, ignoreDiscriminator: boolean): Club }; } - export function ClubToJSON(json: any): Club { - return ClubToJSONTyped(json, false); - } +export function ClubToJSON(json: any): Club { + return ClubToJSONTyped(json, false); +} - export function ClubToJSONTyped(value?: Club | null, ignoreDiscriminator: boolean = false): any { +export function ClubToJSONTyped(value?: Club | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts index 0ed8fde3a930..a0dcefdc827e 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.ts @@ -48,11 +48,11 @@ export function OwnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Own }; } - export function OwnerToJSON(json: any): Owner { - return OwnerToJSONTyped(json, false); - } +export function OwnerToJSON(json: any): Owner { + return OwnerToJSONTyped(json, false); +} - export function OwnerToJSONTyped(value?: Owner | null, ignoreDiscriminator: boolean = false): any { +export function OwnerToJSONTyped(value?: Owner | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts index b815ab07d2c6..b6659c9de23b 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Club.ts @@ -56,11 +56,11 @@ export function ClubFromJSONTyped(json: any, ignoreDiscriminator: boolean): Club }; } - export function ClubToJSON(json: any): Club { - return ClubToJSONTyped(json, false); - } +export function ClubToJSON(json: any): Club { + return ClubToJSONTyped(json, false); +} - export function ClubToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { +export function ClubToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts index 0ed8fde3a930..a0dcefdc827e 100644 --- a/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts +++ b/samples/client/petstore/typescript-fetch/builds/allOf-readonly/models/Owner.ts @@ -48,11 +48,11 @@ export function OwnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Own }; } - export function OwnerToJSON(json: any): Owner { - return OwnerToJSONTyped(json, false); - } +export function OwnerToJSON(json: any): Owner { + return OwnerToJSONTyped(json, false); +} - export function OwnerToJSONTyped(value?: Owner | null, ignoreDiscriminator: boolean = false): any { +export function OwnerToJSONTyped(value?: Owner | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts index c15b937e8a1c..d470576ef7d3 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AdditionalPropertiesClass.ts @@ -55,11 +55,11 @@ export function AdditionalPropertiesClassFromJSONTyped(json: any, ignoreDiscrimi }; } - export function AdditionalPropertiesClassToJSON(json: any): AdditionalPropertiesClass { - return AdditionalPropertiesClassToJSONTyped(json, false); - } +export function AdditionalPropertiesClassToJSON(json: any): AdditionalPropertiesClass { + return AdditionalPropertiesClassToJSONTyped(json, false); +} - export function AdditionalPropertiesClassToJSONTyped(value?: AdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { +export function AdditionalPropertiesClassToJSONTyped(value?: AdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts index 826ea603e2db..cbd15b990c6c 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/AllOfWithSingleRef.ts @@ -65,11 +65,11 @@ export function AllOfWithSingleRefFromJSONTyped(json: any, ignoreDiscriminator: }; } - export function AllOfWithSingleRefToJSON(json: any): AllOfWithSingleRef { - return AllOfWithSingleRefToJSONTyped(json, false); - } +export function AllOfWithSingleRefToJSON(json: any): AllOfWithSingleRef { + return AllOfWithSingleRefToJSONTyped(json, false); +} - export function AllOfWithSingleRefToJSONTyped(value?: AllOfWithSingleRef | null, ignoreDiscriminator: boolean = false): any { +export function AllOfWithSingleRefToJSONTyped(value?: AllOfWithSingleRef | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts index 0f87e6dd367e..f1289f027f15 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Animal.ts @@ -66,11 +66,11 @@ export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): An }; } - export function AnimalToJSON(json: any): Animal { - return AnimalToJSONTyped(json, false); - } +export function AnimalToJSON(json: any): Animal { + return AnimalToJSONTyped(json, false); +} - export function AnimalToJSONTyped(value?: Animal | null, ignoreDiscriminator: boolean = false): any { +export function AnimalToJSONTyped(value?: Animal | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts index 18264d15d7cb..3792b9134b4a 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfArrayOfNumberOnly.ts @@ -48,11 +48,11 @@ export function ArrayOfArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscrimin }; } - export function ArrayOfArrayOfNumberOnlyToJSON(json: any): ArrayOfArrayOfNumberOnly { - return ArrayOfArrayOfNumberOnlyToJSONTyped(json, false); - } +export function ArrayOfArrayOfNumberOnlyToJSON(json: any): ArrayOfArrayOfNumberOnly { + return ArrayOfArrayOfNumberOnlyToJSONTyped(json, false); +} - export function ArrayOfArrayOfNumberOnlyToJSONTyped(value?: ArrayOfArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { +export function ArrayOfArrayOfNumberOnlyToJSONTyped(value?: ArrayOfArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts index fa5c6dc5edd1..40fbb3c6326d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayOfNumberOnly.ts @@ -48,11 +48,11 @@ export function ArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: b }; } - export function ArrayOfNumberOnlyToJSON(json: any): ArrayOfNumberOnly { - return ArrayOfNumberOnlyToJSONTyped(json, false); - } +export function ArrayOfNumberOnlyToJSON(json: any): ArrayOfNumberOnly { + return ArrayOfNumberOnlyToJSONTyped(json, false); +} - export function ArrayOfNumberOnlyToJSONTyped(value?: ArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { +export function ArrayOfNumberOnlyToJSONTyped(value?: ArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts index b31c80207b2f..9f3c53288826 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ArrayTest.ts @@ -70,11 +70,11 @@ export function ArrayTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function ArrayTestToJSON(json: any): ArrayTest { - return ArrayTestToJSONTyped(json, false); - } +export function ArrayTestToJSON(json: any): ArrayTest { + return ArrayTestToJSONTyped(json, false); +} - export function ArrayTestToJSONTyped(value?: ArrayTest | null, ignoreDiscriminator: boolean = false): any { +export function ArrayTestToJSONTyped(value?: ArrayTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts index ace2ede88477..9c6a2be5afb6 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Capitalization.ts @@ -84,11 +84,11 @@ export function CapitalizationFromJSONTyped(json: any, ignoreDiscriminator: bool }; } - export function CapitalizationToJSON(json: any): Capitalization { - return CapitalizationToJSONTyped(json, false); - } +export function CapitalizationToJSON(json: any): Capitalization { + return CapitalizationToJSONTyped(json, false); +} - export function CapitalizationToJSONTyped(value?: Capitalization | null, ignoreDiscriminator: boolean = false): any { +export function CapitalizationToJSONTyped(value?: Capitalization | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts index a1b44d02d26d..ba0e19539237 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Cat.ts @@ -56,11 +56,11 @@ export function CatFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cat { }; } - export function CatToJSON(json: any): Cat { - return CatToJSONTyped(json, false); - } +export function CatToJSON(json: any): Cat { + return CatToJSONTyped(json, false); +} - export function CatToJSONTyped(value?: Cat | null, ignoreDiscriminator: boolean = false): any { +export function CatToJSONTyped(value?: Cat | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts index 7c8caddd4969..e4047d919b2b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Category.ts @@ -56,11 +56,11 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function CategoryToJSON(json: any): Category { - return CategoryToJSONTyped(json, false); - } +export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); +} - export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { +export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts index 0a5dd717f208..87e1106a1dd8 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ChildWithNullable.ts @@ -58,11 +58,11 @@ export function ChildWithNullableFromJSONTyped(json: any, ignoreDiscriminator: b }; } - export function ChildWithNullableToJSON(json: any): ChildWithNullable { - return ChildWithNullableToJSONTyped(json, false); - } +export function ChildWithNullableToJSON(json: any): ChildWithNullable { + return ChildWithNullableToJSONTyped(json, false); +} - export function ChildWithNullableToJSONTyped(value?: ChildWithNullable | null, ignoreDiscriminator: boolean = false): any { +export function ChildWithNullableToJSONTyped(value?: ChildWithNullable | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts index 813177eb3d50..cba5bbc353cf 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ClassModel.ts @@ -48,11 +48,11 @@ export function ClassModelFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } - export function ClassModelToJSON(json: any): ClassModel { - return ClassModelToJSONTyped(json, false); - } +export function ClassModelToJSON(json: any): ClassModel { + return ClassModelToJSONTyped(json, false); +} - export function ClassModelToJSONTyped(value?: ClassModel | null, ignoreDiscriminator: boolean = false): any { +export function ClassModelToJSONTyped(value?: ClassModel | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts index c6aa7163b0b3..b9509a4421f9 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Client.ts @@ -48,11 +48,11 @@ export function ClientFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cl }; } - export function ClientToJSON(json: any): Client { - return ClientToJSONTyped(json, false); - } +export function ClientToJSON(json: any): Client { + return ClientToJSONTyped(json, false); +} - export function ClientToJSONTyped(value?: Client | null, ignoreDiscriminator: boolean = false): any { +export function ClientToJSONTyped(value?: Client | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts index d2acf418fded..2b22f28ddfe7 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/DeprecatedObject.ts @@ -48,11 +48,11 @@ export function DeprecatedObjectFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function DeprecatedObjectToJSON(json: any): DeprecatedObject { - return DeprecatedObjectToJSONTyped(json, false); - } +export function DeprecatedObjectToJSON(json: any): DeprecatedObject { + return DeprecatedObjectToJSONTyped(json, false); +} - export function DeprecatedObjectToJSONTyped(value?: DeprecatedObject | null, ignoreDiscriminator: boolean = false): any { +export function DeprecatedObjectToJSONTyped(value?: DeprecatedObject | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts index 1d66d5c04bf8..6662a88d3bee 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Dog.ts @@ -56,11 +56,11 @@ export function DogFromJSONTyped(json: any, ignoreDiscriminator: boolean): Dog { }; } - export function DogToJSON(json: any): Dog { - return DogToJSONTyped(json, false); - } +export function DogToJSON(json: any): Dog { + return DogToJSONTyped(json, false); +} - export function DogToJSONTyped(value?: Dog | null, ignoreDiscriminator: boolean = false): any { +export function DogToJSONTyped(value?: Dog | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts index 27f42e0a652b..b30860b8e8bb 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumArrays.ts @@ -75,11 +75,11 @@ export function EnumArraysFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } - export function EnumArraysToJSON(json: any): EnumArrays { - return EnumArraysToJSONTyped(json, false); - } +export function EnumArraysToJSON(json: any): EnumArrays { + return EnumArraysToJSONTyped(json, false); +} - export function EnumArraysToJSONTyped(value?: EnumArrays | null, ignoreDiscriminator: boolean = false): any { +export function EnumArraysToJSONTyped(value?: EnumArrays | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts index de99ab4dc662..0097912a9561 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumTest.ts @@ -167,11 +167,11 @@ export function EnumTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function EnumTestToJSON(json: any): EnumTest { - return EnumTestToJSONTyped(json, false); - } +export function EnumTestToJSON(json: any): EnumTest { + return EnumTestToJSONTyped(json, false); +} - export function EnumTestToJSONTyped(value?: EnumTest | null, ignoreDiscriminator: boolean = false): any { +export function EnumTestToJSONTyped(value?: EnumTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts index 5c97b9928efa..54458419a514 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts @@ -55,11 +55,11 @@ export function FakeBigDecimalMap200ResponseFromJSONTyped(json: any, ignoreDiscr }; } - export function FakeBigDecimalMap200ResponseToJSON(json: any): FakeBigDecimalMap200Response { - return FakeBigDecimalMap200ResponseToJSONTyped(json, false); - } +export function FakeBigDecimalMap200ResponseToJSON(json: any): FakeBigDecimalMap200Response { + return FakeBigDecimalMap200ResponseToJSONTyped(json, false); +} - export function FakeBigDecimalMap200ResponseToJSONTyped(value?: FakeBigDecimalMap200Response | null, ignoreDiscriminator: boolean = false): any { +export function FakeBigDecimalMap200ResponseToJSONTyped(value?: FakeBigDecimalMap200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts index 557abed7403e..87a77f497fbc 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FileSchemaTestClass.ts @@ -55,11 +55,11 @@ export function FileSchemaTestClassFromJSONTyped(json: any, ignoreDiscriminator: }; } - export function FileSchemaTestClassToJSON(json: any): FileSchemaTestClass { - return FileSchemaTestClassToJSONTyped(json, false); - } +export function FileSchemaTestClassToJSON(json: any): FileSchemaTestClass { + return FileSchemaTestClassToJSONTyped(json, false); +} - export function FileSchemaTestClassToJSONTyped(value?: FileSchemaTestClass | null, ignoreDiscriminator: boolean = false): any { +export function FileSchemaTestClassToJSONTyped(value?: FileSchemaTestClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts index 118b6190f280..ca208c88e2f8 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Foo.ts @@ -48,11 +48,11 @@ export function FooFromJSONTyped(json: any, ignoreDiscriminator: boolean): Foo { }; } - export function FooToJSON(json: any): Foo { - return FooToJSONTyped(json, false); - } +export function FooToJSON(json: any): Foo { + return FooToJSONTyped(json, false); +} - export function FooToJSONTyped(value?: Foo | null, ignoreDiscriminator: boolean = false): any { +export function FooToJSONTyped(value?: Foo | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts index 721b08a2242d..1199e6b3793a 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FooGetDefaultResponse.ts @@ -56,11 +56,11 @@ export function FooGetDefaultResponseFromJSONTyped(json: any, ignoreDiscriminato }; } - export function FooGetDefaultResponseToJSON(json: any): FooGetDefaultResponse { - return FooGetDefaultResponseToJSONTyped(json, false); - } +export function FooGetDefaultResponseToJSON(json: any): FooGetDefaultResponse { + return FooGetDefaultResponseToJSONTyped(json, false); +} - export function FooGetDefaultResponseToJSONTyped(value?: FooGetDefaultResponse | null, ignoreDiscriminator: boolean = false): any { +export function FooGetDefaultResponseToJSONTyped(value?: FooGetDefaultResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts index df41354802ae..33aed92595aa 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FormatTest.ts @@ -157,11 +157,11 @@ export function FormatTestFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } - export function FormatTestToJSON(json: any): FormatTest { - return FormatTestToJSONTyped(json, false); - } +export function FormatTestToJSON(json: any): FormatTest { + return FormatTestToJSONTyped(json, false); +} - export function FormatTestToJSONTyped(value?: FormatTest | null, ignoreDiscriminator: boolean = false): any { +export function FormatTestToJSONTyped(value?: FormatTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts index 0eb9accdc1f5..59019adf1993 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HasOnlyReadOnly.ts @@ -55,11 +55,11 @@ export function HasOnlyReadOnlyFromJSONTyped(json: any, ignoreDiscriminator: boo }; } - export function HasOnlyReadOnlyToJSON(json: any): HasOnlyReadOnly { - return HasOnlyReadOnlyToJSONTyped(json, false); - } +export function HasOnlyReadOnlyToJSON(json: any): HasOnlyReadOnly { + return HasOnlyReadOnlyToJSONTyped(json, false); +} - export function HasOnlyReadOnlyToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { +export function HasOnlyReadOnlyToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts index c62de4d9fb83..e8683a11f338 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/HealthCheckResult.ts @@ -48,11 +48,11 @@ export function HealthCheckResultFromJSONTyped(json: any, ignoreDiscriminator: b }; } - export function HealthCheckResultToJSON(json: any): HealthCheckResult { - return HealthCheckResultToJSONTyped(json, false); - } +export function HealthCheckResultToJSON(json: any): HealthCheckResult { + return HealthCheckResultToJSONTyped(json, false); +} - export function HealthCheckResultToJSONTyped(value?: HealthCheckResult | null, ignoreDiscriminator: boolean = false): any { +export function HealthCheckResultToJSONTyped(value?: HealthCheckResult | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts index fb9a30ea0e5b..21dd83e2c200 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/List.ts @@ -48,11 +48,11 @@ export function ListFromJSONTyped(json: any, ignoreDiscriminator: boolean): List }; } - export function ListToJSON(json: any): List { - return ListToJSONTyped(json, false); - } +export function ListToJSON(json: any): List { + return ListToJSONTyped(json, false); +} - export function ListToJSONTyped(value?: List | null, ignoreDiscriminator: boolean = false): any { +export function ListToJSONTyped(value?: List | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts index a88b84fd1027..753c30a6cf93 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MapTest.ts @@ -80,11 +80,11 @@ export function MapTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): M }; } - export function MapTestToJSON(json: any): MapTest { - return MapTestToJSONTyped(json, false); - } +export function MapTestToJSON(json: any): MapTest { + return MapTestToJSONTyped(json, false); +} - export function MapTestToJSONTyped(value?: MapTest | null, ignoreDiscriminator: boolean = false): any { +export function MapTestToJSONTyped(value?: MapTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts index 1f69153ef85c..5466bc5177e2 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/MixedPropertiesAndAdditionalPropertiesClass.ts @@ -70,11 +70,11 @@ export function MixedPropertiesAndAdditionalPropertiesClassFromJSONTyped(json: a }; } - export function MixedPropertiesAndAdditionalPropertiesClassToJSON(json: any): MixedPropertiesAndAdditionalPropertiesClass { - return MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(json, false); - } +export function MixedPropertiesAndAdditionalPropertiesClassToJSON(json: any): MixedPropertiesAndAdditionalPropertiesClass { + return MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(json, false); +} - export function MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(value?: MixedPropertiesAndAdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { +export function MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(value?: MixedPropertiesAndAdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts index af0066b276eb..b0a30640133e 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Model200Response.ts @@ -55,11 +55,11 @@ export function Model200ResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function Model200ResponseToJSON(json: any): Model200Response { - return Model200ResponseToJSONTyped(json, false); - } +export function Model200ResponseToJSON(json: any): Model200Response { + return Model200ResponseToJSONTyped(json, false); +} - export function Model200ResponseToJSONTyped(value?: Model200Response | null, ignoreDiscriminator: boolean = false): any { +export function Model200ResponseToJSONTyped(value?: Model200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts index a505854c2d71..355b5f76e428 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelApiResponse.ts @@ -62,11 +62,11 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function ModelApiResponseToJSON(json: any): ModelApiResponse { - return ModelApiResponseToJSONTyped(json, false); - } +export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); +} - export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { +export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts index ef6eee2c53c7..4b63fcfe25f2 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ModelFile.ts @@ -48,11 +48,11 @@ export function ModelFileFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function ModelFileToJSON(json: any): ModelFile { - return ModelFileToJSONTyped(json, false); - } +export function ModelFileToJSON(json: any): ModelFile { + return ModelFileToJSONTyped(json, false); +} - export function ModelFileToJSONTyped(value?: ModelFile | null, ignoreDiscriminator: boolean = false): any { +export function ModelFileToJSONTyped(value?: ModelFile | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts index 1c957bff4d65..b999bdccb1d0 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Name.ts @@ -70,11 +70,11 @@ export function NameFromJSONTyped(json: any, ignoreDiscriminator: boolean): Name }; } - export function NameToJSON(json: any): Name { - return NameToJSONTyped(json, false); - } +export function NameToJSON(json: any): Name { + return NameToJSONTyped(json, false); +} - export function NameToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { +export function NameToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts index 4f32da1c0ced..3c2a165a7bd9 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NullableClass.ts @@ -127,11 +127,11 @@ export function NullableClassFromJSONTyped(json: any, ignoreDiscriminator: boole }; } - export function NullableClassToJSON(json: any): NullableClass { - return NullableClassToJSONTyped(json, false); - } +export function NullableClassToJSON(json: any): NullableClass { + return NullableClassToJSONTyped(json, false); +} - export function NullableClassToJSONTyped(value?: NullableClass | null, ignoreDiscriminator: boolean = false): any { +export function NullableClassToJSONTyped(value?: NullableClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts index d9e19a6d9d86..01ffc388797b 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/NumberOnly.ts @@ -48,11 +48,11 @@ export function NumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } - export function NumberOnlyToJSON(json: any): NumberOnly { - return NumberOnlyToJSONTyped(json, false); - } +export function NumberOnlyToJSON(json: any): NumberOnly { + return NumberOnlyToJSONTyped(json, false); +} - export function NumberOnlyToJSONTyped(value?: NumberOnly | null, ignoreDiscriminator: boolean = false): any { +export function NumberOnlyToJSONTyped(value?: NumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts index 88b028733508..8dd72d9dfde3 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ObjectWithDeprecatedFields.ts @@ -80,11 +80,11 @@ export function ObjectWithDeprecatedFieldsFromJSONTyped(json: any, ignoreDiscrim }; } - export function ObjectWithDeprecatedFieldsToJSON(json: any): ObjectWithDeprecatedFields { - return ObjectWithDeprecatedFieldsToJSONTyped(json, false); - } +export function ObjectWithDeprecatedFieldsToJSON(json: any): ObjectWithDeprecatedFields { + return ObjectWithDeprecatedFieldsToJSONTyped(json, false); +} - export function ObjectWithDeprecatedFieldsToJSONTyped(value?: ObjectWithDeprecatedFields | null, ignoreDiscriminator: boolean = false): any { +export function ObjectWithDeprecatedFieldsToJSONTyped(value?: ObjectWithDeprecatedFields | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts index ef82efcce508..2e9a77af0484 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Order.ts @@ -95,11 +95,11 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } - export function OrderToJSON(json: any): Order { - return OrderToJSONTyped(json, false); - } +export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); +} - export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { +export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts index ab4303f03c3a..ffb9d35f81ae 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterComposite.ts @@ -62,11 +62,11 @@ export function OuterCompositeFromJSONTyped(json: any, ignoreDiscriminator: bool }; } - export function OuterCompositeToJSON(json: any): OuterComposite { - return OuterCompositeToJSONTyped(json, false); - } +export function OuterCompositeToJSON(json: any): OuterComposite { + return OuterCompositeToJSONTyped(json, false); +} - export function OuterCompositeToJSONTyped(value?: OuterComposite | null, ignoreDiscriminator: boolean = false): any { +export function OuterCompositeToJSONTyped(value?: OuterComposite | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts index a533ca482d8b..cc02ae41cfec 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts @@ -59,11 +59,11 @@ export function OuterObjectWithEnumPropertyFromJSONTyped(json: any, ignoreDiscri }; } - export function OuterObjectWithEnumPropertyToJSON(json: any): OuterObjectWithEnumProperty { - return OuterObjectWithEnumPropertyToJSONTyped(json, false); - } +export function OuterObjectWithEnumPropertyToJSON(json: any): OuterObjectWithEnumProperty { + return OuterObjectWithEnumPropertyToJSONTyped(json, false); +} - export function OuterObjectWithEnumPropertyToJSONTyped(value?: OuterObjectWithEnumProperty | null, ignoreDiscriminator: boolean = false): any { +export function OuterObjectWithEnumPropertyToJSONTyped(value?: OuterObjectWithEnumProperty | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts index a7a8016b7adc..8b64d83d50f9 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ParentWithNullable.ts @@ -71,11 +71,11 @@ export function ParentWithNullableFromJSONTyped(json: any, ignoreDiscriminator: }; } - export function ParentWithNullableToJSON(json: any): ParentWithNullable { - return ParentWithNullableToJSONTyped(json, false); - } +export function ParentWithNullableToJSON(json: any): ParentWithNullable { + return ParentWithNullableToJSONTyped(json, false); +} - export function ParentWithNullableToJSONTyped(value?: ParentWithNullable | null, ignoreDiscriminator: boolean = false): any { +export function ParentWithNullableToJSONTyped(value?: ParentWithNullable | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts index 4dc3777b0123..d45f8d2b64bc 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts @@ -112,11 +112,11 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } - export function PetToJSON(json: any): Pet { - return PetToJSONTyped(json, false); - } +export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); +} - export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { +export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts index 561b3037f5c0..38dbd2fbf41a 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/ReadOnlyFirst.ts @@ -55,11 +55,11 @@ export function ReadOnlyFirstFromJSONTyped(json: any, ignoreDiscriminator: boole }; } - export function ReadOnlyFirstToJSON(json: any): ReadOnlyFirst { - return ReadOnlyFirstToJSONTyped(json, false); - } +export function ReadOnlyFirstToJSON(json: any): ReadOnlyFirst { + return ReadOnlyFirstToJSONTyped(json, false); +} - export function ReadOnlyFirstToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { +export function ReadOnlyFirstToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts index dc1fd7c1712c..557bb0d67195 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Return.ts @@ -48,11 +48,11 @@ export function ReturnFromJSONTyped(json: any, ignoreDiscriminator: boolean): Re }; } - export function ReturnToJSON(json: any): Return { - return ReturnToJSONTyped(json, false); - } +export function ReturnToJSON(json: any): Return { + return ReturnToJSONTyped(json, false); +} - export function ReturnToJSONTyped(value?: Return | null, ignoreDiscriminator: boolean = false): any { +export function ReturnToJSONTyped(value?: Return | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts index 3fec48ea4438..5ad3c16ca096 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SpecialModelName.ts @@ -48,11 +48,11 @@ export function SpecialModelNameFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function SpecialModelNameToJSON(json: any): SpecialModelName { - return SpecialModelNameToJSONTyped(json, false); - } +export function SpecialModelNameToJSON(json: any): SpecialModelName { + return SpecialModelNameToJSONTyped(json, false); +} - export function SpecialModelNameToJSONTyped(value?: SpecialModelName | null, ignoreDiscriminator: boolean = false): any { +export function SpecialModelNameToJSONTyped(value?: SpecialModelName | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts index 11266e1fb90a..c8711cf09f01 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Tag.ts @@ -55,11 +55,11 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } - export function TagToJSON(json: any): Tag { - return TagToJSONTyped(json, false); - } +export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); +} - export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { +export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts index 5bfdc0cfa545..025e2205b096 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/TestInlineFreeformAdditionalPropertiesRequest.ts @@ -50,11 +50,11 @@ export function TestInlineFreeformAdditionalPropertiesRequestFromJSONTyped(json: }; } - export function TestInlineFreeformAdditionalPropertiesRequestToJSON(json: any): TestInlineFreeformAdditionalPropertiesRequest { - return TestInlineFreeformAdditionalPropertiesRequestToJSONTyped(json, false); - } +export function TestInlineFreeformAdditionalPropertiesRequestToJSON(json: any): TestInlineFreeformAdditionalPropertiesRequest { + return TestInlineFreeformAdditionalPropertiesRequestToJSONTyped(json, false); +} - export function TestInlineFreeformAdditionalPropertiesRequestToJSONTyped(value?: TestInlineFreeformAdditionalPropertiesRequest | null, ignoreDiscriminator: boolean = false): any { +export function TestInlineFreeformAdditionalPropertiesRequestToJSONTyped(value?: TestInlineFreeformAdditionalPropertiesRequest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts index 97523c16bb4d..854f2dae12f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/User.ts @@ -97,11 +97,11 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } - export function UserToJSON(json: any): User { - return UserToJSONTyped(json, false); - } +export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); +} - export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { +export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts index b1f80cca9cd2..5e56849000d5 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts @@ -55,11 +55,11 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function CategoryToJSON(json: any): Category { - return CategoryToJSONTyped(json, false); - } +export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); +} - export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { +export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts index baea7c98fece..756cdf624098 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts @@ -62,11 +62,11 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function ModelApiResponseToJSON(json: any): ModelApiResponse { - return ModelApiResponseToJSONTyped(json, false); - } +export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); +} - export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { +export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts index 5f0ffc2452de..46977acb9c08 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts @@ -95,11 +95,11 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } - export function OrderToJSON(json: any): Order { - return OrderToJSONTyped(json, false); - } +export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); +} - export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { +export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts index 90ba76c7c496..981d00a85076 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts @@ -112,11 +112,11 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } - export function PetToJSON(json: any): Pet { - return PetToJSONTyped(json, false); - } +export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); +} - export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { +export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts index 9b7b41d11e87..f2c835eb0462 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts @@ -55,11 +55,11 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } - export function TagToJSON(json: any): Tag { - return TagToJSONTyped(json, false); - } +export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); +} - export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { +export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/models/User.ts b/samples/client/petstore/typescript-fetch/builds/default/models/User.ts index 54d3a2b2d69b..4d57bd098a66 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/models/User.ts @@ -97,11 +97,11 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } - export function UserToJSON(json: any): User { - return UserToJSONTyped(json, false); - } +export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); +} - export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { +export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts index 1c4279574261..70b017dc859d 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/EnumPatternObject.ts @@ -86,11 +86,11 @@ export function EnumPatternObjectFromJSONTyped(json: any, ignoreDiscriminator: b }; } - export function EnumPatternObjectToJSON(json: any): EnumPatternObject { - return EnumPatternObjectToJSONTyped(json, false); - } +export function EnumPatternObjectToJSON(json: any): EnumPatternObject { + return EnumPatternObjectToJSONTyped(json, false); +} - export function EnumPatternObjectToJSONTyped(value?: EnumPatternObject | null, ignoreDiscriminator: boolean = false): any { +export function EnumPatternObjectToJSONTyped(value?: EnumPatternObject | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts index f45e1771ea3e..23aca822ea66 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/FakeEnumRequestGetInline200Response.ts @@ -111,11 +111,11 @@ export function FakeEnumRequestGetInline200ResponseFromJSONTyped(json: any, igno }; } - export function FakeEnumRequestGetInline200ResponseToJSON(json: any): FakeEnumRequestGetInline200Response { - return FakeEnumRequestGetInline200ResponseToJSONTyped(json, false); - } +export function FakeEnumRequestGetInline200ResponseToJSON(json: any): FakeEnumRequestGetInline200Response { + return FakeEnumRequestGetInline200ResponseToJSONTyped(json, false); +} - export function FakeEnumRequestGetInline200ResponseToJSONTyped(value?: FakeEnumRequestGetInline200Response | null, ignoreDiscriminator: boolean = false): any { +export function FakeEnumRequestGetInline200ResponseToJSONTyped(value?: FakeEnumRequestGetInline200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts index b1f80cca9cd2..5e56849000d5 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Category.ts @@ -55,11 +55,11 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function CategoryToJSON(json: any): Category { - return CategoryToJSONTyped(json, false); - } +export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); +} - export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { +export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts index baea7c98fece..756cdf624098 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/ModelApiResponse.ts @@ -62,11 +62,11 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function ModelApiResponseToJSON(json: any): ModelApiResponse { - return ModelApiResponseToJSONTyped(json, false); - } +export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); +} - export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { +export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts index 5f0ffc2452de..46977acb9c08 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Order.ts @@ -95,11 +95,11 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } - export function OrderToJSON(json: any): Order { - return OrderToJSONTyped(json, false); - } +export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); +} - export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { +export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts index 90ba76c7c496..981d00a85076 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Pet.ts @@ -112,11 +112,11 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } - export function PetToJSON(json: any): Pet { - return PetToJSONTyped(json, false); - } +export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); +} - export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { +export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts index 9b7b41d11e87..f2c835eb0462 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/Tag.ts @@ -55,11 +55,11 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } - export function TagToJSON(json: any): Tag { - return TagToJSONTyped(json, false); - } +export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); +} - export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { +export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts index 54d3a2b2d69b..4d57bd098a66 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/models/User.ts @@ -97,11 +97,11 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } - export function UserToJSON(json: any): User { - return UserToJSONTyped(json, false); - } +export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); +} - export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { +export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts index b1f80cca9cd2..5e56849000d5 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts @@ -55,11 +55,11 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function CategoryToJSON(json: any): Category { - return CategoryToJSONTyped(json, false); - } +export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); +} - export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { +export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts index baea7c98fece..756cdf624098 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts @@ -62,11 +62,11 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function ModelApiResponseToJSON(json: any): ModelApiResponse { - return ModelApiResponseToJSONTyped(json, false); - } +export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); +} - export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { +export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts index 5f0ffc2452de..46977acb9c08 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts @@ -95,11 +95,11 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } - export function OrderToJSON(json: any): Order { - return OrderToJSONTyped(json, false); - } +export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); +} - export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { +export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts index 90ba76c7c496..981d00a85076 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts @@ -112,11 +112,11 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } - export function PetToJSON(json: any): Pet { - return PetToJSONTyped(json, false); - } +export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); +} - export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { +export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts index 9b7b41d11e87..f2c835eb0462 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts @@ -55,11 +55,11 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } - export function TagToJSON(json: any): Tag { - return TagToJSONTyped(json, false); - } +export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); +} - export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { +export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts index 54d3a2b2d69b..4d57bd098a66 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts @@ -97,11 +97,11 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } - export function UserToJSON(json: any): User { - return UserToJSONTyped(json, false); - } +export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); +} - export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { +export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestA.ts b/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestA.ts index 8fffa09116a6..198768099c18 100644 --- a/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestA.ts +++ b/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestA.ts @@ -49,11 +49,11 @@ export function TestAFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tes }; } - export function TestAToJSON(json: any): TestA { - return TestAToJSONTyped(json, false); - } +export function TestAToJSON(json: any): TestA { + return TestAToJSONTyped(json, false); +} - export function TestAToJSONTyped(value?: TestA | null, ignoreDiscriminator: boolean = false): any { +export function TestAToJSONTyped(value?: TestA | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestB.ts b/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestB.ts index d8477b8db52e..f33eae68ab37 100644 --- a/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestB.ts +++ b/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestB.ts @@ -49,11 +49,11 @@ export function TestBFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tes }; } - export function TestBToJSON(json: any): TestB { - return TestBToJSONTyped(json, false); - } +export function TestBToJSON(json: any): TestB { + return TestBToJSONTyped(json, false); +} - export function TestBToJSONTyped(value?: TestB | null, ignoreDiscriminator: boolean = false): any { +export function TestBToJSONTyped(value?: TestB | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestResponse.ts b/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestResponse.ts index d37db87e324a..e228a3e9f73d 100644 --- a/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/oneOf/models/TestResponse.ts @@ -52,7 +52,11 @@ export function TestResponseFromJSONTyped(json: any, ignoreDiscriminator: boolea return {} as any; } -export function TestResponseToJSON(value?: TestResponse | null): any { +export function TestResponseToJSON(json: any): any { + return TestResponseToJSONTyped(json, false); +} + +export function TestResponseToJSONTyped(value?: TestResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts index b1f80cca9cd2..5e56849000d5 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Category.ts @@ -55,11 +55,11 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function CategoryToJSON(json: any): Category { - return CategoryToJSONTyped(json, false); - } +export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); +} - export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { +export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts index baea7c98fece..756cdf624098 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/ModelApiResponse.ts @@ -62,11 +62,11 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function ModelApiResponseToJSON(json: any): ModelApiResponse { - return ModelApiResponseToJSONTyped(json, false); - } +export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); +} - export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { +export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts index 5f0ffc2452de..46977acb9c08 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Order.ts @@ -95,11 +95,11 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } - export function OrderToJSON(json: any): Order { - return OrderToJSONTyped(json, false); - } +export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); +} - export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { +export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts index 90ba76c7c496..981d00a85076 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Pet.ts @@ -112,11 +112,11 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } - export function PetToJSON(json: any): Pet { - return PetToJSONTyped(json, false); - } +export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); +} - export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { +export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts index 9b7b41d11e87..f2c835eb0462 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/Tag.ts @@ -55,11 +55,11 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } - export function TagToJSON(json: any): Tag { - return TagToJSONTyped(json, false); - } +export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); +} - export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { +export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts index 54d3a2b2d69b..4d57bd098a66 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/models/User.ts @@ -97,11 +97,11 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } - export function UserToJSON(json: any): User { - return UserToJSONTyped(json, false); - } +export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); +} - export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { +export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts index b1f80cca9cd2..5e56849000d5 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Category.ts @@ -55,11 +55,11 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function CategoryToJSON(json: any): Category { - return CategoryToJSONTyped(json, false); - } +export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); +} - export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { +export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts index 35356dee4a9b..8cd876962635 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DefaultMetaOnlyResponse.ts @@ -57,11 +57,11 @@ export function DefaultMetaOnlyResponseFromJSONTyped(json: any, ignoreDiscrimina }; } - export function DefaultMetaOnlyResponseToJSON(json: any): DefaultMetaOnlyResponse { - return DefaultMetaOnlyResponseToJSONTyped(json, false); - } +export function DefaultMetaOnlyResponseToJSON(json: any): DefaultMetaOnlyResponse { + return DefaultMetaOnlyResponseToJSONTyped(json, false); +} - export function DefaultMetaOnlyResponseToJSONTyped(value?: DefaultMetaOnlyResponse | null, ignoreDiscriminator: boolean = false): any { +export function DefaultMetaOnlyResponseToJSONTyped(value?: DefaultMetaOnlyResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts index 6fd8b71f6f9d..1fcc22f40073 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByStatusResponse.ts @@ -71,11 +71,11 @@ export function FindPetsByStatusResponseFromJSONTyped(json: any, ignoreDiscrimin }; } - export function FindPetsByStatusResponseToJSON(json: any): FindPetsByStatusResponse { - return FindPetsByStatusResponseToJSONTyped(json, false); - } +export function FindPetsByStatusResponseToJSON(json: any): FindPetsByStatusResponse { + return FindPetsByStatusResponseToJSONTyped(json, false); +} - export function FindPetsByStatusResponseToJSONTyped(value?: FindPetsByStatusResponse | null, ignoreDiscriminator: boolean = false): any { +export function FindPetsByStatusResponseToJSONTyped(value?: FindPetsByStatusResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts index 66256507d9b3..5519b6ab9e45 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/FindPetsByUserResponse.ts @@ -71,11 +71,11 @@ export function FindPetsByUserResponseFromJSONTyped(json: any, ignoreDiscriminat }; } - export function FindPetsByUserResponseToJSON(json: any): FindPetsByUserResponse { - return FindPetsByUserResponseToJSONTyped(json, false); - } +export function FindPetsByUserResponseToJSON(json: any): FindPetsByUserResponse { + return FindPetsByUserResponseToJSONTyped(json, false); +} - export function FindPetsByUserResponseToJSONTyped(value?: FindPetsByUserResponse | null, ignoreDiscriminator: boolean = false): any { +export function FindPetsByUserResponseToJSONTyped(value?: FindPetsByUserResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts index 3f4000b9413c..c8c229330602 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorPermissionsResponse.ts @@ -64,11 +64,11 @@ export function GetBehaviorPermissionsResponseFromJSONTyped(json: any, ignoreDis }; } - export function GetBehaviorPermissionsResponseToJSON(json: any): GetBehaviorPermissionsResponse { - return GetBehaviorPermissionsResponseToJSONTyped(json, false); - } +export function GetBehaviorPermissionsResponseToJSON(json: any): GetBehaviorPermissionsResponse { + return GetBehaviorPermissionsResponseToJSONTyped(json, false); +} - export function GetBehaviorPermissionsResponseToJSONTyped(value?: GetBehaviorPermissionsResponse | null, ignoreDiscriminator: boolean = false): any { +export function GetBehaviorPermissionsResponseToJSONTyped(value?: GetBehaviorPermissionsResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts index a282384d2207..5c90defb5d56 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetBehaviorTypeResponse.ts @@ -73,11 +73,11 @@ export function GetBehaviorTypeResponseFromJSONTyped(json: any, ignoreDiscrimina }; } - export function GetBehaviorTypeResponseToJSON(json: any): GetBehaviorTypeResponse { - return GetBehaviorTypeResponseToJSONTyped(json, false); - } +export function GetBehaviorTypeResponseToJSON(json: any): GetBehaviorTypeResponse { + return GetBehaviorTypeResponseToJSONTyped(json, false); +} - export function GetBehaviorTypeResponseToJSONTyped(value?: GetBehaviorTypeResponse | null, ignoreDiscriminator: boolean = false): any { +export function GetBehaviorTypeResponseToJSONTyped(value?: GetBehaviorTypeResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts index 255ca5f80112..356c421fe83c 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetMatchingPartsResponse.ts @@ -71,11 +71,11 @@ export function GetMatchingPartsResponseFromJSONTyped(json: any, ignoreDiscrimin }; } - export function GetMatchingPartsResponseToJSON(json: any): GetMatchingPartsResponse { - return GetMatchingPartsResponseToJSONTyped(json, false); - } +export function GetMatchingPartsResponseToJSON(json: any): GetMatchingPartsResponse { + return GetMatchingPartsResponseToJSONTyped(json, false); +} - export function GetMatchingPartsResponseToJSONTyped(value?: GetMatchingPartsResponse | null, ignoreDiscriminator: boolean = false): any { +export function GetMatchingPartsResponseToJSONTyped(value?: GetMatchingPartsResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts index e9b0c8a6c937..09b562b02433 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetPartTypeResponse.ts @@ -73,11 +73,11 @@ export function GetPetPartTypeResponseFromJSONTyped(json: any, ignoreDiscriminat }; } - export function GetPetPartTypeResponseToJSON(json: any): GetPetPartTypeResponse { - return GetPetPartTypeResponseToJSONTyped(json, false); - } +export function GetPetPartTypeResponseToJSON(json: any): GetPetPartTypeResponse { + return GetPetPartTypeResponseToJSONTyped(json, false); +} - export function GetPetPartTypeResponseToJSONTyped(value?: GetPetPartTypeResponse | null, ignoreDiscriminator: boolean = false): any { +export function GetPetPartTypeResponseToJSONTyped(value?: GetPetPartTypeResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts index 93b39cd0e786..e59902c72aa2 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ItemId.ts @@ -57,11 +57,11 @@ export function ItemIdFromJSONTyped(json: any, ignoreDiscriminator: boolean): It }; } - export function ItemIdToJSON(json: any): ItemId { - return ItemIdToJSONTyped(json, false); - } +export function ItemIdToJSON(json: any): ItemId { + return ItemIdToJSONTyped(json, false); +} - export function ItemIdToJSONTyped(value?: ItemId | null, ignoreDiscriminator: boolean = false): any { +export function ItemIdToJSONTyped(value?: ItemId | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts index 955aefde7190..abbf1567a3c2 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/MatchingParts.ts @@ -65,11 +65,11 @@ export function MatchingPartsFromJSONTyped(json: any, ignoreDiscriminator: boole }; } - export function MatchingPartsToJSON(json: any): MatchingParts { - return MatchingPartsToJSONTyped(json, false); - } +export function MatchingPartsToJSON(json: any): MatchingParts { + return MatchingPartsToJSONTyped(json, false); +} - export function MatchingPartsToJSONTyped(value?: MatchingParts | null, ignoreDiscriminator: boolean = false): any { +export function MatchingPartsToJSONTyped(value?: MatchingParts | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts index baea7c98fece..756cdf624098 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelApiResponse.ts @@ -62,11 +62,11 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function ModelApiResponseToJSON(json: any): ModelApiResponse { - return ModelApiResponseToJSONTyped(json, false); - } +export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); +} - export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { +export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts index 5033802329ef..1d06be7f975e 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ModelError.ts @@ -78,11 +78,11 @@ export function ModelErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } - export function ModelErrorToJSON(json: any): ModelError { - return ModelErrorToJSONTyped(json, false); - } +export function ModelErrorToJSON(json: any): ModelError { + return ModelErrorToJSONTyped(json, false); +} - export function ModelErrorToJSONTyped(value?: ModelError | null, ignoreDiscriminator: boolean = false): any { +export function ModelErrorToJSONTyped(value?: ModelError | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts index 5f0ffc2452de..46977acb9c08 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Order.ts @@ -95,11 +95,11 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } - export function OrderToJSON(json: any): Order { - return OrderToJSONTyped(json, false); - } +export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); +} - export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { +export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts index a9723f00da65..18c27a946b9b 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Part.ts @@ -57,11 +57,11 @@ export function PartFromJSONTyped(json: any, ignoreDiscriminator: boolean): Part }; } - export function PartToJSON(json: any): Part { - return PartToJSONTyped(json, false); - } +export function PartToJSON(json: any): Part { + return PartToJSONTyped(json, false); +} - export function PartToJSONTyped(value?: Part | null, ignoreDiscriminator: boolean = false): any { +export function PartToJSONTyped(value?: Part | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts index c02125e029ac..bdc19f7dd1df 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts @@ -243,11 +243,11 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } - export function PetToJSON(json: any): Pet { - return PetToJSONTyped(json, false); - } +export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); +} - export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { +export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts index d48d53c5b557..f221a6178768 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts @@ -64,11 +64,11 @@ export function PetRegionsResponseFromJSONTyped(json: any, ignoreDiscriminator: }; } - export function PetRegionsResponseToJSON(json: any): PetRegionsResponse { - return PetRegionsResponseToJSONTyped(json, false); - } +export function PetRegionsResponseToJSON(json: any): PetRegionsResponse { + return PetRegionsResponseToJSONTyped(json, false); +} - export function PetRegionsResponseToJSONTyped(value?: PetRegionsResponse | null, ignoreDiscriminator: boolean = false): any { +export function PetRegionsResponseToJSONTyped(value?: PetRegionsResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts index a00d3cf10be8..97b93cb70d1e 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ResponseMeta.ts @@ -124,11 +124,11 @@ export function ResponseMetaFromJSONTyped(json: any, ignoreDiscriminator: boolea }; } - export function ResponseMetaToJSON(json: any): ResponseMeta { - return ResponseMetaToJSONTyped(json, false); - } +export function ResponseMetaToJSON(json: any): ResponseMeta { + return ResponseMetaToJSONTyped(json, false); +} - export function ResponseMetaToJSONTyped(value?: ResponseMeta | null, ignoreDiscriminator: boolean = false): any { +export function ResponseMetaToJSONTyped(value?: ResponseMeta | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts index 9b7b41d11e87..f2c835eb0462 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Tag.ts @@ -55,11 +55,11 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } - export function TagToJSON(json: any): Tag { - return TagToJSONTyped(json, false); - } +export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); +} - export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { +export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts index 32c20200e0cb..262d40196d4a 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/User.ts @@ -113,11 +113,11 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } - export function UserToJSON(json: any): User { - return UserToJSONTyped(json, false); - } +export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); +} - export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { +export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts index c15b937e8a1c..d470576ef7d3 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AdditionalPropertiesClass.ts @@ -55,11 +55,11 @@ export function AdditionalPropertiesClassFromJSONTyped(json: any, ignoreDiscrimi }; } - export function AdditionalPropertiesClassToJSON(json: any): AdditionalPropertiesClass { - return AdditionalPropertiesClassToJSONTyped(json, false); - } +export function AdditionalPropertiesClassToJSON(json: any): AdditionalPropertiesClass { + return AdditionalPropertiesClassToJSONTyped(json, false); +} - export function AdditionalPropertiesClassToJSONTyped(value?: AdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { +export function AdditionalPropertiesClassToJSONTyped(value?: AdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts index 826ea603e2db..cbd15b990c6c 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/AllOfWithSingleRef.ts @@ -65,11 +65,11 @@ export function AllOfWithSingleRefFromJSONTyped(json: any, ignoreDiscriminator: }; } - export function AllOfWithSingleRefToJSON(json: any): AllOfWithSingleRef { - return AllOfWithSingleRefToJSONTyped(json, false); - } +export function AllOfWithSingleRefToJSON(json: any): AllOfWithSingleRef { + return AllOfWithSingleRefToJSONTyped(json, false); +} - export function AllOfWithSingleRefToJSONTyped(value?: AllOfWithSingleRef | null, ignoreDiscriminator: boolean = false): any { +export function AllOfWithSingleRefToJSONTyped(value?: AllOfWithSingleRef | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts index 33ad57bbe791..fb532ffbeff1 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Animal.ts @@ -66,11 +66,11 @@ export function AnimalFromJSONTyped(json: any, ignoreDiscriminator: boolean): An }; } - export function AnimalToJSON(json: any): Animal { - return AnimalToJSONTyped(json, false); - } +export function AnimalToJSON(json: any): Animal { + return AnimalToJSONTyped(json, false); +} - export function AnimalToJSONTyped(value?: Animal | null, ignoreDiscriminator: boolean = false): any { +export function AnimalToJSONTyped(value?: Animal | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts index 18264d15d7cb..3792b9134b4a 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfArrayOfNumberOnly.ts @@ -48,11 +48,11 @@ export function ArrayOfArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscrimin }; } - export function ArrayOfArrayOfNumberOnlyToJSON(json: any): ArrayOfArrayOfNumberOnly { - return ArrayOfArrayOfNumberOnlyToJSONTyped(json, false); - } +export function ArrayOfArrayOfNumberOnlyToJSON(json: any): ArrayOfArrayOfNumberOnly { + return ArrayOfArrayOfNumberOnlyToJSONTyped(json, false); +} - export function ArrayOfArrayOfNumberOnlyToJSONTyped(value?: ArrayOfArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { +export function ArrayOfArrayOfNumberOnlyToJSONTyped(value?: ArrayOfArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts index fa5c6dc5edd1..40fbb3c6326d 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayOfNumberOnly.ts @@ -48,11 +48,11 @@ export function ArrayOfNumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: b }; } - export function ArrayOfNumberOnlyToJSON(json: any): ArrayOfNumberOnly { - return ArrayOfNumberOnlyToJSONTyped(json, false); - } +export function ArrayOfNumberOnlyToJSON(json: any): ArrayOfNumberOnly { + return ArrayOfNumberOnlyToJSONTyped(json, false); +} - export function ArrayOfNumberOnlyToJSONTyped(value?: ArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { +export function ArrayOfNumberOnlyToJSONTyped(value?: ArrayOfNumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts index b31c80207b2f..9f3c53288826 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ArrayTest.ts @@ -70,11 +70,11 @@ export function ArrayTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function ArrayTestToJSON(json: any): ArrayTest { - return ArrayTestToJSONTyped(json, false); - } +export function ArrayTestToJSON(json: any): ArrayTest { + return ArrayTestToJSONTyped(json, false); +} - export function ArrayTestToJSONTyped(value?: ArrayTest | null, ignoreDiscriminator: boolean = false): any { +export function ArrayTestToJSONTyped(value?: ArrayTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts index ace2ede88477..9c6a2be5afb6 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Capitalization.ts @@ -84,11 +84,11 @@ export function CapitalizationFromJSONTyped(json: any, ignoreDiscriminator: bool }; } - export function CapitalizationToJSON(json: any): Capitalization { - return CapitalizationToJSONTyped(json, false); - } +export function CapitalizationToJSON(json: any): Capitalization { + return CapitalizationToJSONTyped(json, false); +} - export function CapitalizationToJSONTyped(value?: Capitalization | null, ignoreDiscriminator: boolean = false): any { +export function CapitalizationToJSONTyped(value?: Capitalization | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts index a1b44d02d26d..ba0e19539237 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Cat.ts @@ -56,11 +56,11 @@ export function CatFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cat { }; } - export function CatToJSON(json: any): Cat { - return CatToJSONTyped(json, false); - } +export function CatToJSON(json: any): Cat { + return CatToJSONTyped(json, false); +} - export function CatToJSONTyped(value?: Cat | null, ignoreDiscriminator: boolean = false): any { +export function CatToJSONTyped(value?: Cat | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts index 7c8caddd4969..e4047d919b2b 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Category.ts @@ -56,11 +56,11 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function CategoryToJSON(json: any): Category { - return CategoryToJSONTyped(json, false); - } +export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); +} - export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { +export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts index 813177eb3d50..cba5bbc353cf 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ClassModel.ts @@ -48,11 +48,11 @@ export function ClassModelFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } - export function ClassModelToJSON(json: any): ClassModel { - return ClassModelToJSONTyped(json, false); - } +export function ClassModelToJSON(json: any): ClassModel { + return ClassModelToJSONTyped(json, false); +} - export function ClassModelToJSONTyped(value?: ClassModel | null, ignoreDiscriminator: boolean = false): any { +export function ClassModelToJSONTyped(value?: ClassModel | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts index c6aa7163b0b3..b9509a4421f9 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Client.ts @@ -48,11 +48,11 @@ export function ClientFromJSONTyped(json: any, ignoreDiscriminator: boolean): Cl }; } - export function ClientToJSON(json: any): Client { - return ClientToJSONTyped(json, false); - } +export function ClientToJSON(json: any): Client { + return ClientToJSONTyped(json, false); +} - export function ClientToJSONTyped(value?: Client | null, ignoreDiscriminator: boolean = false): any { +export function ClientToJSONTyped(value?: Client | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts index d2acf418fded..2b22f28ddfe7 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/DeprecatedObject.ts @@ -48,11 +48,11 @@ export function DeprecatedObjectFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function DeprecatedObjectToJSON(json: any): DeprecatedObject { - return DeprecatedObjectToJSONTyped(json, false); - } +export function DeprecatedObjectToJSON(json: any): DeprecatedObject { + return DeprecatedObjectToJSONTyped(json, false); +} - export function DeprecatedObjectToJSONTyped(value?: DeprecatedObject | null, ignoreDiscriminator: boolean = false): any { +export function DeprecatedObjectToJSONTyped(value?: DeprecatedObject | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts index 1d66d5c04bf8..6662a88d3bee 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Dog.ts @@ -56,11 +56,11 @@ export function DogFromJSONTyped(json: any, ignoreDiscriminator: boolean): Dog { }; } - export function DogToJSON(json: any): Dog { - return DogToJSONTyped(json, false); - } +export function DogToJSON(json: any): Dog { + return DogToJSONTyped(json, false); +} - export function DogToJSONTyped(value?: Dog | null, ignoreDiscriminator: boolean = false): any { +export function DogToJSONTyped(value?: Dog | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts index 27f42e0a652b..b30860b8e8bb 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumArrays.ts @@ -75,11 +75,11 @@ export function EnumArraysFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } - export function EnumArraysToJSON(json: any): EnumArrays { - return EnumArraysToJSONTyped(json, false); - } +export function EnumArraysToJSON(json: any): EnumArrays { + return EnumArraysToJSONTyped(json, false); +} - export function EnumArraysToJSONTyped(value?: EnumArrays | null, ignoreDiscriminator: boolean = false): any { +export function EnumArraysToJSONTyped(value?: EnumArrays | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts index de99ab4dc662..0097912a9561 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumTest.ts @@ -167,11 +167,11 @@ export function EnumTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function EnumTestToJSON(json: any): EnumTest { - return EnumTestToJSONTyped(json, false); - } +export function EnumTestToJSON(json: any): EnumTest { + return EnumTestToJSONTyped(json, false); +} - export function EnumTestToJSONTyped(value?: EnumTest | null, ignoreDiscriminator: boolean = false): any { +export function EnumTestToJSONTyped(value?: EnumTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts index 5c97b9928efa..54458419a514 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FakeBigDecimalMap200Response.ts @@ -55,11 +55,11 @@ export function FakeBigDecimalMap200ResponseFromJSONTyped(json: any, ignoreDiscr }; } - export function FakeBigDecimalMap200ResponseToJSON(json: any): FakeBigDecimalMap200Response { - return FakeBigDecimalMap200ResponseToJSONTyped(json, false); - } +export function FakeBigDecimalMap200ResponseToJSON(json: any): FakeBigDecimalMap200Response { + return FakeBigDecimalMap200ResponseToJSONTyped(json, false); +} - export function FakeBigDecimalMap200ResponseToJSONTyped(value?: FakeBigDecimalMap200Response | null, ignoreDiscriminator: boolean = false): any { +export function FakeBigDecimalMap200ResponseToJSONTyped(value?: FakeBigDecimalMap200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts index 557abed7403e..87a77f497fbc 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FileSchemaTestClass.ts @@ -55,11 +55,11 @@ export function FileSchemaTestClassFromJSONTyped(json: any, ignoreDiscriminator: }; } - export function FileSchemaTestClassToJSON(json: any): FileSchemaTestClass { - return FileSchemaTestClassToJSONTyped(json, false); - } +export function FileSchemaTestClassToJSON(json: any): FileSchemaTestClass { + return FileSchemaTestClassToJSONTyped(json, false); +} - export function FileSchemaTestClassToJSONTyped(value?: FileSchemaTestClass | null, ignoreDiscriminator: boolean = false): any { +export function FileSchemaTestClassToJSONTyped(value?: FileSchemaTestClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts index 118b6190f280..ca208c88e2f8 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Foo.ts @@ -48,11 +48,11 @@ export function FooFromJSONTyped(json: any, ignoreDiscriminator: boolean): Foo { }; } - export function FooToJSON(json: any): Foo { - return FooToJSONTyped(json, false); - } +export function FooToJSON(json: any): Foo { + return FooToJSONTyped(json, false); +} - export function FooToJSONTyped(value?: Foo | null, ignoreDiscriminator: boolean = false): any { +export function FooToJSONTyped(value?: Foo | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts index 721b08a2242d..1199e6b3793a 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FooGetDefaultResponse.ts @@ -56,11 +56,11 @@ export function FooGetDefaultResponseFromJSONTyped(json: any, ignoreDiscriminato }; } - export function FooGetDefaultResponseToJSON(json: any): FooGetDefaultResponse { - return FooGetDefaultResponseToJSONTyped(json, false); - } +export function FooGetDefaultResponseToJSON(json: any): FooGetDefaultResponse { + return FooGetDefaultResponseToJSONTyped(json, false); +} - export function FooGetDefaultResponseToJSONTyped(value?: FooGetDefaultResponse | null, ignoreDiscriminator: boolean = false): any { +export function FooGetDefaultResponseToJSONTyped(value?: FooGetDefaultResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts index df41354802ae..33aed92595aa 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/FormatTest.ts @@ -157,11 +157,11 @@ export function FormatTestFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } - export function FormatTestToJSON(json: any): FormatTest { - return FormatTestToJSONTyped(json, false); - } +export function FormatTestToJSON(json: any): FormatTest { + return FormatTestToJSONTyped(json, false); +} - export function FormatTestToJSONTyped(value?: FormatTest | null, ignoreDiscriminator: boolean = false): any { +export function FormatTestToJSONTyped(value?: FormatTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts index 0eb9accdc1f5..59019adf1993 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HasOnlyReadOnly.ts @@ -55,11 +55,11 @@ export function HasOnlyReadOnlyFromJSONTyped(json: any, ignoreDiscriminator: boo }; } - export function HasOnlyReadOnlyToJSON(json: any): HasOnlyReadOnly { - return HasOnlyReadOnlyToJSONTyped(json, false); - } +export function HasOnlyReadOnlyToJSON(json: any): HasOnlyReadOnly { + return HasOnlyReadOnlyToJSONTyped(json, false); +} - export function HasOnlyReadOnlyToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { +export function HasOnlyReadOnlyToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts index c62de4d9fb83..e8683a11f338 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/HealthCheckResult.ts @@ -48,11 +48,11 @@ export function HealthCheckResultFromJSONTyped(json: any, ignoreDiscriminator: b }; } - export function HealthCheckResultToJSON(json: any): HealthCheckResult { - return HealthCheckResultToJSONTyped(json, false); - } +export function HealthCheckResultToJSON(json: any): HealthCheckResult { + return HealthCheckResultToJSONTyped(json, false); +} - export function HealthCheckResultToJSONTyped(value?: HealthCheckResult | null, ignoreDiscriminator: boolean = false): any { +export function HealthCheckResultToJSONTyped(value?: HealthCheckResult | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts index fb9a30ea0e5b..21dd83e2c200 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/List.ts @@ -48,11 +48,11 @@ export function ListFromJSONTyped(json: any, ignoreDiscriminator: boolean): List }; } - export function ListToJSON(json: any): List { - return ListToJSONTyped(json, false); - } +export function ListToJSON(json: any): List { + return ListToJSONTyped(json, false); +} - export function ListToJSONTyped(value?: List | null, ignoreDiscriminator: boolean = false): any { +export function ListToJSONTyped(value?: List | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts index a88b84fd1027..753c30a6cf93 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MapTest.ts @@ -80,11 +80,11 @@ export function MapTestFromJSONTyped(json: any, ignoreDiscriminator: boolean): M }; } - export function MapTestToJSON(json: any): MapTest { - return MapTestToJSONTyped(json, false); - } +export function MapTestToJSON(json: any): MapTest { + return MapTestToJSONTyped(json, false); +} - export function MapTestToJSONTyped(value?: MapTest | null, ignoreDiscriminator: boolean = false): any { +export function MapTestToJSONTyped(value?: MapTest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts index 1f69153ef85c..5466bc5177e2 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/MixedPropertiesAndAdditionalPropertiesClass.ts @@ -70,11 +70,11 @@ export function MixedPropertiesAndAdditionalPropertiesClassFromJSONTyped(json: a }; } - export function MixedPropertiesAndAdditionalPropertiesClassToJSON(json: any): MixedPropertiesAndAdditionalPropertiesClass { - return MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(json, false); - } +export function MixedPropertiesAndAdditionalPropertiesClassToJSON(json: any): MixedPropertiesAndAdditionalPropertiesClass { + return MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(json, false); +} - export function MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(value?: MixedPropertiesAndAdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { +export function MixedPropertiesAndAdditionalPropertiesClassToJSONTyped(value?: MixedPropertiesAndAdditionalPropertiesClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts index af0066b276eb..b0a30640133e 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Model200Response.ts @@ -55,11 +55,11 @@ export function Model200ResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function Model200ResponseToJSON(json: any): Model200Response { - return Model200ResponseToJSONTyped(json, false); - } +export function Model200ResponseToJSON(json: any): Model200Response { + return Model200ResponseToJSONTyped(json, false); +} - export function Model200ResponseToJSONTyped(value?: Model200Response | null, ignoreDiscriminator: boolean = false): any { +export function Model200ResponseToJSONTyped(value?: Model200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts index a505854c2d71..355b5f76e428 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelApiResponse.ts @@ -62,11 +62,11 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function ModelApiResponseToJSON(json: any): ModelApiResponse { - return ModelApiResponseToJSONTyped(json, false); - } +export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); +} - export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { +export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts index ef6eee2c53c7..4b63fcfe25f2 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ModelFile.ts @@ -48,11 +48,11 @@ export function ModelFileFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function ModelFileToJSON(json: any): ModelFile { - return ModelFileToJSONTyped(json, false); - } +export function ModelFileToJSON(json: any): ModelFile { + return ModelFileToJSONTyped(json, false); +} - export function ModelFileToJSONTyped(value?: ModelFile | null, ignoreDiscriminator: boolean = false): any { +export function ModelFileToJSONTyped(value?: ModelFile | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts index 1c957bff4d65..b999bdccb1d0 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Name.ts @@ -70,11 +70,11 @@ export function NameFromJSONTyped(json: any, ignoreDiscriminator: boolean): Name }; } - export function NameToJSON(json: any): Name { - return NameToJSONTyped(json, false); - } +export function NameToJSON(json: any): Name { + return NameToJSONTyped(json, false); +} - export function NameToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { +export function NameToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts index 4f32da1c0ced..3c2a165a7bd9 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NullableClass.ts @@ -127,11 +127,11 @@ export function NullableClassFromJSONTyped(json: any, ignoreDiscriminator: boole }; } - export function NullableClassToJSON(json: any): NullableClass { - return NullableClassToJSONTyped(json, false); - } +export function NullableClassToJSON(json: any): NullableClass { + return NullableClassToJSONTyped(json, false); +} - export function NullableClassToJSONTyped(value?: NullableClass | null, ignoreDiscriminator: boolean = false): any { +export function NullableClassToJSONTyped(value?: NullableClass | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts index d9e19a6d9d86..01ffc388797b 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/NumberOnly.ts @@ -48,11 +48,11 @@ export function NumberOnlyFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } - export function NumberOnlyToJSON(json: any): NumberOnly { - return NumberOnlyToJSONTyped(json, false); - } +export function NumberOnlyToJSON(json: any): NumberOnly { + return NumberOnlyToJSONTyped(json, false); +} - export function NumberOnlyToJSONTyped(value?: NumberOnly | null, ignoreDiscriminator: boolean = false): any { +export function NumberOnlyToJSONTyped(value?: NumberOnly | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts index 88b028733508..8dd72d9dfde3 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ObjectWithDeprecatedFields.ts @@ -80,11 +80,11 @@ export function ObjectWithDeprecatedFieldsFromJSONTyped(json: any, ignoreDiscrim }; } - export function ObjectWithDeprecatedFieldsToJSON(json: any): ObjectWithDeprecatedFields { - return ObjectWithDeprecatedFieldsToJSONTyped(json, false); - } +export function ObjectWithDeprecatedFieldsToJSON(json: any): ObjectWithDeprecatedFields { + return ObjectWithDeprecatedFieldsToJSONTyped(json, false); +} - export function ObjectWithDeprecatedFieldsToJSONTyped(value?: ObjectWithDeprecatedFields | null, ignoreDiscriminator: boolean = false): any { +export function ObjectWithDeprecatedFieldsToJSONTyped(value?: ObjectWithDeprecatedFields | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts index ef82efcce508..2e9a77af0484 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Order.ts @@ -95,11 +95,11 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } - export function OrderToJSON(json: any): Order { - return OrderToJSONTyped(json, false); - } +export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); +} - export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { +export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts index ab4303f03c3a..ffb9d35f81ae 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterComposite.ts @@ -62,11 +62,11 @@ export function OuterCompositeFromJSONTyped(json: any, ignoreDiscriminator: bool }; } - export function OuterCompositeToJSON(json: any): OuterComposite { - return OuterCompositeToJSONTyped(json, false); - } +export function OuterCompositeToJSON(json: any): OuterComposite { + return OuterCompositeToJSONTyped(json, false); +} - export function OuterCompositeToJSONTyped(value?: OuterComposite | null, ignoreDiscriminator: boolean = false): any { +export function OuterCompositeToJSONTyped(value?: OuterComposite | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts index a533ca482d8b..cc02ae41cfec 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterObjectWithEnumProperty.ts @@ -59,11 +59,11 @@ export function OuterObjectWithEnumPropertyFromJSONTyped(json: any, ignoreDiscri }; } - export function OuterObjectWithEnumPropertyToJSON(json: any): OuterObjectWithEnumProperty { - return OuterObjectWithEnumPropertyToJSONTyped(json, false); - } +export function OuterObjectWithEnumPropertyToJSON(json: any): OuterObjectWithEnumProperty { + return OuterObjectWithEnumPropertyToJSONTyped(json, false); +} - export function OuterObjectWithEnumPropertyToJSONTyped(value?: OuterObjectWithEnumProperty | null, ignoreDiscriminator: boolean = false): any { +export function OuterObjectWithEnumPropertyToJSONTyped(value?: OuterObjectWithEnumProperty | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts index 4dc3777b0123..d45f8d2b64bc 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Pet.ts @@ -112,11 +112,11 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } - export function PetToJSON(json: any): Pet { - return PetToJSONTyped(json, false); - } +export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); +} - export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { +export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts index 561b3037f5c0..38dbd2fbf41a 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/ReadOnlyFirst.ts @@ -55,11 +55,11 @@ export function ReadOnlyFirstFromJSONTyped(json: any, ignoreDiscriminator: boole }; } - export function ReadOnlyFirstToJSON(json: any): ReadOnlyFirst { - return ReadOnlyFirstToJSONTyped(json, false); - } +export function ReadOnlyFirstToJSON(json: any): ReadOnlyFirst { + return ReadOnlyFirstToJSONTyped(json, false); +} - export function ReadOnlyFirstToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { +export function ReadOnlyFirstToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts index dc1fd7c1712c..557bb0d67195 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Return.ts @@ -48,11 +48,11 @@ export function ReturnFromJSONTyped(json: any, ignoreDiscriminator: boolean): Re }; } - export function ReturnToJSON(json: any): Return { - return ReturnToJSONTyped(json, false); - } +export function ReturnToJSON(json: any): Return { + return ReturnToJSONTyped(json, false); +} - export function ReturnToJSONTyped(value?: Return | null, ignoreDiscriminator: boolean = false): any { +export function ReturnToJSONTyped(value?: Return | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts index 3fec48ea4438..5ad3c16ca096 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SpecialModelName.ts @@ -48,11 +48,11 @@ export function SpecialModelNameFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function SpecialModelNameToJSON(json: any): SpecialModelName { - return SpecialModelNameToJSONTyped(json, false); - } +export function SpecialModelNameToJSON(json: any): SpecialModelName { + return SpecialModelNameToJSONTyped(json, false); +} - export function SpecialModelNameToJSONTyped(value?: SpecialModelName | null, ignoreDiscriminator: boolean = false): any { +export function SpecialModelNameToJSONTyped(value?: SpecialModelName | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts index 11266e1fb90a..c8711cf09f01 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/Tag.ts @@ -55,11 +55,11 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } - export function TagToJSON(json: any): Tag { - return TagToJSONTyped(json, false); - } +export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); +} - export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { +export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts index 97523c16bb4d..854f2dae12f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/User.ts @@ -97,11 +97,11 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } - export function UserToJSON(json: any): User { - return UserToJSONTyped(json, false); - } +export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); +} - export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { +export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Category.ts index 93ddb7d8f62c..32df5bbb27c5 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Category.ts @@ -55,11 +55,11 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function CategoryToJSON(json: any): Category { - return CategoryToJSONTyped(json, false); - } +export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); +} - export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { +export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/ModelApiResponse.ts index 51e5f5a91a4d..7059aa7225ef 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/ModelApiResponse.ts @@ -62,11 +62,11 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function ModelApiResponseToJSON(json: any): ModelApiResponse { - return ModelApiResponseToJSONTyped(json, false); - } +export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); +} - export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { +export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Order.ts index fb3d41daab6a..072d3bf5ac9e 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Order.ts @@ -97,11 +97,11 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } - export function OrderToJSON(json: any): Order { - return OrderToJSONTyped(json, false); - } +export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); +} - export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { +export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Pet.ts index 2290adbd00d6..0af0ffab39d1 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Pet.ts @@ -113,11 +113,11 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } - export function PetToJSON(json: any): Pet { - return PetToJSONTyped(json, false); - } +export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); +} - export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { +export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Tag.ts index eefbfb792ff8..a942cc99f5d5 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/Tag.ts @@ -55,11 +55,11 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } - export function TagToJSON(json: any): Tag { - return TagToJSONTyped(json, false); - } +export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); +} - export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { +export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/User.ts b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/User.ts index f12cee29181e..39a70be42fae 100644 --- a/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/validation-attributes/models/User.ts @@ -97,11 +97,11 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } - export function UserToJSON(json: any): User { - return UserToJSONTyped(json, false); - } +export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); +} - export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { +export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts index b1f80cca9cd2..5e56849000d5 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts @@ -55,11 +55,11 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function CategoryToJSON(json: any): Category { - return CategoryToJSONTyped(json, false); - } +export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); +} - export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { +export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts index baea7c98fece..756cdf624098 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts @@ -62,11 +62,11 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function ModelApiResponseToJSON(json: any): ModelApiResponse { - return ModelApiResponseToJSONTyped(json, false); - } +export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); +} - export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { +export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts index 5f0ffc2452de..46977acb9c08 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts @@ -95,11 +95,11 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } - export function OrderToJSON(json: any): Order { - return OrderToJSONTyped(json, false); - } +export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); +} - export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { +export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts index 90ba76c7c496..981d00a85076 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts @@ -112,11 +112,11 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } - export function PetToJSON(json: any): Pet { - return PetToJSONTyped(json, false); - } +export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); +} - export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { +export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts index 9b7b41d11e87..f2c835eb0462 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts @@ -55,11 +55,11 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } - export function TagToJSON(json: any): Tag { - return TagToJSONTyped(json, false); - } +export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); +} - export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { +export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts index 54d3a2b2d69b..4d57bd098a66 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts @@ -97,11 +97,11 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } - export function UserToJSON(json: any): User { - return UserToJSONTyped(json, false); - } +export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); +} - export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { +export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts index b1f80cca9cd2..5e56849000d5 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Category.ts @@ -55,11 +55,11 @@ export function CategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } - export function CategoryToJSON(json: any): Category { - return CategoryToJSONTyped(json, false); - } +export function CategoryToJSON(json: any): Category { + return CategoryToJSONTyped(json, false); +} - export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { +export function CategoryToJSONTyped(value?: Category | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts index baea7c98fece..756cdf624098 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/ModelApiResponse.ts @@ -62,11 +62,11 @@ export function ModelApiResponseFromJSONTyped(json: any, ignoreDiscriminator: bo }; } - export function ModelApiResponseToJSON(json: any): ModelApiResponse { - return ModelApiResponseToJSONTyped(json, false); - } +export function ModelApiResponseToJSON(json: any): ModelApiResponse { + return ModelApiResponseToJSONTyped(json, false); +} - export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { +export function ModelApiResponseToJSONTyped(value?: ModelApiResponse | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts index 5f0ffc2452de..46977acb9c08 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Order.ts @@ -95,11 +95,11 @@ export function OrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ord }; } - export function OrderToJSON(json: any): Order { - return OrderToJSONTyped(json, false); - } +export function OrderToJSON(json: any): Order { + return OrderToJSONTyped(json, false); +} - export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { +export function OrderToJSONTyped(value?: Order | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts index 90ba76c7c496..981d00a85076 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Pet.ts @@ -112,11 +112,11 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { }; } - export function PetToJSON(json: any): Pet { - return PetToJSONTyped(json, false); - } +export function PetToJSON(json: any): Pet { + return PetToJSONTyped(json, false); +} - export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { +export function PetToJSONTyped(value?: Pet | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts index 9b7b41d11e87..f2c835eb0462 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/Tag.ts @@ -55,11 +55,11 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag { }; } - export function TagToJSON(json: any): Tag { - return TagToJSONTyped(json, false); - } +export function TagToJSON(json: any): Tag { + return TagToJSONTyped(json, false); +} - export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { +export function TagToJSONTyped(value?: Tag | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts index 54d3a2b2d69b..4d57bd098a66 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/models/User.ts @@ -97,11 +97,11 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User }; } - export function UserToJSON(json: any): User { - return UserToJSONTyped(json, false); - } +export function UserToJSON(json: any): User { + return UserToJSONTyped(json, false); +} - export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { +export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts index 1c4279574261..70b017dc859d 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/EnumPatternObject.ts @@ -86,11 +86,11 @@ export function EnumPatternObjectFromJSONTyped(json: any, ignoreDiscriminator: b }; } - export function EnumPatternObjectToJSON(json: any): EnumPatternObject { - return EnumPatternObjectToJSONTyped(json, false); - } +export function EnumPatternObjectToJSON(json: any): EnumPatternObject { + return EnumPatternObjectToJSONTyped(json, false); +} - export function EnumPatternObjectToJSONTyped(value?: EnumPatternObject | null, ignoreDiscriminator: boolean = false): any { +export function EnumPatternObjectToJSONTyped(value?: EnumPatternObject | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts index 5822a99aa444..aef815c9e004 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/FakeEnumRequestGetInline200Response.ts @@ -107,11 +107,11 @@ export function FakeEnumRequestGetInline200ResponseFromJSONTyped(json: any, igno }; } - export function FakeEnumRequestGetInline200ResponseToJSON(json: any): FakeEnumRequestGetInline200Response { - return FakeEnumRequestGetInline200ResponseToJSONTyped(json, false); - } +export function FakeEnumRequestGetInline200ResponseToJSON(json: any): FakeEnumRequestGetInline200Response { + return FakeEnumRequestGetInline200ResponseToJSONTyped(json, false); +} - export function FakeEnumRequestGetInline200ResponseToJSONTyped(value?: FakeEnumRequestGetInline200Response | null, ignoreDiscriminator: boolean = false): any { +export function FakeEnumRequestGetInline200ResponseToJSONTyped(value?: FakeEnumRequestGetInline200Response | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; }