From b16db33c925b95e81944f6452afe0b79629c5e62 Mon Sep 17 00:00:00 2001 From: Ferdi Koomen Date: Sun, 24 Nov 2019 11:13:30 +0100 Subject: [PATCH] - First draft ready --- .../v2/interfaces/OpenApiResponses.d.ts | 4 +- src/openApi/v2/parser/getModel.ts | 2 +- src/openApi/v2/parser/getModelProperties.ts | 11 +- src/openApi/v2/parser/getOperation.ts | 2 +- .../v2/parser/getOperationParameter.ts | 2 +- .../v3/interfaces/OpenApiParameter.d.ts | 2 +- .../v3/interfaces/OpenApiResponses.d.ts | 4 +- src/openApi/v3/parser/constants.ts | 7 + src/openApi/v3/parser/getContent.ts | 22 + src/openApi/v3/parser/getModel.ts | 4 +- src/openApi/v3/parser/getModelProperties.ts | 16 +- src/openApi/v3/parser/getOperation.ts | 10 +- .../v3/parser/getOperationParameter.ts | 2 +- .../v3/parser/getOperationRequestBody.ts | 60 + src/openApi/v3/parser/getOperationResponse.ts | 55 +- src/openApi/v3/parser/getType.ts | 8 +- .../typescript/partials/exportInterface.hbs | 2 +- .../typescript/partials/typeInterface.hbs | 2 +- test/__snapshots__/index.spec.js.snap | 5558 ++++++++--------- test/index.js | 36 +- test/mock/spec-v2.json | 43 +- test/mock/spec-v3.json | 5174 ++------------- 22 files changed, 3459 insertions(+), 7567 deletions(-) create mode 100644 src/openApi/v3/parser/getContent.ts create mode 100644 src/openApi/v3/parser/getOperationRequestBody.ts diff --git a/src/openApi/v2/interfaces/OpenApiResponses.d.ts b/src/openApi/v2/interfaces/OpenApiResponses.d.ts index b7baf0fa..5d35b944 100644 --- a/src/openApi/v2/interfaces/OpenApiResponses.d.ts +++ b/src/openApi/v2/interfaces/OpenApiResponses.d.ts @@ -4,7 +4,7 @@ import { OpenApiResponse } from './OpenApiResponse'; * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#responsesObject */ export interface OpenApiResponses { - [httpcode: string]: OpenApiResponse; - default?: OpenApiResponse; + + [httpcode: string]: OpenApiResponse; } diff --git a/src/openApi/v2/parser/getModel.ts b/src/openApi/v2/parser/getModel.ts index 898524c6..061c8d61 100644 --- a/src/openApi/v2/parser/getModel.ts +++ b/src/openApi/v2/parser/getModel.ts @@ -19,7 +19,7 @@ export function getModel(openApi: OpenApi, definition: OpenApiSchema, isProperty link: null, description: getComment(definition.description), isProperty: isProperty, - isReadOnly: definition.readOnly || false, + isReadOnly: definition.readOnly === true, isNullable: false, isRequired: false, imports: [], diff --git a/src/openApi/v2/parser/getModelProperties.ts b/src/openApi/v2/parser/getModelProperties.ts index bae1e9dc..4378a527 100644 --- a/src/openApi/v2/parser/getModelProperties.ts +++ b/src/openApi/v2/parser/getModelProperties.ts @@ -10,8 +10,7 @@ export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema): for (const propertyName in definition.properties) { if (definition.properties.hasOwnProperty(propertyName)) { const property = definition.properties[propertyName]; - const propertyRequired = !!(definition.required && definition.required.includes(propertyName)); - const propertyReadOnly = !!property.readOnly; + const propertyRequired = definition.required && definition.required.includes(propertyName); if (property.$ref) { const model = getType(property.$ref); models.push({ @@ -23,8 +22,8 @@ export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema): link: null, description: getComment(property.description), isProperty: true, - isReadOnly: propertyReadOnly, - isRequired: propertyRequired, + isReadOnly: property.readOnly === true, + isRequired: propertyRequired === true, isNullable: false, imports: model.imports, extends: [], @@ -43,8 +42,8 @@ export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema): link: model.link, description: getComment(property.description), isProperty: true, - isReadOnly: propertyReadOnly, - isRequired: propertyRequired, + isReadOnly: property.readOnly === true, + isRequired: propertyRequired === true, isNullable: false, imports: model.imports, extends: model.extends, diff --git a/src/openApi/v2/parser/getOperation.ts b/src/openApi/v2/parser/getOperation.ts index b3828457..a6fbf36e 100644 --- a/src/openApi/v2/parser/getOperation.ts +++ b/src/openApi/v2/parser/getOperation.ts @@ -23,7 +23,7 @@ export function getOperation(openApi: OpenApi, url: string, method: string, op: name: operationName, summary: getComment(op.summary), description: getComment(op.description), - deprecated: op.deprecated || false, + deprecated: op.deprecated === true, method: method, path: operationPath, parameters: [], diff --git a/src/openApi/v2/parser/getOperationParameter.ts b/src/openApi/v2/parser/getOperationParameter.ts index eef5fbc5..a7ed1eed 100644 --- a/src/openApi/v2/parser/getOperationParameter.ts +++ b/src/openApi/v2/parser/getOperationParameter.ts @@ -25,7 +25,7 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame default: getOperationParameterDefault(parameter.default), isProperty: false, isReadOnly: false, - isRequired: parameter.required || false, + isRequired: parameter.required === true, isNullable: false, imports: [], extends: [], diff --git a/src/openApi/v3/interfaces/OpenApiParameter.d.ts b/src/openApi/v3/interfaces/OpenApiParameter.d.ts index 1d3688e0..8c59a0d0 100644 --- a/src/openApi/v3/interfaces/OpenApiParameter.d.ts +++ b/src/openApi/v3/interfaces/OpenApiParameter.d.ts @@ -10,7 +10,7 @@ export interface OpenApiParameter extends OpenApiReference { name: string; in: 'path' | 'query' | 'header' | 'cookie'; description?: string; - required: boolean; + required?: boolean; deprecated?: boolean; allowEmptyValue?: boolean; style?: string; diff --git a/src/openApi/v3/interfaces/OpenApiResponses.d.ts b/src/openApi/v3/interfaces/OpenApiResponses.d.ts index 66107646..ecc829a7 100644 --- a/src/openApi/v3/interfaces/OpenApiResponses.d.ts +++ b/src/openApi/v3/interfaces/OpenApiResponses.d.ts @@ -5,7 +5,7 @@ import { OpenApiResponse } from './OpenApiResponse'; * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#responsesObject */ export interface OpenApiResponses extends OpenApiReference { - [httpcode: string]: OpenApiResponse; - default: OpenApiResponse; + + [httpcode: string]: OpenApiResponse; } diff --git a/src/openApi/v3/parser/constants.ts b/src/openApi/v3/parser/constants.ts index 04041dd7..3258692a 100644 --- a/src/openApi/v3/parser/constants.ts +++ b/src/openApi/v3/parser/constants.ts @@ -42,3 +42,10 @@ export enum Method { HEAD = 'head', PATCH = 'patch', } + +export enum ContentType { + APPLICATION_JSON_PATCH = 'application/json-patch+json', + APPLICATION_JSON = 'application/json', + TEXT_JSON = 'text/json', + TEXT_PAIN = 'text/plain', +} diff --git a/src/openApi/v3/parser/getContent.ts b/src/openApi/v3/parser/getContent.ts new file mode 100644 index 00000000..9620b6b7 --- /dev/null +++ b/src/openApi/v3/parser/getContent.ts @@ -0,0 +1,22 @@ +import { ContentType } from './constants'; +import { Dictionary } from '../../../utils/types'; +import { OpenApi } from '../interfaces/OpenApi'; +import { OpenApiMediaType } from '../interfaces/OpenApiMediaType'; +import { OpenApiSchema } from '../interfaces/OpenApiSchema'; + +export function getContent(openApi: OpenApi, content: Dictionary): OpenApiSchema | null { + /* prettier-ignore */ + return ( + content[ContentType.APPLICATION_JSON_PATCH] && + content[ContentType.APPLICATION_JSON_PATCH].schema + ) || ( + content[ContentType.APPLICATION_JSON] && + content[ContentType.APPLICATION_JSON].schema + ) || ( + content[ContentType.TEXT_JSON] && + content[ContentType.TEXT_JSON].schema + ) || ( + content[ContentType.TEXT_PAIN] && + content[ContentType.TEXT_PAIN].schema + ) || null; +} diff --git a/src/openApi/v3/parser/getModel.ts b/src/openApi/v3/parser/getModel.ts index bcc606c4..6fdc4739 100644 --- a/src/openApi/v3/parser/getModel.ts +++ b/src/openApi/v3/parser/getModel.ts @@ -19,8 +19,8 @@ export function getModel(openApi: OpenApi, definition: OpenApiSchema, isProperty link: null, description: getComment(definition.description), isProperty: isProperty, - isReadOnly: definition.readOnly || false, - isNullable: definition.nullable || false, + isReadOnly: definition.readOnly === true, + isNullable: definition.nullable === true, isRequired: false, imports: [], extends: [], diff --git a/src/openApi/v3/parser/getModelProperties.ts b/src/openApi/v3/parser/getModelProperties.ts index 22fd92a1..ed1af36f 100644 --- a/src/openApi/v3/parser/getModelProperties.ts +++ b/src/openApi/v3/parser/getModelProperties.ts @@ -10,9 +10,7 @@ export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema): for (const propertyName in definition.properties) { if (definition.properties.hasOwnProperty(propertyName)) { const property = definition.properties[propertyName]; - const propertyRequired = !!(definition.required && definition.required.includes(propertyName)); - const propertyReadOnly = !!property.readOnly; - const propertyNullable = !!property.nullable; + const propertyRequired = definition.required && definition.required.includes(propertyName); if (property.$ref) { const model = getType(property.$ref); models.push({ @@ -24,9 +22,9 @@ export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema): link: null, description: getComment(property.description), isProperty: true, - isReadOnly: propertyReadOnly, - isRequired: propertyRequired, - isNullable: propertyNullable, + isReadOnly: property.readOnly === true, + isRequired: propertyRequired === true, + isNullable: property.nullable === true, imports: model.imports, extends: [], enum: [], @@ -44,9 +42,9 @@ export function getModelProperties(openApi: OpenApi, definition: OpenApiSchema): link: model.link, description: getComment(property.description), isProperty: true, - isReadOnly: propertyReadOnly, - isRequired: propertyRequired, - isNullable: propertyNullable, + isReadOnly: property.readOnly === true, + isRequired: propertyRequired === true, + isNullable: property.nullable === true, imports: model.imports, extends: model.extends, enum: model.enum, diff --git a/src/openApi/v3/parser/getOperation.ts b/src/openApi/v3/parser/getOperation.ts index b3828457..5506afe8 100644 --- a/src/openApi/v3/parser/getOperation.ts +++ b/src/openApi/v3/parser/getOperation.ts @@ -6,6 +6,7 @@ import { getOperationErrors } from './getOperationErrors'; import { getOperationName } from './getOperationName'; import { getOperationParameters } from './getOperationParameters'; import { getOperationPath } from './getOperationPath'; +import { getOperationRequestBody } from './getOperationRequestBody'; import { getOperationResponses } from './getOperationResponses'; import { getOperationResults } from './getOperationResults'; import { getServiceClassName } from './getServiceClassName'; @@ -23,7 +24,7 @@ export function getOperation(openApi: OpenApi, url: string, method: string, op: name: operationName, summary: getComment(op.summary), description: getComment(op.description), - deprecated: op.deprecated || false, + deprecated: op.deprecated === true, method: method, path: operationPath, parameters: [], @@ -49,6 +50,13 @@ export function getOperation(openApi: OpenApi, url: string, method: string, op: operation.parametersBody = parameters.parametersBody; } + if (op.requestBody) { + const requestBody = getOperationRequestBody(openApi, op.requestBody); + operation.imports.push(...requestBody.imports); + operation.parameters.push(requestBody); + operation.parametersBody = requestBody; + } + // Parse the operation responses. if (op.responses) { const operationResponses = getOperationResponses(openApi, op.responses); diff --git a/src/openApi/v3/parser/getOperationParameter.ts b/src/openApi/v3/parser/getOperationParameter.ts index b52dd582..1f635543 100644 --- a/src/openApi/v3/parser/getOperationParameter.ts +++ b/src/openApi/v3/parser/getOperationParameter.ts @@ -21,7 +21,7 @@ export function getOperationParameter(openApi: OpenApi, parameter: OpenApiParame default: undefined, isProperty: false, isReadOnly: false, - isRequired: parameter.required || false, + isRequired: parameter.required === true, isNullable: false, imports: [], extends: [], diff --git a/src/openApi/v3/parser/getOperationRequestBody.ts b/src/openApi/v3/parser/getOperationRequestBody.ts new file mode 100644 index 00000000..662aa385 --- /dev/null +++ b/src/openApi/v3/parser/getOperationRequestBody.ts @@ -0,0 +1,60 @@ +import { OpenApi } from '../interfaces/OpenApi'; +import { OpenApiRequestBody } from '../interfaces/OpenApiRequestBody'; +import { OperationParameter } from '../../../client/interfaces/OperationParameter'; +import { PrimaryType } from './constants'; +import { getComment } from './getComment'; +import { getContent } from './getContent'; +import { getModel } from './getModel'; +import { getType } from './getType'; + +export function getOperationRequestBody(openApi: OpenApi, parameter: OpenApiRequestBody): OperationParameter { + const requestBody: OperationParameter = { + in: 'body', + prop: 'body', + export: 'interface', + name: 'requestBody', + type: PrimaryType.OBJECT, + base: PrimaryType.OBJECT, + template: null, + link: null, + description: getComment(parameter.description), + default: undefined, + isProperty: false, + isReadOnly: false, + isRequired: parameter.required === true, + isNullable: false, + imports: [], + extends: [], + enum: [], + enums: [], + properties: [], + }; + + if (parameter.content) { + const schema = getContent(openApi, parameter.content); + if (schema) { + if (schema && schema.$ref) { + const model = getType(schema.$ref); + requestBody.export = 'reference'; + requestBody.type = model.type; + requestBody.base = model.base; + requestBody.template = model.template; + requestBody.imports.push(...model.imports); + } else { + const model = getModel(openApi, schema); + requestBody.export = model.export; + requestBody.type = model.type; + requestBody.base = model.base; + requestBody.template = model.template; + requestBody.link = model.link; + requestBody.imports.push(...model.imports); + requestBody.extends.push(...model.extends); + requestBody.enum.push(...model.enum); + requestBody.enums.push(...model.enums); + requestBody.properties.push(...model.properties); + } + } + } + + return requestBody; +} diff --git a/src/openApi/v3/parser/getOperationResponse.ts b/src/openApi/v3/parser/getOperationResponse.ts index cb04bb1d..44d7285d 100644 --- a/src/openApi/v3/parser/getOperationResponse.ts +++ b/src/openApi/v3/parser/getOperationResponse.ts @@ -3,6 +3,9 @@ import { OpenApiResponse } from '../interfaces/OpenApiResponse'; import { OperationResponse } from '../../../client/interfaces/OperationResponse'; import { PrimaryType } from './constants'; import { getComment } from './getComment'; +import { getContent } from './getContent'; +import { getModel } from './getModel'; +import { getType } from './getType'; export function getOperationResponse(openApi: OpenApi, response: OpenApiResponse, responseCode: number): OperationResponse { const operationResponse: OperationResponse = { @@ -25,33 +28,31 @@ export function getOperationResponse(openApi: OpenApi, response: OpenApiResponse properties: [], }; - // If this response has a schema, then we need to check two things: - // if this is a reference then the parameter is just the 'name' of - // this reference type. Otherwise it might be a complex schema and - // then we need to parse the schema! - - // if (response.schema) { - // if (response.schema.$ref) { - // const model = getType(response.schema.$ref); - // operationResponse.export = 'reference'; - // operationResponse.type = model.type; - // operationResponse.base = model.base; - // operationResponse.template = model.template; - // operationResponse.imports.push(...model.imports); - // } else { - // const model = getModel(openApi, response.schema); - // operationResponse.export = model.export; - // operationResponse.type = model.type; - // operationResponse.base = model.base; - // operationResponse.template = model.template; - // operationResponse.link = model.link; - // operationResponse.imports.push(...model.imports); - // operationResponse.extends.push(...model.extends); - // operationResponse.enum.push(...model.enum); - // operationResponse.enums.push(...model.enums); - // operationResponse.properties.push(...model.properties); - // } - // } + if (response.content) { + const schema = getContent(openApi, response.content); + if (schema) { + if (schema && schema.$ref) { + const model = getType(schema.$ref); + operationResponse.export = 'reference'; + operationResponse.type = model.type; + operationResponse.base = model.base; + operationResponse.template = model.template; + operationResponse.imports.push(...model.imports); + } else { + const model = getModel(openApi, schema); + operationResponse.export = model.export; + operationResponse.type = model.type; + operationResponse.base = model.base; + operationResponse.template = model.template; + operationResponse.link = model.link; + operationResponse.imports.push(...model.imports); + operationResponse.extends.push(...model.extends); + operationResponse.enum.push(...model.enum); + operationResponse.enums.push(...model.enums); + operationResponse.properties.push(...model.properties); + } + } + } return operationResponse; } diff --git a/src/openApi/v3/parser/getType.ts b/src/openApi/v3/parser/getType.ts index 21df6122..3c12cc67 100644 --- a/src/openApi/v3/parser/getType.ts +++ b/src/openApi/v3/parser/getType.ts @@ -1,7 +1,7 @@ -import {PrimaryType} from './constants'; -import {Type} from '../../../client/interfaces/Type'; -import {getMappedType, hasMappedType} from './getMappedType'; -import {stripNamespace} from './stripNamespace'; +import { PrimaryType } from './constants'; +import { Type } from '../../../client/interfaces/Type'; +import { getMappedType, hasMappedType } from './getMappedType'; +import { stripNamespace } from './stripNamespace'; /** * Parse any string value into a type object. diff --git a/src/templates/typescript/partials/exportInterface.hbs b/src/templates/typescript/partials/exportInterface.hbs index 5e993958..f5192ccc 100644 --- a/src/templates/typescript/partials/exportInterface.hbs +++ b/src/templates/typescript/partials/exportInterface.hbs @@ -10,7 +10,7 @@ export interface {{{name}}}{{#if extends}} extends {{#each extends}}{{{this}}}{{ * {{{description}}} */ {{/if}} - {{#if readOnly}}readonly {{/if}}{{{name}}}{{#unless isRequired}}?{{/unless}}: {{>type parent=../name}}{{#if isNullable}} | null{{/if}}; + {{#if isReadOnly}}readonly {{/if}}{{{name}}}{{#unless isRequired}}?{{/unless}}: {{>type parent=../name}}{{#if isNullable}} | null{{/if}}; {{/each}} } diff --git a/src/templates/typescript/partials/typeInterface.hbs b/src/templates/typescript/partials/typeInterface.hbs index f8fbc3a0..1b0823b6 100644 --- a/src/templates/typescript/partials/typeInterface.hbs +++ b/src/templates/typescript/partials/typeInterface.hbs @@ -6,7 +6,7 @@ * {{{description}}} */ {{/if}} -{{#if readOnly}}readonly {{/if}}{{{name}}}{{#unless isRequired}}?{{/unless}}: {{>type}}{{#if isNullable}} | null{{/if}}{{#unless @last}},{{/unless}} +{{#if isReadOnly}}readonly {{/if}}{{{name}}}{{#unless isRequired}}?{{/unless}}: {{>type}}{{#if isNullable}} | null{{/if}}{{#unless @last}},{{/unless}} {{/each}} } {{~else~}} diff --git a/test/__snapshots__/index.spec.js.snap b/test/__snapshots__/index.spec.js.snap index 48cfb75f..6eccbb8c 100644 --- a/test/__snapshots__/index.spec.js.snap +++ b/test/__snapshots__/index.spec.js.snap @@ -389,6 +389,7 @@ export { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescript export { ModelWithInteger } from './models/ModelWithInteger'; export { ModelWithLink } from './models/ModelWithLink'; export { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; +export { ModelWithProperties } from './models/ModelWithProperties'; export { ModelWithReference } from './models/ModelWithReference'; export { ModelWithString } from './models/ModelWithString'; export { SimpleBoolean } from './models/SimpleBoolean'; @@ -1315,11 +1316,11 @@ export let ModelWithNestedProperties; yup.object().shape({ second: yup.lazy(() => ( yup.object().shape({ - third: yup.lazy(() => yup.string().default(undefined)) + third: yup.lazy(() => yup.string().default(undefined)).isRequired() }).noUnknown() - ).default(undefined)) + ).default(undefined)).isRequired() }).noUnknown() - ).default(undefined)) + ).default(undefined)).isRequired() }).noUnknown() ); @@ -1334,6 +1335,42 @@ export let ModelWithNestedProperties; })(ModelWithNestedProperties || (ModelWithNestedProperties = {}));" `; +exports[`generation v2 javascript file(./test/result/v2/javascript/models/ModelWithProperties.js): ./test/result/v2/javascript/models/ModelWithProperties.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model with one nested property + */ +export let ModelWithProperties; +(function (ModelWithProperties) { + + ModelWithProperties.schema = ( + yup.object().shape({ + boolean: yup.lazy(() => yup.boolean().default(undefined)), + number: yup.lazy(() => yup.number().default(undefined)), + reference: yup.lazy(() => ModelWithString.schema.default(undefined)), + required: yup.lazy(() => yup.string().default(undefined)).isRequired(), + requiredAndreadOnly: yup.lazy(() => yup.string().default(undefined)).isRequired(), + string: yup.lazy(() => yup.string().default(undefined)) + }).noUnknown() + ); + + ModelWithProperties.validate = async function(value) { + return ModelWithProperties.schema.validate(value, { strict: true }); + }; + + ModelWithProperties.validateSync = function(value) { + return ModelWithProperties.schema.validateSync(value, { strict: true }); + }; + +})(ModelWithProperties || (ModelWithProperties = {}));" +`; + exports[`generation v2 javascript file(./test/result/v2/javascript/models/ModelWithReference.js): ./test/result/v2/javascript/models/ModelWithReference.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ @@ -2314,6 +2351,7 @@ export { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescript export { ModelWithInteger } from './models/ModelWithInteger'; export { ModelWithLink } from './models/ModelWithLink'; export { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; +export { ModelWithProperties } from './models/ModelWithProperties'; export { ModelWithReference } from './models/ModelWithReference'; export { ModelWithString } from './models/ModelWithString'; export { SimpleBoolean } from './models/SimpleBoolean'; @@ -3329,9 +3367,9 @@ import * as yup from 'yup'; * This is a model with one nested property */ export interface ModelWithNestedProperties { - first?: { - second?: { - third?: string + readonly first: { + readonly second: { + readonly third: string } }; } @@ -3344,11 +3382,11 @@ export namespace ModelWithNestedProperties { yup.object().shape({ second: yup.lazy(() => ( yup.object().shape({ - third: yup.lazy(() => yup.string().default(undefined)) + third: yup.lazy(() => yup.string().default(undefined).required()) }).noUnknown() - ).default(undefined)) + ).default(undefined).required()) }).noUnknown() - ).default(undefined)) + ).default(undefined).required()) }).noUnknown() ); @@ -3362,6 +3400,50 @@ export namespace ModelWithNestedProperties { }" `; +exports[`generation v2 typescript file(./test/result/v2/typescript/models/ModelWithProperties.ts): ./test/result/v2/typescript/models/ModelWithProperties.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model with one nested property + */ +export interface ModelWithProperties { + boolean?: boolean; + number?: number; + reference?: ModelWithString; + required: string; + readonly requiredAndreadOnly: string; + string?: string; +} + +export namespace ModelWithProperties { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + boolean: yup.lazy(() => yup.boolean().default(undefined)), + number: yup.lazy(() => yup.number().default(undefined)), + reference: yup.lazy(() => ModelWithString.schema.default(undefined)), + required: yup.lazy(() => yup.string().default(undefined).required()), + requiredAndreadOnly: yup.lazy(() => yup.string().default(undefined).required()), + string: yup.lazy(() => yup.string().default(undefined)) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelWithProperties { + return schema.validateSync(value, { strict: true }); + } +}" +`; + exports[`generation v2 typescript file(./test/result/v2/typescript/models/ModelWithReference.ts): ./test/result/v2/typescript/models/ModelWithReference.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -3996,7 +4078,7 @@ exports[`generation v3 javascript file(./test/result/v3/javascript/core/OpenAPI. export let OpenAPI; (function (OpenAPI) { - OpenAPI.BASE = '/access-manager'; + OpenAPI.BASE = '/api'; OpenAPI.VERSION = '1'; OpenAPI.CLIENT = 'xhr'; OpenAPI.TOKEN = ''; @@ -4293,554 +4375,694 @@ export { ApiError } from './core/ApiError'; export { isSuccess } from './core/isSuccess'; export { OpenAPI } from './core/OpenAPI'; -export { ApiResource } from './models/ApiResource'; -export { ApiResourceLink } from './models/ApiResourceLink'; -export { ApiResourceRole } from './models/ApiResourceRole'; -export { ApiResourceRoleLink } from './models/ApiResourceRoleLink'; -export { Application } from './models/Application'; -export { ApplicationLink } from './models/ApplicationLink'; -export { ClaimBasedAccessControlEntry } from './models/ClaimBasedAccessControlEntry'; +export { ArrayWithArray } from './models/ArrayWithArray'; +export { ArrayWithBooleans } from './models/ArrayWithBooleans'; +export { ArrayWithNumbers } from './models/ArrayWithNumbers'; +export { ArrayWithProperties } from './models/ArrayWithProperties'; +export { ArrayWithReferences } from './models/ArrayWithReferences'; +export { ArrayWithStrings } from './models/ArrayWithStrings'; -export { ErrorMessage } from './models/ErrorMessage'; -export { ErrorResponse } from './models/ErrorResponse'; -export { IdentityProvider } from './models/IdentityProvider'; -export { IdentityProviderParameters } from './models/IdentityProviderParameters'; -export { IdentityProviderType } from './models/IdentityProviderType'; -export { IInnerError } from './models/IInnerError'; -export { LdapParameters } from './models/LdapParameters'; -export { LoginOption } from './models/LoginOption'; -export { OpenIdParameters } from './models/OpenIdParameters'; -export { ProblemDetails } from './models/ProblemDetails'; -export { SamlParameters } from './models/SamlParameters'; -export { ServiceAccount } from './models/ServiceAccount'; -export { ServiceAccountBasedAccessControlEntry } from './models/ServiceAccountBasedAccessControlEntry'; -export { User } from './models/User'; -export { UserBasedAccessControlEntry } from './models/UserBasedAccessControlEntry'; -export { UserClientSecret } from './models/UserClientSecret'; -export { WindowsParameters } from './models/WindowsParameters'; +export { DictionaryWithArray } from './models/DictionaryWithArray'; +export { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; +export { DictionaryWithProperties } from './models/DictionaryWithProperties'; +export { DictionaryWithReference } from './models/DictionaryWithReference'; +export { DictionaryWithString } from './models/DictionaryWithString'; +export { EnumFromDescription } from './models/EnumFromDescription'; +export { EnumWithNumbers } from './models/EnumWithNumbers'; +export { EnumWithStrings } from './models/EnumWithStrings'; +export { ModelLink } from './models/ModelLink'; +export { ModelThatExtends } from './models/ModelThatExtends'; +export { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; +export { ModelWithArray } from './models/ModelWithArray'; +export { ModelWithBoolean } from './models/ModelWithBoolean'; +export { ModelWithCircularReference } from './models/ModelWithCircularReference'; +export { ModelWithDictionary } from './models/ModelWithDictionary'; +export { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; +export { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; +export { ModelWithEnum } from './models/ModelWithEnum'; +export { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; +export { ModelWithInteger } from './models/ModelWithInteger'; +export { ModelWithLink } from './models/ModelWithLink'; +export { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; +export { ModelWithProperties } from './models/ModelWithProperties'; +export { ModelWithReference } from './models/ModelWithReference'; +export { ModelWithString } from './models/ModelWithString'; +export { SimpleBoolean } from './models/SimpleBoolean'; +export { SimpleFile } from './models/SimpleFile'; +export { SimpleInteger } from './models/SimpleInteger'; +export { SimpleReference } from './models/SimpleReference'; +export { SimpleString } from './models/SimpleString'; -export { ApiResourcesService } from './services/ApiResourcesService'; -export { ApplicationsService } from './services/ApplicationsService'; -export { ClaimsService } from './services/ClaimsService'; -export { IdentityProvidersService } from './services/IdentityProvidersService'; -export { ServiceAccountsService } from './services/ServiceAccountsService'; -export { SuggestionsService } from './services/SuggestionsService'; -export { UsersService } from './services/UsersService'; +export { ComplexService } from './services/ComplexService'; +export { ParametersService } from './services/ParametersService'; +export { ResponseService } from './services/ResponseService'; +export { SimpleService } from './services/SimpleService'; +export { TypesService } from './services/TypesService'; " `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/ApiResource.js): ./test/result/v3/javascript/models/ApiResource.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ArrayWithArray.js): ./test/result/v3/javascript/models/ArrayWithArray.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ -import { ApiResourceRole } from '../models/ApiResourceRole'; +import { ModelWithString } from '../models/ModelWithString'; import * as yup from 'yup'; -export let ApiResource; -(function (ApiResource) { +/** + * This is a simple array containing an array + */ +export let ArrayWithArray; +(function (ArrayWithArray) { - ApiResource.schema = ( + ArrayWithArray.schema = yup.array().of(yup.array().of(ModelWithString.schema)); + + ArrayWithArray.validate = async function(value) { + return ArrayWithArray.schema.validate(value, { strict: true }); + }; + + ArrayWithArray.validateSync = function(value) { + return ArrayWithArray.schema.validateSync(value, { strict: true }); + }; + +})(ArrayWithArray || (ArrayWithArray = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ArrayWithBooleans.js): ./test/result/v3/javascript/models/ArrayWithBooleans.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple array with booleans + */ +export let ArrayWithBooleans; +(function (ArrayWithBooleans) { + + ArrayWithBooleans.schema = yup.array().of(yup.boolean()); + + ArrayWithBooleans.validate = async function(value) { + return ArrayWithBooleans.schema.validate(value, { strict: true }); + }; + + ArrayWithBooleans.validateSync = function(value) { + return ArrayWithBooleans.schema.validateSync(value, { strict: true }); + }; + +})(ArrayWithBooleans || (ArrayWithBooleans = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ArrayWithNumbers.js): ./test/result/v3/javascript/models/ArrayWithNumbers.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple array with numbers + */ +export let ArrayWithNumbers; +(function (ArrayWithNumbers) { + + ArrayWithNumbers.schema = yup.array().of(yup.number()); + + ArrayWithNumbers.validate = async function(value) { + return ArrayWithNumbers.schema.validate(value, { strict: true }); + }; + + ArrayWithNumbers.validateSync = function(value) { + return ArrayWithNumbers.schema.validateSync(value, { strict: true }); + }; + +})(ArrayWithNumbers || (ArrayWithNumbers = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ArrayWithProperties.js): ./test/result/v3/javascript/models/ArrayWithProperties.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple array with properties + */ +export let ArrayWithProperties; +(function (ArrayWithProperties) { + + ArrayWithProperties.schema = yup.array().of(( yup.object().shape({ - id: yup.lazy(() => yup.number().default(undefined)), - key: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - name: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - roles: yup.lazy(() => yup.array().of(ApiResourceRole.schema).default(undefined).isNullable()) + foo: yup.lazy(() => yup.string().default(undefined)), + bar: yup.lazy(() => yup.string().default(undefined)) }).noUnknown() - ); + )); - ApiResource.validate = async function(value) { - return ApiResource.schema.validate(value, { strict: true }); + ArrayWithProperties.validate = async function(value) { + return ArrayWithProperties.schema.validate(value, { strict: true }); }; - ApiResource.validateSync = function(value) { - return ApiResource.schema.validateSync(value, { strict: true }); + ArrayWithProperties.validateSync = function(value) { + return ArrayWithProperties.schema.validateSync(value, { strict: true }); }; -})(ApiResource || (ApiResource = {}));" +})(ArrayWithProperties || (ArrayWithProperties = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/ApiResourceLink.js): ./test/result/v3/javascript/models/ApiResourceLink.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ArrayWithReferences.js): ./test/result/v3/javascript/models/ArrayWithReferences.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a simple array with references + */ +export let ArrayWithReferences; +(function (ArrayWithReferences) { + + ArrayWithReferences.schema = yup.array().of(ModelWithString.schema); + + ArrayWithReferences.validate = async function(value) { + return ArrayWithReferences.schema.validate(value, { strict: true }); + }; + + ArrayWithReferences.validateSync = function(value) { + return ArrayWithReferences.schema.validateSync(value, { strict: true }); + }; + +})(ArrayWithReferences || (ArrayWithReferences = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ArrayWithStrings.js): ./test/result/v3/javascript/models/ArrayWithStrings.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ import * as yup from 'yup'; -export let ApiResourceLink; -(function (ApiResourceLink) { +/** + * This is a simple array with strings + */ +export let ArrayWithStrings; +(function (ArrayWithStrings) { - ApiResourceLink.schema = ( - yup.object().shape({ - id: yup.lazy(() => yup.number().default(undefined)), - name: yup.lazy(() => yup.string().default(undefined).isNullable()) - }).noUnknown() - ); + ArrayWithStrings.schema = yup.array().of(yup.string()); - ApiResourceLink.validate = async function(value) { - return ApiResourceLink.schema.validate(value, { strict: true }); + ArrayWithStrings.validate = async function(value) { + return ArrayWithStrings.schema.validate(value, { strict: true }); }; - ApiResourceLink.validateSync = function(value) { - return ApiResourceLink.schema.validateSync(value, { strict: true }); + ArrayWithStrings.validateSync = function(value) { + return ArrayWithStrings.schema.validateSync(value, { strict: true }); }; -})(ApiResourceLink || (ApiResourceLink = {}));" +})(ArrayWithStrings || (ArrayWithStrings = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/ApiResourceRole.js): ./test/result/v3/javascript/models/ApiResourceRole.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/DictionaryWithArray.js): ./test/result/v3/javascript/models/DictionaryWithArray.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ -import { ApiResource } from '../models/ApiResource'; + +import { ModelWithString } from '../models/ModelWithString'; import * as yup from 'yup'; -export let ApiResourceRole; -(function (ApiResourceRole) { +/** + * This is a complex dictionary + */ +export let DictionaryWithArray; +(function (DictionaryWithArray) { - ApiResourceRole.schema = ( - yup.object().shape({ - apiResource: yup.lazy(() => ApiResource.schema.default(undefined)), - id: yup.lazy(() => yup.number().default(undefined)), - key: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - name: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired() - }).noUnknown() - ); + DictionaryWithArray.schema = yup.lazy(value => { + return yup.object().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: yup.array().of(ModelWithString.schema) + }), {}) + ); + }); - ApiResourceRole.validate = async function(value) { - return ApiResourceRole.schema.validate(value, { strict: true }); + DictionaryWithArray.validate = async function(value) { + return DictionaryWithArray.schema.validate(value, { strict: true }); }; - ApiResourceRole.validateSync = function(value) { - return ApiResourceRole.schema.validateSync(value, { strict: true }); + DictionaryWithArray.validateSync = function(value) { + return DictionaryWithArray.schema.validateSync(value, { strict: true }); }; -})(ApiResourceRole || (ApiResourceRole = {}));" +})(DictionaryWithArray || (DictionaryWithArray = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/ApiResourceRoleLink.js): ./test/result/v3/javascript/models/ApiResourceRoleLink.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/DictionaryWithDictionary.js): ./test/result/v3/javascript/models/DictionaryWithDictionary.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + + +import * as yup from 'yup'; + +/** + * This is a string dictionary + */ +export let DictionaryWithDictionary; +(function (DictionaryWithDictionary) { + + DictionaryWithDictionary.schema = yup.lazy(value => { + return yup.object().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: yup.lazy(value => { + return yup.object().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: yup.string() + }), {}) + ); + }) + }), {}) + ); + }); + + DictionaryWithDictionary.validate = async function(value) { + return DictionaryWithDictionary.schema.validate(value, { strict: true }); + }; + + DictionaryWithDictionary.validateSync = function(value) { + return DictionaryWithDictionary.schema.validateSync(value, { strict: true }); + }; + +})(DictionaryWithDictionary || (DictionaryWithDictionary = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/DictionaryWithProperties.js): ./test/result/v3/javascript/models/DictionaryWithProperties.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + + +import * as yup from 'yup'; + +/** + * This is a complex dictionary + */ +export let DictionaryWithProperties; +(function (DictionaryWithProperties) { + + DictionaryWithProperties.schema = yup.lazy(value => { + return yup.object().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: ( + yup.object().shape({ + foo: yup.lazy(() => yup.string().default(undefined)), + bar: yup.lazy(() => yup.string().default(undefined)) + }).noUnknown() + ) + }), {}) + ); + }); + + DictionaryWithProperties.validate = async function(value) { + return DictionaryWithProperties.schema.validate(value, { strict: true }); + }; + + DictionaryWithProperties.validateSync = function(value) { + return DictionaryWithProperties.schema.validateSync(value, { strict: true }); + }; + +})(DictionaryWithProperties || (DictionaryWithProperties = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/DictionaryWithReference.js): ./test/result/v3/javascript/models/DictionaryWithReference.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a string reference + */ +export let DictionaryWithReference; +(function (DictionaryWithReference) { + + DictionaryWithReference.schema = yup.lazy(value => { + return yup.object().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: ModelWithString.schema + }), {}) + ); + }); + + DictionaryWithReference.validate = async function(value) { + return DictionaryWithReference.schema.validate(value, { strict: true }); + }; + + DictionaryWithReference.validateSync = function(value) { + return DictionaryWithReference.schema.validateSync(value, { strict: true }); + }; + +})(DictionaryWithReference || (DictionaryWithReference = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/DictionaryWithString.js): ./test/result/v3/javascript/models/DictionaryWithString.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + + +import * as yup from 'yup'; + +/** + * This is a string dictionary + */ +export let DictionaryWithString; +(function (DictionaryWithString) { + + DictionaryWithString.schema = yup.lazy(value => { + return yup.object().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: yup.string() + }), {}) + ); + }); + + DictionaryWithString.validate = async function(value) { + return DictionaryWithString.schema.validate(value, { strict: true }); + }; + + DictionaryWithString.validateSync = function(value) { + return DictionaryWithString.schema.validateSync(value, { strict: true }); + }; + +})(DictionaryWithString || (DictionaryWithString = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/EnumFromDescription.js): ./test/result/v3/javascript/models/EnumFromDescription.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ import * as yup from 'yup'; -export let ApiResourceRoleLink; -(function (ApiResourceRoleLink) { - - ApiResourceRoleLink.schema = ( - yup.object().shape({ - id: yup.lazy(() => yup.number().default(undefined)), - name: yup.lazy(() => yup.string().default(undefined).isNullable()) - }).noUnknown() - ); - - ApiResourceRoleLink.validate = async function(value) { - return ApiResourceRoleLink.schema.validate(value, { strict: true }); - }; - - ApiResourceRoleLink.validateSync = function(value) { - return ApiResourceRoleLink.schema.validateSync(value, { strict: true }); - }; - -})(ApiResourceRoleLink || (ApiResourceRoleLink = {}));" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/models/Application.js): ./test/result/v3/javascript/models/Application.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import * as yup from 'yup'; - -export let Application; -(function (Application) { - - Application.schema = ( - yup.object().shape({ - clientId: yup.lazy(() => yup.string().default(undefined).isNullable()), - createdAt: yup.lazy(() => yup.string().default(undefined)), - createdBy: yup.lazy(() => yup.number().default(undefined).isNullable()), - id: yup.lazy(() => yup.number().default(undefined)), - modifiedAt: yup.lazy(() => yup.string().default(undefined)), - modifiedBy: yup.lazy(() => yup.number().default(undefined).isNullable()), - name: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - redirectUrls: yup.lazy(() => yup.array().of(yup.string()).default(undefined).isNullable()).isRequired() - }).noUnknown() - ); - - Application.validate = async function(value) { - return Application.schema.validate(value, { strict: true }); - }; - - Application.validateSync = function(value) { - return Application.schema.validateSync(value, { strict: true }); - }; - -})(Application || (Application = {}));" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/models/ApplicationLink.js): ./test/result/v3/javascript/models/ApplicationLink.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import * as yup from 'yup'; - -export let ApplicationLink; -(function (ApplicationLink) { - - ApplicationLink.schema = ( - yup.object().shape({ - id: yup.lazy(() => yup.number().default(undefined)), - name: yup.lazy(() => yup.string().default(undefined).isNullable()) - }).noUnknown() - ); - - ApplicationLink.validate = async function(value) { - return ApplicationLink.schema.validate(value, { strict: true }); - }; - - ApplicationLink.validateSync = function(value) { - return ApplicationLink.schema.validateSync(value, { strict: true }); - }; - -})(ApplicationLink || (ApplicationLink = {}));" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/models/ClaimBasedAccessControlEntry.js): ./test/result/v3/javascript/models/ClaimBasedAccessControlEntry.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiResourceLink } from '../models/ApiResourceLink'; -import { ApiResourceRoleLink } from '../models/ApiResourceRoleLink'; -import { ApplicationLink } from '../models/ApplicationLink'; -import * as yup from 'yup'; - -export let ClaimBasedAccessControlEntry; -(function (ClaimBasedAccessControlEntry) { - - ClaimBasedAccessControlEntry.schema = ( - yup.object().shape({ - apiResourceRoles: yup.lazy(() => yup.array().of(ApiResourceRoleLink.schema).default(undefined).isNullable()), - apiResources: yup.lazy(() => yup.array().of(ApiResourceLink.schema).default(undefined).isNullable()), - applications: yup.lazy(() => yup.array().of(ApplicationLink.schema).default(undefined).isNullable()), - claimType: yup.lazy(() => yup.string().default(undefined).isNullable()), - claimValue: yup.lazy(() => yup.string().default(undefined).isNullable()) - }).noUnknown() - ); - - ClaimBasedAccessControlEntry.validate = async function(value) { - return ClaimBasedAccessControlEntry.schema.validate(value, { strict: true }); - }; - - ClaimBasedAccessControlEntry.validateSync = function(value) { - return ClaimBasedAccessControlEntry.schema.validateSync(value, { strict: true }); - }; - -})(ClaimBasedAccessControlEntry || (ClaimBasedAccessControlEntry = {}));" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/models/ErrorMessage.js): ./test/result/v3/javascript/models/ErrorMessage.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import { IInnerError } from '../models/IInnerError'; -import * as yup from 'yup'; - -export let ErrorMessage; -(function (ErrorMessage) { - - ErrorMessage.schema = ( - yup.object().shape({ - code: yup.lazy(() => yup.string().default(undefined).isNullable()), - details: yup.lazy(() => yup.array().of(ErrorMessage.schema).default(undefined).isNullable()), - innerError: yup.lazy(() => IInnerError.schema.default(undefined)), - innerException: yup.lazy(() => ErrorMessage.schema.default(undefined)), - localizedMessage: yup.lazy(() => yup.string().default(undefined).isNullable()), - message: yup.lazy(() => yup.string().default(undefined).isNullable()), - stackTrace: yup.lazy(() => yup.string().default(undefined).isNullable()), - target: yup.lazy(() => yup.string().default(undefined).isNullable()) - }).noUnknown() - ); - - ErrorMessage.validate = async function(value) { - return ErrorMessage.schema.validate(value, { strict: true }); - }; - - ErrorMessage.validateSync = function(value) { - return ErrorMessage.schema.validateSync(value, { strict: true }); - }; - -})(ErrorMessage || (ErrorMessage = {}));" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/models/ErrorResponse.js): ./test/result/v3/javascript/models/ErrorResponse.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ErrorMessage } from '../models/ErrorMessage'; -import * as yup from 'yup'; - -export let ErrorResponse; -(function (ErrorResponse) { - - ErrorResponse.schema = ( - yup.object().shape({ - errorMessage: yup.lazy(() => ErrorMessage.schema.default(undefined)) - }).noUnknown() - ); - - ErrorResponse.validate = async function(value) { - return ErrorResponse.schema.validate(value, { strict: true }); - }; - - ErrorResponse.validateSync = function(value) { - return ErrorResponse.schema.validateSync(value, { strict: true }); - }; - -})(ErrorResponse || (ErrorResponse = {}));" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/models/IInnerError.js): ./test/result/v3/javascript/models/IInnerError.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import * as yup from 'yup'; - -export let IInnerError; -(function (IInnerError) { - - IInnerError.schema = ( - yup.object().shape({ - code: yup.lazy(() => yup.string().default(undefined).isNullable()), - innerError: yup.lazy(() => IInnerError.schema.default(undefined)) - }).noUnknown() - ); - - IInnerError.validate = async function(value) { - return IInnerError.schema.validate(value, { strict: true }); - }; - - IInnerError.validateSync = function(value) { - return IInnerError.schema.validateSync(value, { strict: true }); - }; - -})(IInnerError || (IInnerError = {}));" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/models/IdentityProvider.js): ./test/result/v3/javascript/models/IdentityProvider.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ClaimBasedAccessControlEntry } from '../models/ClaimBasedAccessControlEntry'; -import { IdentityProviderParameters } from '../models/IdentityProviderParameters'; -import { IdentityProviderType } from '../models/IdentityProviderType'; -import * as yup from 'yup'; - -export let IdentityProvider; -(function (IdentityProvider) { - - IdentityProvider.schema = ( - yup.object().shape({ - accessControlList: yup.lazy(() => yup.array().of(ClaimBasedAccessControlEntry.schema).default(undefined).isNullable()), - createdAt: yup.lazy(() => yup.string().default(undefined)), - createdBy: yup.lazy(() => yup.number().default(undefined).isNullable()), - description: yup.lazy(() => yup.string().default(undefined).isNullable()), - forwardedClaims: yup.lazy(() => yup.array().of(yup.string()).default(undefined).isNullable()), - iconUrl: yup.lazy(() => yup.string().default(undefined).isNullable()), - iconViewUrl: yup.lazy(() => yup.string().default(undefined).isNullable()), - id: yup.lazy(() => yup.number().default(undefined)), - isEnabled: yup.lazy(() => yup.boolean().default(undefined)), - key: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - modifiedAt: yup.lazy(() => yup.string().default(undefined)), - modifiedBy: yup.lazy(() => yup.number().default(undefined).isNullable()), - name: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - parameters: yup.lazy(() => IdentityProviderParameters.schema.default(undefined)).isRequired(), - postLogoutRedirectUrl: yup.lazy(() => yup.string().default(undefined).isNullable()), - redirectUrl: yup.lazy(() => yup.string().default(undefined).isNullable()), - type: yup.lazy(() => IdentityProviderType.schema.default(undefined)).isRequired(), - validateUrl: yup.lazy(() => yup.string().default(undefined).isNullable()) - }).noUnknown() - ); - - IdentityProvider.validate = async function(value) { - return IdentityProvider.schema.validate(value, { strict: true }); - }; - - IdentityProvider.validateSync = function(value) { - return IdentityProvider.schema.validateSync(value, { strict: true }); - }; - -})(IdentityProvider || (IdentityProvider = {}));" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/models/IdentityProviderParameters.js): ./test/result/v3/javascript/models/IdentityProviderParameters.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import * as yup from 'yup'; - -export let IdentityProviderParameters; -(function (IdentityProviderParameters) { - - IdentityProviderParameters.schema = ( - yup.object() - ); - - IdentityProviderParameters.validate = async function(value) { - return IdentityProviderParameters.schema.validate(value, { strict: true }); - }; - - IdentityProviderParameters.validateSync = function(value) { - return IdentityProviderParameters.schema.validateSync(value, { strict: true }); - }; - -})(IdentityProviderParameters || (IdentityProviderParameters = {}));" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/models/IdentityProviderType.js): ./test/result/v3/javascript/models/IdentityProviderType.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import * as yup from 'yup'; - -export let IdentityProviderType; -(function (IdentityProviderType) { - - IdentityProviderType.LDAP = 'LDAP'; - IdentityProviderType.OPEN_ID_CONNECT = 'OpenIdConnect'; - IdentityProviderType.SAML2P = 'SAML2P'; - IdentityProviderType.WINDOWS = 'Windows'; - - IdentityProviderType.schema = yup.mixed().oneOf([ - IdentityProviderType.LDAP, - IdentityProviderType.OPEN_ID_CONNECT, - IdentityProviderType.SAML2P, - IdentityProviderType.WINDOWS +/** + * Success=1,Warning=2,Error=3 + */ +export let EnumFromDescription; +(function (EnumFromDescription) { + + EnumFromDescription.ERROR = 3; + EnumFromDescription.SUCCESS = 1; + EnumFromDescription.WARNING = 2; + + EnumFromDescription.schema = yup.mixed().oneOf([ + EnumFromDescription.ERROR, + EnumFromDescription.SUCCESS, + EnumFromDescription.WARNING ]); - IdentityProviderType.validate = async function(value) { - return IdentityProviderType.schema.validate(value, { strict: true }); + EnumFromDescription.validate = async function(value) { + return EnumFromDescription.schema.validate(value, { strict: true }); }; - IdentityProviderType.validateSync = function(value) { - return IdentityProviderType.schema.validateSync(value, { strict: true }); + EnumFromDescription.validateSync = function(value) { + return EnumFromDescription.schema.validateSync(value, { strict: true }); }; -})(IdentityProviderType || (IdentityProviderType = {}));" +})(EnumFromDescription || (EnumFromDescription = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/LdapParameters.js): ./test/result/v3/javascript/models/LdapParameters.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/EnumWithNumbers.js): ./test/result/v3/javascript/models/EnumWithNumbers.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ import * as yup from 'yup'; -export let LdapParameters; -(function (LdapParameters) { +/** + * This is a simple enum with numbers + */ +export let EnumWithNumbers; +(function (EnumWithNumbers) { - LdapParameters.schema = ( + EnumWithNumbers.NUM_1 = 1; + EnumWithNumbers.NUM_2 = 2; + EnumWithNumbers.NUM_3 = 3; + + EnumWithNumbers.schema = yup.mixed().oneOf([ + EnumWithNumbers.NUM_1, + EnumWithNumbers.NUM_2, + EnumWithNumbers.NUM_3 + ]); + + EnumWithNumbers.validate = async function(value) { + return EnumWithNumbers.schema.validate(value, { strict: true }); + }; + + EnumWithNumbers.validateSync = function(value) { + return EnumWithNumbers.schema.validateSync(value, { strict: true }); + }; + +})(EnumWithNumbers || (EnumWithNumbers = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/EnumWithStrings.js): ./test/result/v3/javascript/models/EnumWithStrings.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple enum with strings + */ +export let EnumWithStrings; +(function (EnumWithStrings) { + + EnumWithStrings.ERROR = 'Error'; + EnumWithStrings.SUCCESS = 'Success'; + EnumWithStrings.WARNING = 'Warning'; + + EnumWithStrings.schema = yup.mixed().oneOf([ + EnumWithStrings.ERROR, + EnumWithStrings.SUCCESS, + EnumWithStrings.WARNING + ]); + + EnumWithStrings.validate = async function(value) { + return EnumWithStrings.schema.validate(value, { strict: true }); + }; + + EnumWithStrings.validateSync = function(value) { + return EnumWithStrings.schema.validateSync(value, { strict: true }); + }; + +})(EnumWithStrings || (EnumWithStrings = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelLink.js): ./test/result/v3/javascript/models/ModelLink.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a model that can have a template?? + */ +export let ModelLink; +(function (ModelLink) { + + ModelLink.schema = ( yup.object().shape({ - additionalAttributes: yup.lazy(() => yup.string().default(undefined).isNullable()), - fullNameClaim: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - groupBaseDn: yup.lazy(() => yup.string().default(undefined).isNullable()), - groupMemberAttribute: yup.lazy(() => yup.string().default(undefined).isNullable()), - port: yup.lazy(() => yup.number().default(undefined)).isRequired(), - searchAccount: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - searchAccountPassword: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - separator: yup.lazy(() => yup.string().default(undefined).isNullable()), - serverAddress: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - userBaseDn: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - usernameClaim: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - useSsl: yup.lazy(() => yup.boolean().default(undefined)).isRequired() + id: yup.lazy(() => yup.string().default(undefined)) }).noUnknown() ); - LdapParameters.validate = async function(value) { - return LdapParameters.schema.validate(value, { strict: true }); + ModelLink.validate = async function(value) { + return ModelLink.schema.validate(value, { strict: true }); }; - LdapParameters.validateSync = function(value) { - return LdapParameters.schema.validateSync(value, { strict: true }); + ModelLink.validateSync = function(value) { + return ModelLink.schema.validateSync(value, { strict: true }); }; -})(LdapParameters || (LdapParameters = {}));" +})(ModelLink || (ModelLink = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/LoginOption.js): ./test/result/v3/javascript/models/LoginOption.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelThatExtends.js): ./test/result/v3/javascript/models/ModelThatExtends.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ +import { ModelWithString } from '../models/ModelWithString'; import * as yup from 'yup'; -export let LoginOption; -(function (LoginOption) { +/** + * This is a model that extends another model + */ +export let ModelThatExtends; +(function (ModelThatExtends) { - LoginOption.schema = ( + ModelThatExtends.schema = ( + ModelWithString.schema.concat( + yup.object().shape({ + propExtendsA: yup.lazy(() => yup.string().default(undefined)), + propExtendsB: yup.lazy(() => ModelWithString.schema.default(undefined)) + }).noUnknown() + ) + ); + + ModelThatExtends.validate = async function(value) { + return ModelThatExtends.schema.validate(value, { strict: true }); + }; + + ModelThatExtends.validateSync = function(value) { + return ModelThatExtends.schema.validateSync(value, { strict: true }); + }; + +})(ModelThatExtends || (ModelThatExtends = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelThatExtendsExtends.js): ./test/result/v3/javascript/models/ModelThatExtendsExtends.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelThatExtends } from '../models/ModelThatExtends'; +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model that extends another model + */ +export let ModelThatExtendsExtends; +(function (ModelThatExtendsExtends) { + + ModelThatExtendsExtends.schema = ( + ModelWithString.schema.concat( + ModelThatExtends.schema.concat( + yup.object().shape({ + propExtendsC: yup.lazy(() => yup.string().default(undefined)), + propExtendsD: yup.lazy(() => ModelWithString.schema.default(undefined)) + }).noUnknown() + ) + ) + ); + + ModelThatExtendsExtends.validate = async function(value) { + return ModelThatExtendsExtends.schema.validate(value, { strict: true }); + }; + + ModelThatExtendsExtends.validateSync = function(value) { + return ModelThatExtendsExtends.schema.validateSync(value, { strict: true }); + }; + +})(ModelThatExtendsExtends || (ModelThatExtendsExtends = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithArray.js): ./test/result/v3/javascript/models/ModelWithArray.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model with one property containing an array + */ +export let ModelWithArray; +(function (ModelWithArray) { + + ModelWithArray.schema = ( yup.object().shape({ - iconUrl: yup.lazy(() => yup.string().default(undefined).isNullable()), - loginTriggerUrl: yup.lazy(() => yup.string().default(undefined).isNullable()), - name: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired() + prop: yup.lazy(() => yup.array().of(ModelWithString.schema).default(undefined)) }).noUnknown() ); - LoginOption.validate = async function(value) { - return LoginOption.schema.validate(value, { strict: true }); + ModelWithArray.validate = async function(value) { + return ModelWithArray.schema.validate(value, { strict: true }); }; - LoginOption.validateSync = function(value) { - return LoginOption.schema.validateSync(value, { strict: true }); + ModelWithArray.validateSync = function(value) { + return ModelWithArray.schema.validateSync(value, { strict: true }); }; -})(LoginOption || (LoginOption = {}));" +})(ModelWithArray || (ModelWithArray = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/OpenIdParameters.js): ./test/result/v3/javascript/models/OpenIdParameters.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithBoolean.js): ./test/result/v3/javascript/models/ModelWithBoolean.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ import * as yup from 'yup'; -export let OpenIdParameters; -(function (OpenIdParameters) { +/** + * This is a model with one boolean property + */ +export let ModelWithBoolean; +(function (ModelWithBoolean) { - OpenIdParameters.schema = ( + ModelWithBoolean.schema = ( yup.object().shape({ - authority: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - clientId: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - clientSecret: yup.lazy(() => yup.string().default(undefined).isNullable()), - endSessionEndpoint: yup.lazy(() => yup.string().default(undefined).isNullable()), - fullNameClaim: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - sendIdTokenHintDuringLogout: yup.lazy(() => yup.boolean().default(undefined)), - separator: yup.lazy(() => yup.string().default(undefined).isNullable()), - usernameClaim: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired() + prop: yup.lazy(() => yup.boolean().default(undefined)) }).noUnknown() ); - OpenIdParameters.validate = async function(value) { - return OpenIdParameters.schema.validate(value, { strict: true }); + ModelWithBoolean.validate = async function(value) { + return ModelWithBoolean.schema.validate(value, { strict: true }); }; - OpenIdParameters.validateSync = function(value) { - return OpenIdParameters.schema.validateSync(value, { strict: true }); + ModelWithBoolean.validateSync = function(value) { + return ModelWithBoolean.schema.validateSync(value, { strict: true }); }; -})(OpenIdParameters || (OpenIdParameters = {}));" +})(ModelWithBoolean || (ModelWithBoolean = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/ProblemDetails.js): ./test/result/v3/javascript/models/ProblemDetails.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithCircularReference.js): ./test/result/v3/javascript/models/ModelWithCircularReference.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a model with one property containing a circular reference + */ +export let ModelWithCircularReference; +(function (ModelWithCircularReference) { + + ModelWithCircularReference.schema = ( + yup.object().shape({ + prop: yup.lazy(() => ModelWithCircularReference.schema.default(undefined)) + }).noUnknown() + ); + + ModelWithCircularReference.validate = async function(value) { + return ModelWithCircularReference.schema.validate(value, { strict: true }); + }; + + ModelWithCircularReference.validateSync = function(value) { + return ModelWithCircularReference.schema.validateSync(value, { strict: true }); + }; + +})(ModelWithCircularReference || (ModelWithCircularReference = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithDictionary.js): ./test/result/v3/javascript/models/ModelWithDictionary.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ @@ -4848,273 +5070,516 @@ exports[`generation v3 javascript file(./test/result/v3/javascript/models/Proble import * as yup from 'yup'; -export let ProblemDetails; -(function (ProblemDetails) { +/** + * This is a model with one property containing a dictionary + */ +export let ModelWithDictionary; +(function (ModelWithDictionary) { - ProblemDetails.schema = ( + ModelWithDictionary.schema = ( yup.object().shape({ - detail: yup.lazy(() => yup.string().default(undefined).isNullable()), - extensions: yup.lazy(() => yup.lazy(value => { + prop: yup.lazy(() => yup.lazy(value => { return yup.object().shape( Object.entries(value).reduce((obj, item) => ({ ...obj, - [item[0]]: ( - yup.object() - ) + [item[0]]: yup.string() }), {}) ); - }).default(undefined).isNullable()), - instance: yup.lazy(() => yup.string().default(undefined).isNullable()), - status: yup.lazy(() => yup.number().default(undefined).isNullable()), - title: yup.lazy(() => yup.string().default(undefined).isNullable()), - type: yup.lazy(() => yup.string().default(undefined).isNullable()) + }).default(undefined)) }).noUnknown() ); - ProblemDetails.validate = async function(value) { - return ProblemDetails.schema.validate(value, { strict: true }); + ModelWithDictionary.validate = async function(value) { + return ModelWithDictionary.schema.validate(value, { strict: true }); }; - ProblemDetails.validateSync = function(value) { - return ProblemDetails.schema.validateSync(value, { strict: true }); + ModelWithDictionary.validateSync = function(value) { + return ModelWithDictionary.schema.validateSync(value, { strict: true }); }; -})(ProblemDetails || (ProblemDetails = {}));" +})(ModelWithDictionary || (ModelWithDictionary = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/SamlParameters.js): ./test/result/v3/javascript/models/SamlParameters.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithDuplicateImports.js): ./test/result/v3/javascript/models/ModelWithDuplicateImports.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ +import { ModelWithString } from '../models/ModelWithString'; import * as yup from 'yup'; -export let SamlParameters; -(function (SamlParameters) { +/** + * This is a model with duplicated imports + */ +export let ModelWithDuplicateImports; +(function (ModelWithDuplicateImports) { - SamlParameters.schema = ( + ModelWithDuplicateImports.schema = ( yup.object().shape({ - certificates: yup.lazy(() => yup.array().of(yup.string()).default(undefined).isNullable()).isRequired(), - fullNameClaim: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - issuerName: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - separator: yup.lazy(() => yup.string().default(undefined).isNullable()), - serviceProviderName: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - singleLogoutServiceUrl: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - singleSignOnServiceUrl: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - usernameClaim: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired() + propA: yup.lazy(() => ModelWithString.schema.default(undefined)), + propB: yup.lazy(() => ModelWithString.schema.default(undefined)), + propC: yup.lazy(() => ModelWithString.schema.default(undefined)) }).noUnknown() ); - SamlParameters.validate = async function(value) { - return SamlParameters.schema.validate(value, { strict: true }); + ModelWithDuplicateImports.validate = async function(value) { + return ModelWithDuplicateImports.schema.validate(value, { strict: true }); }; - SamlParameters.validateSync = function(value) { - return SamlParameters.schema.validateSync(value, { strict: true }); + ModelWithDuplicateImports.validateSync = function(value) { + return ModelWithDuplicateImports.schema.validateSync(value, { strict: true }); }; -})(SamlParameters || (SamlParameters = {}));" +})(ModelWithDuplicateImports || (ModelWithDuplicateImports = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/ServiceAccount.js): ./test/result/v3/javascript/models/ServiceAccount.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithDuplicateProperties.js): ./test/result/v3/javascript/models/ModelWithDuplicateProperties.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ -import { ServiceAccountBasedAccessControlEntry } from '../models/ServiceAccountBasedAccessControlEntry'; -import { UserClientSecret } from '../models/UserClientSecret'; +import { ModelWithString } from '../models/ModelWithString'; import * as yup from 'yup'; -export let ServiceAccount; -(function (ServiceAccount) { +/** + * This is a model with duplicated properties + */ +export let ModelWithDuplicateProperties; +(function (ModelWithDuplicateProperties) { - ServiceAccount.schema = ( + ModelWithDuplicateProperties.schema = ( yup.object().shape({ - accessControlEntry: yup.lazy(() => ServiceAccountBasedAccessControlEntry.schema.default(undefined)), - clientId: yup.lazy(() => yup.string().default(undefined).isNullable()), - clientSecrets: yup.lazy(() => yup.array().of(UserClientSecret.schema).default(undefined).isNullable()), - createdAt: yup.lazy(() => yup.string().default(undefined)), - createdBy: yup.lazy(() => yup.number().default(undefined).isNullable()), - id: yup.lazy(() => yup.number().default(undefined)), - lastLoginAt: yup.lazy(() => yup.string().default(undefined).isNullable()), - modifiedAt: yup.lazy(() => yup.string().default(undefined)), - modifiedBy: yup.lazy(() => yup.number().default(undefined).isNullable()), - name: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired() + prop: yup.lazy(() => ModelWithString.schema.default(undefined)) }).noUnknown() ); - ServiceAccount.validate = async function(value) { - return ServiceAccount.schema.validate(value, { strict: true }); + ModelWithDuplicateProperties.validate = async function(value) { + return ModelWithDuplicateProperties.schema.validate(value, { strict: true }); }; - ServiceAccount.validateSync = function(value) { - return ServiceAccount.schema.validateSync(value, { strict: true }); + ModelWithDuplicateProperties.validateSync = function(value) { + return ModelWithDuplicateProperties.schema.validateSync(value, { strict: true }); }; -})(ServiceAccount || (ServiceAccount = {}));" +})(ModelWithDuplicateProperties || (ModelWithDuplicateProperties = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/ServiceAccountBasedAccessControlEntry.js): ./test/result/v3/javascript/models/ServiceAccountBasedAccessControlEntry.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithEnum.js): ./test/result/v3/javascript/models/ModelWithEnum.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ -import { ApiResourceLink } from '../models/ApiResourceLink'; -import { ApiResourceRoleLink } from '../models/ApiResourceRoleLink'; import * as yup from 'yup'; -export let ServiceAccountBasedAccessControlEntry; -(function (ServiceAccountBasedAccessControlEntry) { +/** + * This is a model with one enum + */ +export let ModelWithEnum; +(function (ModelWithEnum) { - ServiceAccountBasedAccessControlEntry.schema = ( + /** + * This is a simple enum with strings + */ + ModelWithEnum.Test = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error' + }; + + ModelWithEnum.schema = ( yup.object().shape({ - apiResourceRoles: yup.lazy(() => yup.array().of(ApiResourceRoleLink.schema).default(undefined).isNullable()), - apiResources: yup.lazy(() => yup.array().of(ApiResourceLink.schema).default(undefined).isNullable()) + Test: yup.lazy(() => yup.mixed().oneOf([ + Test.SUCCESS, + Test.WARNING, + Test.ERROR + ]).default(undefined)) }).noUnknown() ); - ServiceAccountBasedAccessControlEntry.validate = async function(value) { - return ServiceAccountBasedAccessControlEntry.schema.validate(value, { strict: true }); + ModelWithEnum.validate = async function(value) { + return ModelWithEnum.schema.validate(value, { strict: true }); }; - ServiceAccountBasedAccessControlEntry.validateSync = function(value) { - return ServiceAccountBasedAccessControlEntry.schema.validateSync(value, { strict: true }); + ModelWithEnum.validateSync = function(value) { + return ModelWithEnum.schema.validateSync(value, { strict: true }); }; -})(ServiceAccountBasedAccessControlEntry || (ServiceAccountBasedAccessControlEntry = {}));" +})(ModelWithEnum || (ModelWithEnum = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/User.js): ./test/result/v3/javascript/models/User.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithEnumFromDescription.js): ./test/result/v3/javascript/models/ModelWithEnumFromDescription.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ -import { UserBasedAccessControlEntry } from '../models/UserBasedAccessControlEntry'; -import { UserClientSecret } from '../models/UserClientSecret'; import * as yup from 'yup'; -export let User; -(function (User) { +/** + * This is a model with one enum + */ +export let ModelWithEnumFromDescription; +(function (ModelWithEnumFromDescription) { - User.schema = ( + /** + * Success=1,Warning=2,Error=3 + */ + ModelWithEnumFromDescription.Test = { + SUCCESS: 1, + WARNING: 2, + ERROR: 3 + }; + + ModelWithEnumFromDescription.schema = ( yup.object().shape({ - accessControlEntry: yup.lazy(() => UserBasedAccessControlEntry.schema.default(undefined)), - clientId: yup.lazy(() => yup.string().default(undefined).isNullable()), - clientSecrets: yup.lazy(() => yup.array().of(UserClientSecret.schema).default(undefined).isNullable()), - createdAt: yup.lazy(() => yup.string().default(undefined)), - createdBy: yup.lazy(() => yup.number().default(undefined).isNullable()), - email: yup.lazy(() => yup.string().default(undefined).isNullable()), - id: yup.lazy(() => yup.number().default(undefined)), - identityProviderId: yup.lazy(() => yup.number().default(undefined)).isRequired(), - identityProviderKey: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - lastLoginAt: yup.lazy(() => yup.string().default(undefined).isNullable()), - modifiedAt: yup.lazy(() => yup.string().default(undefined)), - modifiedBy: yup.lazy(() => yup.number().default(undefined).isNullable()), - name: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - subject: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired() + Test: yup.lazy(() => yup.mixed().oneOf([ + Test.SUCCESS, + Test.WARNING, + Test.ERROR + ]).default(undefined)) }).noUnknown() ); - User.validate = async function(value) { - return User.schema.validate(value, { strict: true }); + ModelWithEnumFromDescription.validate = async function(value) { + return ModelWithEnumFromDescription.schema.validate(value, { strict: true }); }; - User.validateSync = function(value) { - return User.schema.validateSync(value, { strict: true }); + ModelWithEnumFromDescription.validateSync = function(value) { + return ModelWithEnumFromDescription.schema.validateSync(value, { strict: true }); }; -})(User || (User = {}));" +})(ModelWithEnumFromDescription || (ModelWithEnumFromDescription = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/UserBasedAccessControlEntry.js): ./test/result/v3/javascript/models/UserBasedAccessControlEntry.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithInteger.js): ./test/result/v3/javascript/models/ModelWithInteger.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ -import { ApiResourceLink } from '../models/ApiResourceLink'; -import { ApiResourceRoleLink } from '../models/ApiResourceRoleLink'; -import { ApplicationLink } from '../models/ApplicationLink'; import * as yup from 'yup'; -export let UserBasedAccessControlEntry; -(function (UserBasedAccessControlEntry) { +/** + * This is a model with one number property + */ +export let ModelWithInteger; +(function (ModelWithInteger) { - UserBasedAccessControlEntry.schema = ( + ModelWithInteger.schema = ( yup.object().shape({ - apiResourceRoles: yup.lazy(() => yup.array().of(ApiResourceRoleLink.schema).default(undefined).isNullable()), - apiResources: yup.lazy(() => yup.array().of(ApiResourceLink.schema).default(undefined).isNullable()), - applications: yup.lazy(() => yup.array().of(ApplicationLink.schema).default(undefined).isNullable()) + prop: yup.lazy(() => yup.number().default(undefined)) }).noUnknown() ); - UserBasedAccessControlEntry.validate = async function(value) { - return UserBasedAccessControlEntry.schema.validate(value, { strict: true }); + ModelWithInteger.validate = async function(value) { + return ModelWithInteger.schema.validate(value, { strict: true }); }; - UserBasedAccessControlEntry.validateSync = function(value) { - return UserBasedAccessControlEntry.schema.validateSync(value, { strict: true }); + ModelWithInteger.validateSync = function(value) { + return ModelWithInteger.schema.validateSync(value, { strict: true }); }; -})(UserBasedAccessControlEntry || (UserBasedAccessControlEntry = {}));" +})(ModelWithInteger || (ModelWithInteger = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/UserClientSecret.js): ./test/result/v3/javascript/models/UserClientSecret.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithLink.js): ./test/result/v3/javascript/models/ModelWithLink.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ +import { ModelLink } from '../models/ModelLink'; +import { ModelWithString } from '../models/ModelWithString'; import * as yup from 'yup'; -export let UserClientSecret; -(function (UserClientSecret) { +/** + * This is a model that can have a template?? + */ +export let ModelWithLink; +(function (ModelWithLink) { - UserClientSecret.schema = ( + ModelWithLink.schema = ( yup.object().shape({ - clientSecret: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - clientSecretUnHashed: yup.lazy(() => yup.string().default(undefined).isNullable()), - expiresAt: yup.lazy(() => yup.string().default(undefined)).isRequired(), - id: yup.lazy(() => yup.number().default(undefined)), - lastLoginAt: yup.lazy(() => yup.string().default(undefined).isNullable()) + prop: yup.lazy(() => ModelLink.schema.default(undefined)) }).noUnknown() ); - UserClientSecret.validate = async function(value) { - return UserClientSecret.schema.validate(value, { strict: true }); + ModelWithLink.validate = async function(value) { + return ModelWithLink.schema.validate(value, { strict: true }); }; - UserClientSecret.validateSync = function(value) { - return UserClientSecret.schema.validateSync(value, { strict: true }); + ModelWithLink.validateSync = function(value) { + return ModelWithLink.schema.validateSync(value, { strict: true }); }; -})(UserClientSecret || (UserClientSecret = {}));" +})(ModelWithLink || (ModelWithLink = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/models/WindowsParameters.js): ./test/result/v3/javascript/models/WindowsParameters.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithNestedProperties.js): ./test/result/v3/javascript/models/ModelWithNestedProperties.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ import * as yup from 'yup'; -export let WindowsParameters; -(function (WindowsParameters) { +/** + * This is a model with one nested property + */ +export let ModelWithNestedProperties; +(function (ModelWithNestedProperties) { - WindowsParameters.schema = ( - yup.object() + ModelWithNestedProperties.schema = ( + yup.object().shape({ + first: yup.lazy(() => ( + yup.object().shape({ + second: yup.lazy(() => ( + yup.object().shape({ + third: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired() + }).noUnknown() + ).default(undefined).isNullable()).isRequired() + }).noUnknown() + ).default(undefined).isNullable()).isRequired() + }).noUnknown() ); - WindowsParameters.validate = async function(value) { - return WindowsParameters.schema.validate(value, { strict: true }); + ModelWithNestedProperties.validate = async function(value) { + return ModelWithNestedProperties.schema.validate(value, { strict: true }); }; - WindowsParameters.validateSync = function(value) { - return WindowsParameters.schema.validateSync(value, { strict: true }); + ModelWithNestedProperties.validateSync = function(value) { + return ModelWithNestedProperties.schema.validateSync(value, { strict: true }); }; -})(WindowsParameters || (WindowsParameters = {}));" +})(ModelWithNestedProperties || (ModelWithNestedProperties = {}));" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/services/ApiResourcesService.js): ./test/result/v3/javascript/services/ApiResourcesService.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithProperties.js): ./test/result/v3/javascript/models/ModelWithProperties.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model with one nested property + */ +export let ModelWithProperties; +(function (ModelWithProperties) { + + ModelWithProperties.schema = ( + yup.object().shape({ + boolean: yup.lazy(() => yup.boolean().default(undefined)), + number: yup.lazy(() => yup.number().default(undefined)), + reference: yup.lazy(() => ModelWithString.schema.default(undefined)), + required: yup.lazy(() => yup.string().default(undefined)).isRequired(), + requiredAndNullable: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), + requiredAndReadOnly: yup.lazy(() => yup.string().default(undefined)).isRequired(), + string: yup.lazy(() => yup.string().default(undefined)) + }).noUnknown() + ); + + ModelWithProperties.validate = async function(value) { + return ModelWithProperties.schema.validate(value, { strict: true }); + }; + + ModelWithProperties.validateSync = function(value) { + return ModelWithProperties.schema.validateSync(value, { strict: true }); + }; + +})(ModelWithProperties || (ModelWithProperties = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithReference.js): ./test/result/v3/javascript/models/ModelWithReference.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model with one property containing a reference + */ +export let ModelWithReference; +(function (ModelWithReference) { + + ModelWithReference.schema = ( + yup.object().shape({ + prop: yup.lazy(() => ModelWithString.schema.default(undefined)) + }).noUnknown() + ); + + ModelWithReference.validate = async function(value) { + return ModelWithReference.schema.validate(value, { strict: true }); + }; + + ModelWithReference.validateSync = function(value) { + return ModelWithReference.schema.validateSync(value, { strict: true }); + }; + +})(ModelWithReference || (ModelWithReference = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithString.js): ./test/result/v3/javascript/models/ModelWithString.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a model with one string property + */ +export let ModelWithString; +(function (ModelWithString) { + + ModelWithString.schema = ( + yup.object().shape({ + prop: yup.lazy(() => yup.string().default(undefined)) + }).noUnknown() + ); + + ModelWithString.validate = async function(value) { + return ModelWithString.schema.validate(value, { strict: true }); + }; + + ModelWithString.validateSync = function(value) { + return ModelWithString.schema.validateSync(value, { strict: true }); + }; + +})(ModelWithString || (ModelWithString = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/SimpleBoolean.js): ./test/result/v3/javascript/models/SimpleBoolean.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple boolean + */ +export let SimpleBoolean; +(function (SimpleBoolean) { + + SimpleBoolean.schema = yup.boolean(); + + SimpleBoolean.validate = async function(value) { + return SimpleBoolean.schema.validate(value, { strict: true }); + }; + + SimpleBoolean.validateSync = function(value) { + return SimpleBoolean.schema.validateSync(value, { strict: true }); + }; + +})(SimpleBoolean || (SimpleBoolean = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/SimpleFile.js): ./test/result/v3/javascript/models/SimpleFile.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple file + */ +export let SimpleFile; +(function (SimpleFile) { + + SimpleFile.schema = yup.mixed(); + + SimpleFile.validate = async function(value) { + return SimpleFile.schema.validate(value, { strict: true }); + }; + + SimpleFile.validateSync = function(value) { + return SimpleFile.schema.validateSync(value, { strict: true }); + }; + +})(SimpleFile || (SimpleFile = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/SimpleInteger.js): ./test/result/v3/javascript/models/SimpleInteger.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple number + */ +export let SimpleInteger; +(function (SimpleInteger) { + + SimpleInteger.schema = yup.number(); + + SimpleInteger.validate = async function(value) { + return SimpleInteger.schema.validate(value, { strict: true }); + }; + + SimpleInteger.validateSync = function(value) { + return SimpleInteger.schema.validateSync(value, { strict: true }); + }; + +})(SimpleInteger || (SimpleInteger = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/SimpleReference.js): ./test/result/v3/javascript/models/SimpleReference.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a simple reference + */ +export let SimpleReference; +(function (SimpleReference) { + + SimpleReference.schema = ModelWithString.schema; + + SimpleReference.validate = async function(value) { + return SimpleReference.schema.validate(value, { strict: true }); + }; + + SimpleReference.validateSync = function(value) { + return SimpleReference.schema.validateSync(value, { strict: true }); + }; + +})(SimpleReference || (SimpleReference = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/models/SimpleString.js): ./test/result/v3/javascript/models/SimpleString.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple string + */ +export let SimpleString; +(function (SimpleString) { + + SimpleString.schema = yup.string(); + + SimpleString.validate = async function(value) { + return SimpleString.schema.validate(value, { strict: true }); + }; + + SimpleString.validateSync = function(value) { + return SimpleString.schema.validateSync(value, { strict: true }); + }; + +})(SimpleString || (SimpleString = {}));" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/services/ComplexService.js): ./test/result/v3/javascript/services/ComplexService.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ @@ -5123,660 +5588,32 @@ import { ApiError, catchGenericError } from '../core/ApiError'; import { request } from '../core/request'; import { OpenAPI } from '../core/OpenAPI'; -export class ApiResourcesService { +export class ComplexService { /** - * @result any Success + * @param parameterObject Parameter containing object + * @param parameterReference Parameter containing reference + * @result any Successful response * @throws ApiError */ - static async get() { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/ApiResources\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - static async get1( - id + static async complexTypes( + parameterObject, + parameterReference ) { const result = await request({ method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/ApiResources/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param name - * @result any Success - * @throws ApiError - */ - static async getByName( - name - ) { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/ApiResources/getByName/\${name}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - -}" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/services/ApplicationsService.js): ./test/result/v3/javascript/services/ApplicationsService.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiError, catchGenericError } from '../core/ApiError'; -import { request } from '../core/request'; -import { OpenAPI } from '../core/OpenAPI'; - -export class ApplicationsService { - - /** - * @param id - * @result any Success - * @throws ApiError - */ - static async get( - id - ) { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Applications/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @result any Success - * @throws ApiError - */ - static async get1() { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Applications\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param clientId - * @result any Success - * @throws ApiError - */ - static async getByClientId( - clientId - ) { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Applications/getByClientId/\${clientId}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param name - * @result any Success - * @throws ApiError - */ - static async getByName( - name - ) { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Applications/getByName/\${name}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - static async update( - id - ) { - - const result = await request({ - method: 'put', - path: \`/api/v\${OpenAPI.VERSION}/Applications/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - -}" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/services/ClaimsService.js): ./test/result/v3/javascript/services/ClaimsService.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiError, catchGenericError } from '../core/ApiError'; -import { request } from '../core/request'; -import { OpenAPI } from '../core/OpenAPI'; - -export class ClaimsService { - - /** - * @result any Success - * @throws ApiError - */ - static async get() { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Claims\` - }); - - catchGenericError(result); - - return result.body; - } - -}" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/services/IdentityProvidersService.js): ./test/result/v3/javascript/services/IdentityProvidersService.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiError, catchGenericError } from '../core/ApiError'; -import { request } from '../core/request'; -import { OpenAPI } from '../core/OpenAPI'; - -export class IdentityProvidersService { - - /** - * @result any Success - * @throws ApiError - */ - static async create() { - - const result = await request({ - method: 'post', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - static async delete( - id - ) { - - const result = await request({ - method: 'delete', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @result any Success - * @throws ApiError - */ - static async get() { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - static async get1( - id - ) { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param name - * @result any Success - * @throws ApiError - */ - static async getIcon( - name - ) { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/icon/\${name}\` - }); - - if (!result.ok) { - switch (result.status) { - case 416: throw new ApiError(result, \`Client Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @result any Success - * @throws ApiError - */ - static async getLoginOptions() { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/loginOptions\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param providerType - * @result any Success - * @throws ApiError - */ - static async getParametersForIdentityProviderType( - providerType - ) { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/getParametersForIdentityProviderType/\${providerType}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - static async update( - id - ) { - - const result = await request({ - method: 'put', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - -}" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/services/ServiceAccountsService.js): ./test/result/v3/javascript/services/ServiceAccountsService.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiError, catchGenericError } from '../core/ApiError'; -import { request } from '../core/request'; -import { OpenAPI } from '../core/OpenAPI'; - -export class ServiceAccountsService { - - /** - * @param serviceAccountId - * @param secretId - * @result any Success - * @throws ApiError - */ - static async deleteClientSecret( - serviceAccountId, - secretId - ) { - - const result = await request({ - method: 'delete', - path: \`/api/v\${OpenAPI.VERSION}/ServiceAccounts/\${serviceAccountId}/clientSecrets/\${secretId}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param serviceAccountId - * @result any Success - * @throws ApiError - */ - static async generateClientSecret( - serviceAccountId - ) { - - const result = await request({ - method: 'post', - path: \`/api/v\${OpenAPI.VERSION}/ServiceAccounts/\${serviceAccountId}/generateClientSecret\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @result any Success - * @throws ApiError - */ - static async get() { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/ServiceAccounts\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - static async get1( - id - ) { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/ServiceAccounts/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param secretId - * @param serviceAccountId - * @result any Success - * @throws ApiError - */ - static async updateClientSecret( - secretId, - serviceAccountId - ) { - - const result = await request({ - method: 'put', - path: \`/api/v\${OpenAPI.VERSION}/ServiceAccounts/\${serviceAccountId}/clientSecrets/\${secretId}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - -}" -`; - -exports[`generation v3 javascript file(./test/result/v3/javascript/services/SuggestionsService.js): ./test/result/v3/javascript/services/SuggestionsService.js 1`] = ` -"/* istanbul ignore file */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiError, catchGenericError } from '../core/ApiError'; -import { request } from '../core/request'; -import { OpenAPI } from '../core/OpenAPI'; - -export class SuggestionsService { - - /** - * @param searchText - * @result any Success - * @throws ApiError - */ - static async getClaimTypes( - searchText - ) { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Suggestions/claimTypes\`, + path: \`/api/v\${OpenAPI.VERSION}/complex\`, query: { - 'searchText': searchText + 'parameterObject': parameterObject, + 'parameterReference': parameterReference } }); if (!result.ok) { switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); + case 400: throw new ApiError(result, \`400 server error\`); + case 500: throw new ApiError(result, \`500 server error\`); } } @@ -5788,7 +5625,7 @@ export class SuggestionsService { }" `; -exports[`generation v3 javascript file(./test/result/v3/javascript/services/UsersService.js): ./test/result/v3/javascript/services/UsersService.js 1`] = ` +exports[`generation v3 javascript file(./test/result/v3/javascript/services/ParametersService.js): ./test/result/v3/javascript/services/ParametersService.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ /* prettier-ignore */ @@ -5797,23 +5634,64 @@ import { ApiError, catchGenericError } from '../core/ApiError'; import { request } from '../core/request'; import { OpenAPI } from '../core/OpenAPI'; -export class UsersService { +export class ParametersService { /** - * @result any Success + * @param parameterHeader This is the parameter that goes into the request header + * @param parameterQuery This is the parameter that goes into the request query params * @throws ApiError */ - static async create() { + static async callWithParameters( + parameterHeader, + parameterQuery + ) { + + const result = await request({ + method: 'get', + path: \`/api/v\${OpenAPI.VERSION}/parameters\`, + headers: { + 'parameterHeader': parameterHeader + }, + query: { + 'parameterQuery': parameterQuery + } + }); + + catchGenericError(result); + + return result.body; + } + +}" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/services/ResponseService.js): ./test/result/v3/javascript/services/ResponseService.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ApiError, catchGenericError } from '../core/ApiError'; +import { request } from '../core/request'; +import { OpenAPI } from '../core/OpenAPI'; + +export class ResponseService { + + /** + * @result any Message for default response + * @throws ApiError + */ + static async callWithDuplicateResponses() { const result = await request({ method: 'post', - path: \`/api/v\${OpenAPI.VERSION}/Users\` + path: \`/api/v\${OpenAPI.VERSION}/response\` }); if (!result.ok) { switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); + case 500: throw new ApiError(result, \`Message for 500 error\`); + case 501: throw new ApiError(result, \`Message for 501 error\`); + case 502: throw new ApiError(result, \`Message for 502 error\`); } } @@ -5823,189 +5701,212 @@ export class UsersService { } /** - * @param id - * @result any Success + * @result any Message for default response * @throws ApiError */ - static async delete( - id - ) { + static async callWithResponse() { + + const result = await request({ + method: 'get', + path: \`/api/v\${OpenAPI.VERSION}/response\` + }); + + catchGenericError(result); + + return result.body; + } + + /** + * @result any Message for default response + * @throws ApiError + */ + static async callWithResponses() { + + const result = await request({ + method: 'put', + path: \`/api/v\${OpenAPI.VERSION}/response\` + }); + + if (!result.ok) { + switch (result.status) { + case 500: throw new ApiError(result, \`Message for 500 error\`); + case 501: throw new ApiError(result, \`Message for 501 error\`); + case 502: throw new ApiError(result, \`Message for 502 error\`); + } + } + + catchGenericError(result); + + return result.body; + } + +}" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/services/SimpleService.js): ./test/result/v3/javascript/services/SimpleService.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ApiError, catchGenericError } from '../core/ApiError'; +import { request } from '../core/request'; +import { OpenAPI } from '../core/OpenAPI'; + +export class SimpleService { + + /** + * @throws ApiError + */ + static async deleteCallWithoutParametersAndResponse() { const result = await request({ method: 'delete', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${id}\` + path: \`/api/v\${OpenAPI.VERSION}/simple\` }); - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - catchGenericError(result); return result.body; } /** - * @param userId - * @param secretId - * @result any Success * @throws ApiError */ - static async deleteClientSecret( - userId, - secretId - ) { + static async getCallWithoutParametersAndResponse() { const result = await request({ - method: 'delete', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${userId}/clientSecrets/\${secretId}\` + method: 'get', + path: \`/api/v\${OpenAPI.VERSION}/simple\` }); - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - catchGenericError(result); return result.body; } /** - * @param userId - * @result any Success * @throws ApiError */ - static async generateClientSecret( - userId - ) { + static async headCallWithoutParametersAndResponse() { + + const result = await request({ + method: 'head', + path: \`/api/v\${OpenAPI.VERSION}/simple\` + }); + + catchGenericError(result); + + return result.body; + } + + /** + * @throws ApiError + */ + static async optionsCallWithoutParametersAndResponse() { + + const result = await request({ + method: 'options', + path: \`/api/v\${OpenAPI.VERSION}/simple\` + }); + + catchGenericError(result); + + return result.body; + } + + /** + * @throws ApiError + */ + static async patchCallWithoutParametersAndResponse() { + + const result = await request({ + method: 'patch', + path: \`/api/v\${OpenAPI.VERSION}/simple\` + }); + + catchGenericError(result); + + return result.body; + } + + /** + * @throws ApiError + */ + static async postCallWithoutParametersAndResponse() { const result = await request({ method: 'post', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${userId}/generateClientSecret\` + path: \`/api/v\${OpenAPI.VERSION}/simple\` }); - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - catchGenericError(result); return result.body; } /** - * @param id - * @result any Success * @throws ApiError */ - static async get( + static async putCallWithoutParametersAndResponse() { + + const result = await request({ + method: 'put', + path: \`/api/v\${OpenAPI.VERSION}/simple\` + }); + + catchGenericError(result); + + return result.body; + } + +}" +`; + +exports[`generation v3 javascript file(./test/result/v3/javascript/services/TypesService.js): ./test/result/v3/javascript/services/TypesService.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ApiError, catchGenericError } from '../core/ApiError'; +import { request } from '../core/request'; +import { OpenAPI } from '../core/OpenAPI'; + +export class TypesService { + + /** + * @param parameterNumber This is a number parameter + * @param parameterString This is a string parameter + * @param parameterBoolean This is a boolean parameter + * @param parameterObject This is an object parameter + * @param parameterArray This is an array parameter + * @param parameterDictionary This is a dictionary parameter + * @param id This is a number parameter + * @result any Response is a simple number + * @throws ApiError + */ + static async types( + parameterNumber, + parameterString, + parameterBoolean, + parameterObject, + parameterArray, + parameterDictionary, id ) { const result = await request({ method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); + path: \`/api/v\${OpenAPI.VERSION}/types\`, + query: { + 'parameterNumber': parameterNumber, + 'parameterString': parameterString, + 'parameterBoolean': parameterBoolean, + 'parameterObject': parameterObject, + 'parameterArray': parameterArray, + 'parameterDictionary': parameterDictionary } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @result any Success - * @throws ApiError - */ - static async get1() { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Users\` }); - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - static async update( - id - ) { - - const result = await request({ - method: 'put', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param secretId - * @param userId - * @result any Success - * @throws ApiError - */ - static async updateClientSecret( - secretId, - userId - ) { - - const result = await request({ - method: 'put', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${userId}/clientSecrets/\${secretId}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - catchGenericError(result); return result.body; @@ -6082,7 +5983,7 @@ exports[`generation v3 typescript file(./test/result/v3/typescript/core/OpenAPI. /* prettier-ignore */ export namespace OpenAPI { - export let BASE = '/access-manager'; + export let BASE = '/api'; export let VERSION = '1'; export let CLIENT = 'fetch'; export let TOKEN = ''; @@ -6424,80 +6325,81 @@ export { ApiError } from './core/ApiError'; export { isSuccess } from './core/isSuccess'; export { OpenAPI } from './core/OpenAPI'; -export { ApiResource } from './models/ApiResource'; -export { ApiResourceLink } from './models/ApiResourceLink'; -export { ApiResourceRole } from './models/ApiResourceRole'; -export { ApiResourceRoleLink } from './models/ApiResourceRoleLink'; -export { Application } from './models/Application'; -export { ApplicationLink } from './models/ApplicationLink'; -export { ClaimBasedAccessControlEntry } from './models/ClaimBasedAccessControlEntry'; +export { ArrayWithArray } from './models/ArrayWithArray'; +export { ArrayWithBooleans } from './models/ArrayWithBooleans'; +export { ArrayWithNumbers } from './models/ArrayWithNumbers'; +export { ArrayWithProperties } from './models/ArrayWithProperties'; +export { ArrayWithReferences } from './models/ArrayWithReferences'; +export { ArrayWithStrings } from './models/ArrayWithStrings'; export { Dictionary } from './models/Dictionary'; -export { ErrorMessage } from './models/ErrorMessage'; -export { ErrorResponse } from './models/ErrorResponse'; -export { IdentityProvider } from './models/IdentityProvider'; -export { IdentityProviderParameters } from './models/IdentityProviderParameters'; -export { IdentityProviderType } from './models/IdentityProviderType'; -export { IInnerError } from './models/IInnerError'; -export { LdapParameters } from './models/LdapParameters'; -export { LoginOption } from './models/LoginOption'; -export { OpenIdParameters } from './models/OpenIdParameters'; -export { ProblemDetails } from './models/ProblemDetails'; -export { SamlParameters } from './models/SamlParameters'; -export { ServiceAccount } from './models/ServiceAccount'; -export { ServiceAccountBasedAccessControlEntry } from './models/ServiceAccountBasedAccessControlEntry'; -export { User } from './models/User'; -export { UserBasedAccessControlEntry } from './models/UserBasedAccessControlEntry'; -export { UserClientSecret } from './models/UserClientSecret'; -export { WindowsParameters } from './models/WindowsParameters'; +export { DictionaryWithArray } from './models/DictionaryWithArray'; +export { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; +export { DictionaryWithProperties } from './models/DictionaryWithProperties'; +export { DictionaryWithReference } from './models/DictionaryWithReference'; +export { DictionaryWithString } from './models/DictionaryWithString'; +export { EnumFromDescription } from './models/EnumFromDescription'; +export { EnumWithNumbers } from './models/EnumWithNumbers'; +export { EnumWithStrings } from './models/EnumWithStrings'; +export { ModelLink } from './models/ModelLink'; +export { ModelThatExtends } from './models/ModelThatExtends'; +export { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; +export { ModelWithArray } from './models/ModelWithArray'; +export { ModelWithBoolean } from './models/ModelWithBoolean'; +export { ModelWithCircularReference } from './models/ModelWithCircularReference'; +export { ModelWithDictionary } from './models/ModelWithDictionary'; +export { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; +export { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; +export { ModelWithEnum } from './models/ModelWithEnum'; +export { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; +export { ModelWithInteger } from './models/ModelWithInteger'; +export { ModelWithLink } from './models/ModelWithLink'; +export { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; +export { ModelWithProperties } from './models/ModelWithProperties'; +export { ModelWithReference } from './models/ModelWithReference'; +export { ModelWithString } from './models/ModelWithString'; +export { SimpleBoolean } from './models/SimpleBoolean'; +export { SimpleFile } from './models/SimpleFile'; +export { SimpleInteger } from './models/SimpleInteger'; +export { SimpleReference } from './models/SimpleReference'; +export { SimpleString } from './models/SimpleString'; -export { ApiResourcesService } from './services/ApiResourcesService'; -export { ApplicationsService } from './services/ApplicationsService'; -export { ClaimsService } from './services/ClaimsService'; -export { IdentityProvidersService } from './services/IdentityProvidersService'; -export { ServiceAccountsService } from './services/ServiceAccountsService'; -export { SuggestionsService } from './services/SuggestionsService'; -export { UsersService } from './services/UsersService'; +export { ComplexService } from './services/ComplexService'; +export { ParametersService } from './services/ParametersService'; +export { ResponseService } from './services/ResponseService'; +export { SimpleService } from './services/SimpleService'; +export { TypesService } from './services/TypesService'; " `; -exports[`generation v3 typescript file(./test/result/v3/typescript/models/ApiResource.ts): ./test/result/v3/typescript/models/ApiResource.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ArrayWithArray.ts): ./test/result/v3/typescript/models/ArrayWithArray.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ /* prettier-ignore */ -import { ApiResourceRole } from '../models/ApiResourceRole'; +import { ModelWithString } from '../models/ModelWithString'; import * as yup from 'yup'; -export interface ApiResource { - id?: number; - key: string | null; - name: string | null; - roles?: Array | null; -} +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; -export namespace ApiResource { +export namespace ArrayWithArray { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - id: yup.lazy(() => yup.number().default(undefined)), - key: yup.lazy(() => yup.string().default(undefined).nullable().required()), - name: yup.lazy(() => yup.string().default(undefined).nullable().required()), - roles: yup.lazy(() => yup.array().of(ApiResourceRole.schema).default(undefined).nullable()) - }).noUnknown() - ); + export const schema = yup.array>().of(yup.array().of(ModelWithString.schema)); - export async function validate(value: any): Promise { + export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); } - export function validateSync(value: any): ApiResource { + export function validateSync(value: any): ArrayWithArray { return schema.validateSync(value, { strict: true }); } }" `; -exports[`generation v3 typescript file(./test/result/v3/typescript/models/ApiResourceLink.ts): ./test/result/v3/typescript/models/ApiResourceLink.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ArrayWithBooleans.ts): ./test/result/v3/typescript/models/ArrayWithBooleans.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6505,68 +6407,53 @@ exports[`generation v3 typescript file(./test/result/v3/typescript/models/ApiRes import * as yup from 'yup'; -export interface ApiResourceLink { - id?: number; - name?: string | null; -} +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array; -export namespace ApiResourceLink { +export namespace ArrayWithBooleans { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - id: yup.lazy(() => yup.number().default(undefined)), - name: yup.lazy(() => yup.string().default(undefined).nullable()) - }).noUnknown() - ); + export const schema = yup.array().of(yup.boolean()); - export async function validate(value: any): Promise { + export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); } - export function validateSync(value: any): ApiResourceLink { + export function validateSync(value: any): ArrayWithBooleans { return schema.validateSync(value, { strict: true }); } }" `; -exports[`generation v3 typescript file(./test/result/v3/typescript/models/ApiResourceRole.ts): ./test/result/v3/typescript/models/ApiResourceRole.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ArrayWithNumbers.ts): ./test/result/v3/typescript/models/ArrayWithNumbers.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ /* prettier-ignore */ -import { ApiResource } from '../models/ApiResource'; import * as yup from 'yup'; -export interface ApiResourceRole { - apiResource?: ApiResource; - id?: number; - key: string | null; - name: string | null; -} +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array; -export namespace ApiResourceRole { +export namespace ArrayWithNumbers { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - apiResource: yup.lazy(() => ApiResource.schema.default(undefined)), - id: yup.lazy(() => yup.number().default(undefined)), - key: yup.lazy(() => yup.string().default(undefined).nullable().required()), - name: yup.lazy(() => yup.string().default(undefined).nullable().required()) - }).noUnknown() - ); + export const schema = yup.array().of(yup.number()); - export async function validate(value: any): Promise { + export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); } - export function validateSync(value: any): ApiResourceRole { + export function validateSync(value: any): ArrayWithNumbers { return schema.validateSync(value, { strict: true }); } }" `; -exports[`generation v3 typescript file(./test/result/v3/typescript/models/ApiResourceRoleLink.ts): ./test/result/v3/typescript/models/ApiResourceRoleLink.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ArrayWithProperties.ts): ./test/result/v3/typescript/models/ArrayWithProperties.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6574,75 +6461,65 @@ exports[`generation v3 typescript file(./test/result/v3/typescript/models/ApiRes import * as yup from 'yup'; -export interface ApiResourceRoleLink { - id?: number; - name?: string | null; -} +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + foo?: string, + bar?: string +}>; -export namespace ApiResourceRoleLink { +export namespace ArrayWithProperties { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - id: yup.lazy(() => yup.number().default(undefined)), - name: yup.lazy(() => yup.string().default(undefined).nullable()) + export const schema = yup.array<{ + foo?: string, + bar?: string + }>().of(( + yup.object().shape({ + foo: yup.lazy(() => yup.string().default(undefined)), + bar: yup.lazy(() => yup.string().default(undefined)) }).noUnknown() - ); + )); - export async function validate(value: any): Promise { + export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); } - export function validateSync(value: any): ApiResourceRoleLink { + export function validateSync(value: any): ArrayWithProperties { return schema.validateSync(value, { strict: true }); } }" `; -exports[`generation v3 typescript file(./test/result/v3/typescript/models/Application.ts): ./test/result/v3/typescript/models/Application.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ArrayWithReferences.ts): ./test/result/v3/typescript/models/ArrayWithReferences.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ /* prettier-ignore */ +import { ModelWithString } from '../models/ModelWithString'; import * as yup from 'yup'; -export interface Application { - clientId?: string | null; - createdAt?: string; - createdBy?: number | null; - id?: number; - modifiedAt?: string; - modifiedBy?: number | null; - name: string | null; - redirectUrls: Array | null; -} +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; -export namespace Application { +export namespace ArrayWithReferences { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - clientId: yup.lazy(() => yup.string().default(undefined).nullable()), - createdAt: yup.lazy(() => yup.string().default(undefined)), - createdBy: yup.lazy(() => yup.number().default(undefined).nullable()), - id: yup.lazy(() => yup.number().default(undefined)), - modifiedAt: yup.lazy(() => yup.string().default(undefined)), - modifiedBy: yup.lazy(() => yup.number().default(undefined).nullable()), - name: yup.lazy(() => yup.string().default(undefined).nullable().required()), - redirectUrls: yup.lazy(() => yup.array().of(yup.string()).default(undefined).nullable().required()) - }).noUnknown() - ); + export const schema = yup.array().of(ModelWithString.schema); - export async function validate(value: any): Promise { + export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); } - export function validateSync(value: any): Application { + export function validateSync(value: any): ArrayWithReferences { return schema.validateSync(value, { strict: true }); } }" `; -exports[`generation v3 typescript file(./test/result/v3/typescript/models/ApplicationLink.ts): ./test/result/v3/typescript/models/ApplicationLink.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ArrayWithStrings.ts): ./test/result/v3/typescript/models/ArrayWithStrings.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -6650,66 +6527,20 @@ exports[`generation v3 typescript file(./test/result/v3/typescript/models/Applic import * as yup from 'yup'; -export interface ApplicationLink { - id?: number; - name?: string | null; -} +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array; -export namespace ApplicationLink { +export namespace ArrayWithStrings { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - id: yup.lazy(() => yup.number().default(undefined)), - name: yup.lazy(() => yup.string().default(undefined).nullable()) - }).noUnknown() - ); + export const schema = yup.array().of(yup.string()); - export async function validate(value: any): Promise { + export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); } - export function validateSync(value: any): ApplicationLink { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/ClaimBasedAccessControlEntry.ts): ./test/result/v3/typescript/models/ClaimBasedAccessControlEntry.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiResourceLink } from '../models/ApiResourceLink'; -import { ApiResourceRoleLink } from '../models/ApiResourceRoleLink'; -import { ApplicationLink } from '../models/ApplicationLink'; -import * as yup from 'yup'; - -export interface ClaimBasedAccessControlEntry { - apiResourceRoles?: Array | null; - apiResources?: Array | null; - applications?: Array | null; - claimType?: string | null; - claimValue?: string | null; -} - -export namespace ClaimBasedAccessControlEntry { - - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - apiResourceRoles: yup.lazy(() => yup.array().of(ApiResourceRoleLink.schema).default(undefined).nullable()), - apiResources: yup.lazy(() => yup.array().of(ApiResourceLink.schema).default(undefined).nullable()), - applications: yup.lazy(() => yup.array().of(ApplicationLink.schema).default(undefined).nullable()), - claimType: yup.lazy(() => yup.string().default(undefined).nullable()), - claimValue: yup.lazy(() => yup.string().default(undefined).nullable()) - }).noUnknown() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): ClaimBasedAccessControlEntry { + export function validateSync(value: any): ArrayWithStrings { return schema.validateSync(value, { strict: true }); } }" @@ -6727,373 +6558,43 @@ export interface Dictionary { " `; -exports[`generation v3 typescript file(./test/result/v3/typescript/models/ErrorMessage.ts): ./test/result/v3/typescript/models/ErrorMessage.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/DictionaryWithArray.ts): ./test/result/v3/typescript/models/DictionaryWithArray.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ /* prettier-ignore */ -import { IInnerError } from '../models/IInnerError'; +import { Dictionary } from '../models/Dictionary'; +import { ModelWithString } from '../models/ModelWithString'; import * as yup from 'yup'; -export interface ErrorMessage { - code?: string | null; - details?: Array | null; - innerError?: IInnerError; - innerException?: ErrorMessage; - localizedMessage?: string | null; - message?: string | null; - stackTrace?: string | null; - target?: string | null; -} +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = Dictionary>; -export namespace ErrorMessage { +export namespace DictionaryWithArray { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - code: yup.lazy(() => yup.string().default(undefined).nullable()), - details: yup.lazy(() => yup.array().of(ErrorMessage.schema).default(undefined).nullable()), - innerError: yup.lazy(() => IInnerError.schema.default(undefined)), - innerException: yup.lazy(() => ErrorMessage.schema.default(undefined)), - localizedMessage: yup.lazy(() => yup.string().default(undefined).nullable()), - message: yup.lazy(() => yup.string().default(undefined).nullable()), - stackTrace: yup.lazy(() => yup.string().default(undefined).nullable()), - target: yup.lazy(() => yup.string().default(undefined).nullable()) - }).noUnknown() - ); + export const schema = yup.lazy>>(value => { + return yup.object>>().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: yup.array().of(ModelWithString.schema) + }), {}) + ); + }); - export async function validate(value: any): Promise { + export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); } - export function validateSync(value: any): ErrorMessage { + export function validateSync(value: any): DictionaryWithArray { return schema.validateSync(value, { strict: true }); } }" `; -exports[`generation v3 typescript file(./test/result/v3/typescript/models/ErrorResponse.ts): ./test/result/v3/typescript/models/ErrorResponse.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ErrorMessage } from '../models/ErrorMessage'; -import * as yup from 'yup'; - -export interface ErrorResponse { - errorMessage?: ErrorMessage; -} - -export namespace ErrorResponse { - - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - errorMessage: yup.lazy(() => ErrorMessage.schema.default(undefined)) - }).noUnknown() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): ErrorResponse { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/IInnerError.ts): ./test/result/v3/typescript/models/IInnerError.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import * as yup from 'yup'; - -export interface IInnerError { - code?: string | null; - innerError?: IInnerError; -} - -export namespace IInnerError { - - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - code: yup.lazy(() => yup.string().default(undefined).nullable()), - innerError: yup.lazy(() => IInnerError.schema.default(undefined)) - }).noUnknown() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): IInnerError { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/IdentityProvider.ts): ./test/result/v3/typescript/models/IdentityProvider.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ClaimBasedAccessControlEntry } from '../models/ClaimBasedAccessControlEntry'; -import { IdentityProviderParameters } from '../models/IdentityProviderParameters'; -import { IdentityProviderType } from '../models/IdentityProviderType'; -import * as yup from 'yup'; - -export interface IdentityProvider { - accessControlList?: Array | null; - createdAt?: string; - createdBy?: number | null; - description?: string | null; - forwardedClaims?: Array | null; - iconUrl?: string | null; - iconViewUrl?: string | null; - id?: number; - isEnabled?: boolean; - key: string | null; - modifiedAt?: string; - modifiedBy?: number | null; - name: string | null; - parameters: IdentityProviderParameters; - postLogoutRedirectUrl?: string | null; - redirectUrl?: string | null; - type: IdentityProviderType; - validateUrl?: string | null; -} - -export namespace IdentityProvider { - - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - accessControlList: yup.lazy(() => yup.array().of(ClaimBasedAccessControlEntry.schema).default(undefined).nullable()), - createdAt: yup.lazy(() => yup.string().default(undefined)), - createdBy: yup.lazy(() => yup.number().default(undefined).nullable()), - description: yup.lazy(() => yup.string().default(undefined).nullable()), - forwardedClaims: yup.lazy(() => yup.array().of(yup.string()).default(undefined).nullable()), - iconUrl: yup.lazy(() => yup.string().default(undefined).nullable()), - iconViewUrl: yup.lazy(() => yup.string().default(undefined).nullable()), - id: yup.lazy(() => yup.number().default(undefined)), - isEnabled: yup.lazy(() => yup.boolean().default(undefined)), - key: yup.lazy(() => yup.string().default(undefined).nullable().required()), - modifiedAt: yup.lazy(() => yup.string().default(undefined)), - modifiedBy: yup.lazy(() => yup.number().default(undefined).nullable()), - name: yup.lazy(() => yup.string().default(undefined).nullable().required()), - parameters: yup.lazy(() => IdentityProviderParameters.schema.default(undefined).required()), - postLogoutRedirectUrl: yup.lazy(() => yup.string().default(undefined).nullable()), - redirectUrl: yup.lazy(() => yup.string().default(undefined).nullable()), - type: yup.lazy(() => IdentityProviderType.schema.default(undefined).required()), - validateUrl: yup.lazy(() => yup.string().default(undefined).nullable()) - }).noUnknown() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): IdentityProvider { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/IdentityProviderParameters.ts): ./test/result/v3/typescript/models/IdentityProviderParameters.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import * as yup from 'yup'; - -export interface IdentityProviderParameters { -} - -export namespace IdentityProviderParameters { - - export const schema: yup.ObjectSchema = ( - yup.object() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): IdentityProviderParameters { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/IdentityProviderType.ts): ./test/result/v3/typescript/models/IdentityProviderType.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import * as yup from 'yup'; - -export enum IdentityProviderType { - LDAP = 'LDAP', - OPEN_ID_CONNECT = 'OpenIdConnect', - SAML2P = 'SAML2P', - WINDOWS = 'Windows' -} - -export namespace IdentityProviderType { - - export const schema = yup.mixed().oneOf([ - IdentityProviderType.LDAP, - IdentityProviderType.OPEN_ID_CONNECT, - IdentityProviderType.SAML2P, - IdentityProviderType.WINDOWS - ]); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): IdentityProviderType { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/LdapParameters.ts): ./test/result/v3/typescript/models/LdapParameters.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import * as yup from 'yup'; - -export interface LdapParameters { - additionalAttributes?: string | null; - fullNameClaim: string | null; - groupBaseDn?: string | null; - groupMemberAttribute?: string | null; - port: number; - searchAccount: string | null; - searchAccountPassword: string | null; - separator?: string | null; - serverAddress: string | null; - userBaseDn: string | null; - usernameClaim: string | null; - useSsl: boolean; -} - -export namespace LdapParameters { - - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - additionalAttributes: yup.lazy(() => yup.string().default(undefined).nullable()), - fullNameClaim: yup.lazy(() => yup.string().default(undefined).nullable().required()), - groupBaseDn: yup.lazy(() => yup.string().default(undefined).nullable()), - groupMemberAttribute: yup.lazy(() => yup.string().default(undefined).nullable()), - port: yup.lazy(() => yup.number().default(undefined).required()), - searchAccount: yup.lazy(() => yup.string().default(undefined).nullable().required()), - searchAccountPassword: yup.lazy(() => yup.string().default(undefined).nullable().required()), - separator: yup.lazy(() => yup.string().default(undefined).nullable()), - serverAddress: yup.lazy(() => yup.string().default(undefined).nullable().required()), - userBaseDn: yup.lazy(() => yup.string().default(undefined).nullable().required()), - usernameClaim: yup.lazy(() => yup.string().default(undefined).nullable().required()), - useSsl: yup.lazy(() => yup.boolean().default(undefined).required()) - }).noUnknown() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): LdapParameters { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/LoginOption.ts): ./test/result/v3/typescript/models/LoginOption.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import * as yup from 'yup'; - -export interface LoginOption { - iconUrl?: string | null; - loginTriggerUrl?: string | null; - name: string | null; -} - -export namespace LoginOption { - - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - iconUrl: yup.lazy(() => yup.string().default(undefined).nullable()), - loginTriggerUrl: yup.lazy(() => yup.string().default(undefined).nullable()), - name: yup.lazy(() => yup.string().default(undefined).nullable().required()) - }).noUnknown() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): LoginOption { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/OpenIdParameters.ts): ./test/result/v3/typescript/models/OpenIdParameters.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import * as yup from 'yup'; - -export interface OpenIdParameters { - authority: string | null; - clientId: string | null; - clientSecret?: string | null; - endSessionEndpoint?: string | null; - fullNameClaim: string | null; - sendIdTokenHintDuringLogout?: boolean; - separator?: string | null; - usernameClaim: string | null; -} - -export namespace OpenIdParameters { - - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - authority: yup.lazy(() => yup.string().default(undefined).nullable().required()), - clientId: yup.lazy(() => yup.string().default(undefined).nullable().required()), - clientSecret: yup.lazy(() => yup.string().default(undefined).nullable()), - endSessionEndpoint: yup.lazy(() => yup.string().default(undefined).nullable()), - fullNameClaim: yup.lazy(() => yup.string().default(undefined).nullable().required()), - sendIdTokenHintDuringLogout: yup.lazy(() => yup.boolean().default(undefined)), - separator: yup.lazy(() => yup.string().default(undefined).nullable()), - usernameClaim: yup.lazy(() => yup.string().default(undefined).nullable().required()) - }).noUnknown() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): OpenIdParameters { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/ProblemDetails.ts): ./test/result/v3/typescript/models/ProblemDetails.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/DictionaryWithDictionary.ts): ./test/result/v3/typescript/models/DictionaryWithDictionary.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -7102,48 +6603,593 @@ exports[`generation v3 typescript file(./test/result/v3/typescript/models/Proble import { Dictionary } from '../models/Dictionary'; import * as yup from 'yup'; -export interface ProblemDetails { - detail?: string | null; - extensions?: Dictionary | null; - instance?: string | null; - status?: number | null; - title?: string | null; - type?: string | null; +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = Dictionary>; + +export namespace DictionaryWithDictionary { + + export const schema = yup.lazy>>(value => { + return yup.object>>().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: yup.lazy>(value => { + return yup.object>().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: yup.string() + }), {}) + ); + }) + }), {}) + ); + }); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): DictionaryWithDictionary { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/DictionaryWithProperties.ts): ./test/result/v3/typescript/models/DictionaryWithProperties.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { Dictionary } from '../models/Dictionary'; +import * as yup from 'yup'; + +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = Dictionary<{ + foo?: string, + bar?: string +}>; + +export namespace DictionaryWithProperties { + + export const schema = yup.lazy>(value => { + return yup.object>().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: ( + yup.object().shape({ + foo: yup.lazy(() => yup.string().default(undefined)), + bar: yup.lazy(() => yup.string().default(undefined)) + }).noUnknown() + ) + }), {}) + ); + }); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): DictionaryWithProperties { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/DictionaryWithReference.ts): ./test/result/v3/typescript/models/DictionaryWithReference.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { Dictionary } from '../models/Dictionary'; +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a string reference + */ +export type DictionaryWithReference = Dictionary; + +export namespace DictionaryWithReference { + + export const schema = yup.lazy>(value => { + return yup.object>().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: ModelWithString.schema + }), {}) + ); + }); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): DictionaryWithReference { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/DictionaryWithString.ts): ./test/result/v3/typescript/models/DictionaryWithString.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { Dictionary } from '../models/Dictionary'; +import * as yup from 'yup'; + +/** + * This is a string dictionary + */ +export type DictionaryWithString = Dictionary; + +export namespace DictionaryWithString { + + export const schema = yup.lazy>(value => { + return yup.object>().shape( + Object.entries(value).reduce((obj, item) => ({ + ...obj, + [item[0]]: yup.string() + }), {}) + ); + }); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): DictionaryWithString { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/EnumFromDescription.ts): ./test/result/v3/typescript/models/EnumFromDescription.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * Success=1,Warning=2,Error=3 + */ +export enum EnumFromDescription { + ERROR = 3, + SUCCESS = 1, + WARNING = 2 } -export namespace ProblemDetails { +export namespace EnumFromDescription { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - detail: yup.lazy(() => yup.string().default(undefined).nullable()), - extensions: yup.lazy(() => yup.lazy>(value => { - return yup.object>().shape( + export const schema = yup.mixed().oneOf([ + EnumFromDescription.ERROR, + EnumFromDescription.SUCCESS, + EnumFromDescription.WARNING + ]); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): EnumFromDescription { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/EnumWithNumbers.ts): ./test/result/v3/typescript/models/EnumWithNumbers.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple enum with numbers + */ +export enum EnumWithNumbers { + NUM_1 = 1, + NUM_2 = 2, + NUM_3 = 3 +} + +export namespace EnumWithNumbers { + + export const schema = yup.mixed().oneOf([ + EnumWithNumbers.NUM_1, + EnumWithNumbers.NUM_2, + EnumWithNumbers.NUM_3 + ]); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): EnumWithNumbers { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/EnumWithStrings.ts): ./test/result/v3/typescript/models/EnumWithStrings.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple enum with strings + */ +export enum EnumWithStrings { + ERROR = 'Error', + SUCCESS = 'Success', + WARNING = 'Warning' +} + +export namespace EnumWithStrings { + + export const schema = yup.mixed().oneOf([ + EnumWithStrings.ERROR, + EnumWithStrings.SUCCESS, + EnumWithStrings.WARNING + ]); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): EnumWithStrings { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelLink.ts): ./test/result/v3/typescript/models/ModelLink.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a model that can have a template?? + */ +export interface ModelLink { + id?: string; +} + +export namespace ModelLink { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + id: yup.lazy(() => yup.string().default(undefined)) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelLink { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelThatExtends.ts): ./test/result/v3/typescript/models/ModelThatExtends.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model that extends another model + */ +export interface ModelThatExtends extends ModelWithString { + propExtendsA?: string; + propExtendsB?: ModelWithString; +} + +export namespace ModelThatExtends { + + export const schema: yup.ObjectSchema = ( + ModelWithString.schema.concat( + yup.object().shape({ + propExtendsA: yup.lazy(() => yup.string().default(undefined)), + propExtendsB: yup.lazy(() => ModelWithString.schema.default(undefined)) + }).noUnknown() + ) + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelThatExtends { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelThatExtendsExtends.ts): ./test/result/v3/typescript/models/ModelThatExtendsExtends.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelThatExtends } from '../models/ModelThatExtends'; +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model that extends another model + */ +export interface ModelThatExtendsExtends extends ModelWithString, ModelThatExtends { + propExtendsC?: string; + propExtendsD?: ModelWithString; +} + +export namespace ModelThatExtendsExtends { + + export const schema: yup.ObjectSchema = ( + ModelWithString.schema.concat( + ModelThatExtends.schema.concat( + yup.object().shape({ + propExtendsC: yup.lazy(() => yup.string().default(undefined)), + propExtendsD: yup.lazy(() => ModelWithString.schema.default(undefined)) + }).noUnknown() + ) + ) + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelThatExtendsExtends { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithArray.ts): ./test/result/v3/typescript/models/ModelWithArray.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model with one property containing an array + */ +export interface ModelWithArray { + prop?: Array; +} + +export namespace ModelWithArray { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + prop: yup.lazy(() => yup.array().of(ModelWithString.schema).default(undefined)) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelWithArray { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithBoolean.ts): ./test/result/v3/typescript/models/ModelWithBoolean.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a model with one boolean property + */ +export interface ModelWithBoolean { + /** + * This is a simple boolean property + */ + prop?: boolean; +} + +export namespace ModelWithBoolean { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + prop: yup.lazy(() => yup.boolean().default(undefined)) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelWithBoolean { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithCircularReference.ts): ./test/result/v3/typescript/models/ModelWithCircularReference.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a model with one property containing a circular reference + */ +export interface ModelWithCircularReference { + prop?: ModelWithCircularReference; +} + +export namespace ModelWithCircularReference { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + prop: yup.lazy(() => ModelWithCircularReference.schema.default(undefined)) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelWithCircularReference { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithDictionary.ts): ./test/result/v3/typescript/models/ModelWithDictionary.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { Dictionary } from '../models/Dictionary'; +import * as yup from 'yup'; + +/** + * This is a model with one property containing a dictionary + */ +export interface ModelWithDictionary { + prop?: Dictionary; +} + +export namespace ModelWithDictionary { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + prop: yup.lazy(() => yup.lazy>(value => { + return yup.object>().shape( Object.entries(value).reduce((obj, item) => ({ ...obj, - [item[0]]: ( - yup.object() - ) + [item[0]]: yup.string() }), {}) ); - }).default(undefined).nullable()), - instance: yup.lazy(() => yup.string().default(undefined).nullable()), - status: yup.lazy(() => yup.number().default(undefined).nullable()), - title: yup.lazy(() => yup.string().default(undefined).nullable()), - type: yup.lazy(() => yup.string().default(undefined).nullable()) + }).default(undefined)) }).noUnknown() ); - export async function validate(value: any): Promise { + export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); } - export function validateSync(value: any): ProblemDetails { + export function validateSync(value: any): ModelWithDictionary { return schema.validateSync(value, { strict: true }); } }" `; -exports[`generation v3 typescript file(./test/result/v3/typescript/models/SamlParameters.ts): ./test/result/v3/typescript/models/SamlParameters.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithDuplicateImports.ts): ./test/result/v3/typescript/models/ModelWithDuplicateImports.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model with duplicated imports + */ +export interface ModelWithDuplicateImports { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +} + +export namespace ModelWithDuplicateImports { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + propA: yup.lazy(() => ModelWithString.schema.default(undefined)), + propB: yup.lazy(() => ModelWithString.schema.default(undefined)), + propC: yup.lazy(() => ModelWithString.schema.default(undefined)) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelWithDuplicateImports { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithDuplicateProperties.ts): ./test/result/v3/typescript/models/ModelWithDuplicateProperties.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model with duplicated properties + */ +export interface ModelWithDuplicateProperties { + prop?: ModelWithString; +} + +export namespace ModelWithDuplicateProperties { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + prop: yup.lazy(() => ModelWithString.schema.default(undefined)) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelWithDuplicateProperties { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithEnum.ts): ./test/result/v3/typescript/models/ModelWithEnum.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -7151,222 +7197,48 @@ exports[`generation v3 typescript file(./test/result/v3/typescript/models/SamlPa import * as yup from 'yup'; -export interface SamlParameters { - certificates: Array | null; - fullNameClaim: string | null; - issuerName: string | null; - separator?: string | null; - serviceProviderName: string | null; - singleLogoutServiceUrl: string | null; - singleSignOnServiceUrl: string | null; - usernameClaim: string | null; +/** + * This is a model with one enum + */ +export interface ModelWithEnum { + /** + * This is a simple enum with strings + */ + Test?: ModelWithEnum.Test; } -export namespace SamlParameters { +export namespace ModelWithEnum { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - certificates: yup.lazy(() => yup.array().of(yup.string()).default(undefined).nullable().required()), - fullNameClaim: yup.lazy(() => yup.string().default(undefined).nullable().required()), - issuerName: yup.lazy(() => yup.string().default(undefined).nullable().required()), - separator: yup.lazy(() => yup.string().default(undefined).nullable()), - serviceProviderName: yup.lazy(() => yup.string().default(undefined).nullable().required()), - singleLogoutServiceUrl: yup.lazy(() => yup.string().default(undefined).nullable().required()), - singleSignOnServiceUrl: yup.lazy(() => yup.string().default(undefined).nullable().required()), - usernameClaim: yup.lazy(() => yup.string().default(undefined).nullable().required()) + /** + * This is a simple enum with strings + */ + export enum Test { + SUCCESS = 'Success', + WARNING = 'Warning', + ERROR = 'Error' + } + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + Test: yup.lazy(() => yup.mixed().oneOf([ + Test.SUCCESS, + Test.WARNING, + Test.ERROR + ]).default(undefined)) }).noUnknown() ); - export async function validate(value: any): Promise { + export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); } - export function validateSync(value: any): SamlParameters { + export function validateSync(value: any): ModelWithEnum { return schema.validateSync(value, { strict: true }); } }" `; -exports[`generation v3 typescript file(./test/result/v3/typescript/models/ServiceAccount.ts): ./test/result/v3/typescript/models/ServiceAccount.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ServiceAccountBasedAccessControlEntry } from '../models/ServiceAccountBasedAccessControlEntry'; -import { UserClientSecret } from '../models/UserClientSecret'; -import * as yup from 'yup'; - -export interface ServiceAccount { - accessControlEntry?: ServiceAccountBasedAccessControlEntry; - clientId?: string | null; - clientSecrets?: Array | null; - createdAt?: string; - createdBy?: number | null; - id?: number; - lastLoginAt?: string | null; - modifiedAt?: string; - modifiedBy?: number | null; - name: string | null; -} - -export namespace ServiceAccount { - - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - accessControlEntry: yup.lazy(() => ServiceAccountBasedAccessControlEntry.schema.default(undefined)), - clientId: yup.lazy(() => yup.string().default(undefined).nullable()), - clientSecrets: yup.lazy(() => yup.array().of(UserClientSecret.schema).default(undefined).nullable()), - createdAt: yup.lazy(() => yup.string().default(undefined)), - createdBy: yup.lazy(() => yup.number().default(undefined).nullable()), - id: yup.lazy(() => yup.number().default(undefined)), - lastLoginAt: yup.lazy(() => yup.string().default(undefined).nullable()), - modifiedAt: yup.lazy(() => yup.string().default(undefined)), - modifiedBy: yup.lazy(() => yup.number().default(undefined).nullable()), - name: yup.lazy(() => yup.string().default(undefined).nullable().required()) - }).noUnknown() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): ServiceAccount { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/ServiceAccountBasedAccessControlEntry.ts): ./test/result/v3/typescript/models/ServiceAccountBasedAccessControlEntry.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiResourceLink } from '../models/ApiResourceLink'; -import { ApiResourceRoleLink } from '../models/ApiResourceRoleLink'; -import * as yup from 'yup'; - -export interface ServiceAccountBasedAccessControlEntry { - apiResourceRoles?: Array | null; - apiResources?: Array | null; -} - -export namespace ServiceAccountBasedAccessControlEntry { - - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - apiResourceRoles: yup.lazy(() => yup.array().of(ApiResourceRoleLink.schema).default(undefined).nullable()), - apiResources: yup.lazy(() => yup.array().of(ApiResourceLink.schema).default(undefined).nullable()) - }).noUnknown() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): ServiceAccountBasedAccessControlEntry { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/User.ts): ./test/result/v3/typescript/models/User.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { UserBasedAccessControlEntry } from '../models/UserBasedAccessControlEntry'; -import { UserClientSecret } from '../models/UserClientSecret'; -import * as yup from 'yup'; - -export interface User { - accessControlEntry?: UserBasedAccessControlEntry; - clientId?: string | null; - clientSecrets?: Array | null; - createdAt?: string; - createdBy?: number | null; - email?: string | null; - id?: number; - identityProviderId: number; - identityProviderKey: string | null; - lastLoginAt?: string | null; - modifiedAt?: string; - modifiedBy?: number | null; - name: string | null; - subject: string | null; -} - -export namespace User { - - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - accessControlEntry: yup.lazy(() => UserBasedAccessControlEntry.schema.default(undefined)), - clientId: yup.lazy(() => yup.string().default(undefined).nullable()), - clientSecrets: yup.lazy(() => yup.array().of(UserClientSecret.schema).default(undefined).nullable()), - createdAt: yup.lazy(() => yup.string().default(undefined)), - createdBy: yup.lazy(() => yup.number().default(undefined).nullable()), - email: yup.lazy(() => yup.string().default(undefined).nullable()), - id: yup.lazy(() => yup.number().default(undefined)), - identityProviderId: yup.lazy(() => yup.number().default(undefined).required()), - identityProviderKey: yup.lazy(() => yup.string().default(undefined).nullable().required()), - lastLoginAt: yup.lazy(() => yup.string().default(undefined).nullable()), - modifiedAt: yup.lazy(() => yup.string().default(undefined)), - modifiedBy: yup.lazy(() => yup.number().default(undefined).nullable()), - name: yup.lazy(() => yup.string().default(undefined).nullable().required()), - subject: yup.lazy(() => yup.string().default(undefined).nullable().required()) - }).noUnknown() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): User { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/UserBasedAccessControlEntry.ts): ./test/result/v3/typescript/models/UserBasedAccessControlEntry.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiResourceLink } from '../models/ApiResourceLink'; -import { ApiResourceRoleLink } from '../models/ApiResourceRoleLink'; -import { ApplicationLink } from '../models/ApplicationLink'; -import * as yup from 'yup'; - -export interface UserBasedAccessControlEntry { - apiResourceRoles?: Array | null; - apiResources?: Array | null; - applications?: Array | null; -} - -export namespace UserBasedAccessControlEntry { - - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - apiResourceRoles: yup.lazy(() => yup.array().of(ApiResourceRoleLink.schema).default(undefined).nullable()), - apiResources: yup.lazy(() => yup.array().of(ApiResourceLink.schema).default(undefined).nullable()), - applications: yup.lazy(() => yup.array().of(ApplicationLink.schema).default(undefined).nullable()) - }).noUnknown() - ); - - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } - - export function validateSync(value: any): UserBasedAccessControlEntry { - return schema.validateSync(value, { strict: true }); - } -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/models/UserClientSecret.ts): ./test/result/v3/typescript/models/UserClientSecret.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithEnumFromDescription.ts): ./test/result/v3/typescript/models/ModelWithEnumFromDescription.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -7374,37 +7246,48 @@ exports[`generation v3 typescript file(./test/result/v3/typescript/models/UserCl import * as yup from 'yup'; -export interface UserClientSecret { - clientSecret: string | null; - clientSecretUnHashed?: string | null; - expiresAt: string; - id?: number; - lastLoginAt?: string | null; +/** + * This is a model with one enum + */ +export interface ModelWithEnumFromDescription { + /** + * Success=1,Warning=2,Error=3 + */ + Test?: ModelWithEnumFromDescription.Test; } -export namespace UserClientSecret { +export namespace ModelWithEnumFromDescription { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - clientSecret: yup.lazy(() => yup.string().default(undefined).nullable().required()), - clientSecretUnHashed: yup.lazy(() => yup.string().default(undefined).nullable()), - expiresAt: yup.lazy(() => yup.string().default(undefined).required()), - id: yup.lazy(() => yup.number().default(undefined)), - lastLoginAt: yup.lazy(() => yup.string().default(undefined).nullable()) + /** + * Success=1,Warning=2,Error=3 + */ + export enum Test { + SUCCESS = 1, + WARNING = 2, + ERROR = 3 + } + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + Test: yup.lazy(() => yup.mixed().oneOf([ + Test.SUCCESS, + Test.WARNING, + Test.ERROR + ]).default(undefined)) }).noUnknown() ); - export async function validate(value: any): Promise { + export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); } - export function validateSync(value: any): UserClientSecret { + export function validateSync(value: any): ModelWithEnumFromDescription { return schema.validateSync(value, { strict: true }); } }" `; -exports[`generation v3 typescript file(./test/result/v3/typescript/models/WindowsParameters.ts): ./test/result/v3/typescript/models/WindowsParameters.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithInteger.ts): ./test/result/v3/typescript/models/ModelWithInteger.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -7412,695 +7295,409 @@ exports[`generation v3 typescript file(./test/result/v3/typescript/models/Window import * as yup from 'yup'; -export interface WindowsParameters { +/** + * This is a model with one number property + */ +export interface ModelWithInteger { + /** + * This is a simple number property + */ + prop?: number; } -export namespace WindowsParameters { +export namespace ModelWithInteger { - export const schema: yup.ObjectSchema = ( - yup.object() + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + prop: yup.lazy(() => yup.number().default(undefined)) + }).noUnknown() ); - export async function validate(value: any): Promise { + export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); } - export function validateSync(value: any): WindowsParameters { + export function validateSync(value: any): ModelWithInteger { return schema.validateSync(value, { strict: true }); } }" `; -exports[`generation v3 typescript file(./test/result/v3/typescript/services/ApiResourcesService.ts): ./test/result/v3/typescript/services/ApiResourcesService.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithLink.ts): ./test/result/v3/typescript/models/ModelWithLink.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ /* prettier-ignore */ +import { ModelLink } from '../models/ModelLink'; +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model that can have a template?? + */ +export interface ModelWithLink { + prop?: ModelLink; +} + +export namespace ModelWithLink { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + prop: yup.lazy(() => ModelLink.schema.default(undefined)) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelWithLink { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithNestedProperties.ts): ./test/result/v3/typescript/models/ModelWithNestedProperties.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a model with one nested property + */ +export interface ModelWithNestedProperties { + readonly first: { + readonly second: { + readonly third: string | null + } | null + } | null; +} + +export namespace ModelWithNestedProperties { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + first: yup.lazy(() => ( + yup.object().shape({ + second: yup.lazy(() => ( + yup.object().shape({ + third: yup.lazy(() => yup.string().default(undefined).nullable().required()) + }).noUnknown() + ).default(undefined).nullable().required()) + }).noUnknown() + ).default(undefined).nullable().required()) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelWithNestedProperties { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithProperties.ts): ./test/result/v3/typescript/models/ModelWithProperties.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model with one nested property + */ +export interface ModelWithProperties { + boolean?: boolean; + number?: number; + reference?: ModelWithString; + required: string; + requiredAndNullable: string | null; + readonly requiredAndReadOnly: string; + string?: string; +} + +export namespace ModelWithProperties { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + boolean: yup.lazy(() => yup.boolean().default(undefined)), + number: yup.lazy(() => yup.number().default(undefined)), + reference: yup.lazy(() => ModelWithString.schema.default(undefined)), + required: yup.lazy(() => yup.string().default(undefined).required()), + requiredAndNullable: yup.lazy(() => yup.string().default(undefined).nullable().required()), + requiredAndReadOnly: yup.lazy(() => yup.string().default(undefined).required()), + string: yup.lazy(() => yup.string().default(undefined)) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelWithProperties { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithReference.ts): ./test/result/v3/typescript/models/ModelWithReference.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a model with one property containing a reference + */ +export interface ModelWithReference { + prop?: ModelWithString; +} + +export namespace ModelWithReference { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + prop: yup.lazy(() => ModelWithString.schema.default(undefined)) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelWithReference { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithString.ts): ./test/result/v3/typescript/models/ModelWithString.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a model with one string property + */ +export interface ModelWithString { + /** + * This is a simple string property + */ + prop?: string; +} + +export namespace ModelWithString { + + export const schema: yup.ObjectSchema = ( + yup.object().shape({ + prop: yup.lazy(() => yup.string().default(undefined)) + }).noUnknown() + ); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ModelWithString { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/SimpleBoolean.ts): ./test/result/v3/typescript/models/SimpleBoolean.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; + +export namespace SimpleBoolean { + + export const schema = yup.boolean(); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): SimpleBoolean { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/SimpleFile.ts): ./test/result/v3/typescript/models/SimpleFile.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple file + */ +export type SimpleFile = File; + +export namespace SimpleFile { + + export const schema = yup.mixed(); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): SimpleFile { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/SimpleInteger.ts): ./test/result/v3/typescript/models/SimpleInteger.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple number + */ +export type SimpleInteger = number; + +export namespace SimpleInteger { + + export const schema = yup.number(); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): SimpleInteger { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/SimpleReference.ts): ./test/result/v3/typescript/models/SimpleReference.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; +import * as yup from 'yup'; + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; + +export namespace SimpleReference { + + export const schema = ModelWithString.schema; + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): SimpleReference { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/models/SimpleString.ts): ./test/result/v3/typescript/models/SimpleString.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import * as yup from 'yup'; + +/** + * This is a simple string + */ +export type SimpleString = string; + +export namespace SimpleString { + + export const schema = yup.string(); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): SimpleString { + return schema.validateSync(value, { strict: true }); + } +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/services/ComplexService.ts): ./test/result/v3/typescript/services/ComplexService.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ModelWithString } from '../models/ModelWithString'; import { ApiError, catchGenericError } from '../core/ApiError'; import { request } from '../core/request'; import { OpenAPI } from '../core/OpenAPI'; -export class ApiResourcesService { +export class ComplexService { /** - * @result any Success + * @param parameterObject Parameter containing object + * @param parameterReference Parameter containing reference + * @result any Successful response * @throws ApiError */ - public static async get(): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/ApiResources\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); + public static async complexTypes( + parameterObject: { + first?: { + second?: { + third?: string + } } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - public static async get1( - id: number + }, + parameterReference: ModelWithString ): Promise { const result = await request({ method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/ApiResources/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param name - * @result any Success - * @throws ApiError - */ - public static async getByName( - name: string - ): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/ApiResources/getByName/\${name}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/services/ApplicationsService.ts): ./test/result/v3/typescript/services/ApplicationsService.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiError, catchGenericError } from '../core/ApiError'; -import { request } from '../core/request'; -import { OpenAPI } from '../core/OpenAPI'; - -export class ApplicationsService { - - /** - * @param id - * @result any Success - * @throws ApiError - */ - public static async get( - id: number - ): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Applications/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @result any Success - * @throws ApiError - */ - public static async get1(): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Applications\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param clientId - * @result any Success - * @throws ApiError - */ - public static async getByClientId( - clientId: string - ): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Applications/getByClientId/\${clientId}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param name - * @result any Success - * @throws ApiError - */ - public static async getByName( - name: string - ): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Applications/getByName/\${name}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - public static async update( - id: number - ): Promise { - - const result = await request({ - method: 'put', - path: \`/api/v\${OpenAPI.VERSION}/Applications/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/services/ClaimsService.ts): ./test/result/v3/typescript/services/ClaimsService.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiError, catchGenericError } from '../core/ApiError'; -import { request } from '../core/request'; -import { OpenAPI } from '../core/OpenAPI'; - -export class ClaimsService { - - /** - * @result any Success - * @throws ApiError - */ - public static async get(): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Claims\` - }); - - catchGenericError(result); - - return result.body; - } - -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/services/IdentityProvidersService.ts): ./test/result/v3/typescript/services/IdentityProvidersService.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { IdentityProviderType } from '../models/IdentityProviderType'; -import { ApiError, catchGenericError } from '../core/ApiError'; -import { request } from '../core/request'; -import { OpenAPI } from '../core/OpenAPI'; - -export class IdentityProvidersService { - - /** - * @result any Success - * @throws ApiError - */ - public static async create(): Promise { - - const result = await request({ - method: 'post', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - public static async delete( - id: number - ): Promise { - - const result = await request({ - method: 'delete', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @result any Success - * @throws ApiError - */ - public static async get(): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - public static async get1( - id: number - ): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param name - * @result any Success - * @throws ApiError - */ - public static async getIcon( - name: string - ): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/icon/\${name}\` - }); - - if (!result.ok) { - switch (result.status) { - case 416: throw new ApiError(result, \`Client Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @result any Success - * @throws ApiError - */ - public static async getLoginOptions(): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/loginOptions\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param providerType - * @result any Success - * @throws ApiError - */ - public static async getParametersForIdentityProviderType( - providerType: IdentityProviderType - ): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/getParametersForIdentityProviderType/\${providerType}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - public static async update( - id: number - ): Promise { - - const result = await request({ - method: 'put', - path: \`/api/v\${OpenAPI.VERSION}/IdentityProviders/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/services/ServiceAccountsService.ts): ./test/result/v3/typescript/services/ServiceAccountsService.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiError, catchGenericError } from '../core/ApiError'; -import { request } from '../core/request'; -import { OpenAPI } from '../core/OpenAPI'; - -export class ServiceAccountsService { - - /** - * @param serviceAccountId - * @param secretId - * @result any Success - * @throws ApiError - */ - public static async deleteClientSecret( - serviceAccountId: number, - secretId: number - ): Promise { - - const result = await request({ - method: 'delete', - path: \`/api/v\${OpenAPI.VERSION}/ServiceAccounts/\${serviceAccountId}/clientSecrets/\${secretId}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param serviceAccountId - * @result any Success - * @throws ApiError - */ - public static async generateClientSecret( - serviceAccountId: number - ): Promise { - - const result = await request({ - method: 'post', - path: \`/api/v\${OpenAPI.VERSION}/ServiceAccounts/\${serviceAccountId}/generateClientSecret\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @result any Success - * @throws ApiError - */ - public static async get(): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/ServiceAccounts\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - public static async get1( - id: number - ): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/ServiceAccounts/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param secretId - * @param serviceAccountId - * @result any Success - * @throws ApiError - */ - public static async updateClientSecret( - secretId: number, - serviceAccountId: number - ): Promise { - - const result = await request({ - method: 'put', - path: \`/api/v\${OpenAPI.VERSION}/ServiceAccounts/\${serviceAccountId}/clientSecrets/\${secretId}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - -}" -`; - -exports[`generation v3 typescript file(./test/result/v3/typescript/services/SuggestionsService.ts): ./test/result/v3/typescript/services/SuggestionsService.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -import { ApiError, catchGenericError } from '../core/ApiError'; -import { request } from '../core/request'; -import { OpenAPI } from '../core/OpenAPI'; - -export class SuggestionsService { - - /** - * @param searchText - * @result any Success - * @throws ApiError - */ - public static async getClaimTypes( - searchText?: string - ): Promise { - - const result = await request({ - method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Suggestions/claimTypes\`, + path: \`/api/v\${OpenAPI.VERSION}/complex\`, query: { - 'searchText': searchText + 'parameterObject': parameterObject, + 'parameterReference': parameterReference } }); if (!result.ok) { switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); + case 400: throw new ApiError(result, \`400 server error\`); + case 500: throw new ApiError(result, \`500 server error\`); } } @@ -8112,7 +7709,7 @@ export class SuggestionsService { }" `; -exports[`generation v3 typescript file(./test/result/v3/typescript/services/UsersService.ts): ./test/result/v3/typescript/services/UsersService.ts 1`] = ` +exports[`generation v3 typescript file(./test/result/v3/typescript/services/ParametersService.ts): ./test/result/v3/typescript/services/ParametersService.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ @@ -8122,133 +7719,65 @@ import { ApiError, catchGenericError } from '../core/ApiError'; import { request } from '../core/request'; import { OpenAPI } from '../core/OpenAPI'; -export class UsersService { +export class ParametersService { /** - * @result any Success + * @param parameterHeader This is the parameter that goes into the request header + * @param parameterQuery This is the parameter that goes into the request query params * @throws ApiError */ - public static async create(): Promise { - - const result = await request({ - method: 'post', - path: \`/api/v\${OpenAPI.VERSION}/Users\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - public static async delete( - id: number - ): Promise { - - const result = await request({ - method: 'delete', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${id}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param userId - * @param secretId - * @result any Success - * @throws ApiError - */ - public static async deleteClientSecret( - userId: number, - secretId: number - ): Promise { - - const result = await request({ - method: 'delete', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${userId}/clientSecrets/\${secretId}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param userId - * @result any Success - * @throws ApiError - */ - public static async generateClientSecret( - userId: number - ): Promise { - - const result = await request({ - method: 'post', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${userId}/generateClientSecret\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param id - * @result any Success - * @throws ApiError - */ - public static async get( - id: number - ): Promise { + public static async callWithParameters( + parameterHeader: any, + parameterQuery: any + ): Promise { const result = await request({ method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${id}\` + path: \`/api/v\${OpenAPI.VERSION}/parameters\`, + headers: { + 'parameterHeader': parameterHeader + }, + query: { + 'parameterQuery': parameterQuery + } + }); + + catchGenericError(result); + + return result.body; + } + +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/services/ResponseService.ts): ./test/result/v3/typescript/services/ResponseService.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ApiError, catchGenericError } from '../core/ApiError'; +import { request } from '../core/request'; +import { OpenAPI } from '../core/OpenAPI'; + +export class ResponseService { + + /** + * @result any Message for default response + * @throws ApiError + */ + public static async callWithDuplicateResponses(): Promise { + + const result = await request({ + method: 'post', + path: \`/api/v\${OpenAPI.VERSION}/response\` }); if (!result.ok) { switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); + case 500: throw new ApiError(result, \`Message for 500 error\`); + case 501: throw new ApiError(result, \`Message for 501 error\`); + case 502: throw new ApiError(result, \`Message for 502 error\`); } } @@ -8258,76 +7787,37 @@ export class UsersService { } /** - * @result any Success + * @result any Message for default response * @throws ApiError */ - public static async get1(): Promise { + public static async callWithResponse(): Promise { const result = await request({ method: 'get', - path: \`/api/v\${OpenAPI.VERSION}/Users\` + path: \`/api/v\${OpenAPI.VERSION}/response\` }); - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - catchGenericError(result); return result.body; } /** - * @param id - * @result any Success + * @result any Message for default response * @throws ApiError */ - public static async update( - id: number - ): Promise { + public static async callWithResponses(): Promise { const result = await request({ method: 'put', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${id}\` + path: \`/api/v\${OpenAPI.VERSION}/response\` }); if (!result.ok) { switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); - } - } - - catchGenericError(result); - - return result.body; - } - - /** - * @param secretId - * @param userId - * @result any Success - * @throws ApiError - */ - public static async updateClientSecret( - secretId: number, - userId: number - ): Promise { - - const result = await request({ - method: 'put', - path: \`/api/v\${OpenAPI.VERSION}/Users/\${userId}/clientSecrets/\${secretId}\` - }); - - if (!result.ok) { - switch (result.status) { - case 400: throw new ApiError(result, \`Bad Request\`); - case 404: throw new ApiError(result, \`Not Found\`); - case 500: throw new ApiError(result, \`Server Error\`); + case 500: throw new ApiError(result, \`Message for 500 error\`); + case 501: throw new ApiError(result, \`Message for 501 error\`); + case 502: throw new ApiError(result, \`Message for 502 error\`); } } @@ -8338,3 +7828,177 @@ export class UsersService { }" `; + +exports[`generation v3 typescript file(./test/result/v3/typescript/services/SimpleService.ts): ./test/result/v3/typescript/services/SimpleService.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ApiError, catchGenericError } from '../core/ApiError'; +import { request } from '../core/request'; +import { OpenAPI } from '../core/OpenAPI'; + +export class SimpleService { + + /** + * @throws ApiError + */ + public static async deleteCallWithoutParametersAndResponse(): Promise { + + const result = await request({ + method: 'delete', + path: \`/api/v\${OpenAPI.VERSION}/simple\` + }); + + catchGenericError(result); + + return result.body; + } + + /** + * @throws ApiError + */ + public static async getCallWithoutParametersAndResponse(): Promise { + + const result = await request({ + method: 'get', + path: \`/api/v\${OpenAPI.VERSION}/simple\` + }); + + catchGenericError(result); + + return result.body; + } + + /** + * @throws ApiError + */ + public static async headCallWithoutParametersAndResponse(): Promise { + + const result = await request({ + method: 'head', + path: \`/api/v\${OpenAPI.VERSION}/simple\` + }); + + catchGenericError(result); + + return result.body; + } + + /** + * @throws ApiError + */ + public static async optionsCallWithoutParametersAndResponse(): Promise { + + const result = await request({ + method: 'options', + path: \`/api/v\${OpenAPI.VERSION}/simple\` + }); + + catchGenericError(result); + + return result.body; + } + + /** + * @throws ApiError + */ + public static async patchCallWithoutParametersAndResponse(): Promise { + + const result = await request({ + method: 'patch', + path: \`/api/v\${OpenAPI.VERSION}/simple\` + }); + + catchGenericError(result); + + return result.body; + } + + /** + * @throws ApiError + */ + public static async postCallWithoutParametersAndResponse(): Promise { + + const result = await request({ + method: 'post', + path: \`/api/v\${OpenAPI.VERSION}/simple\` + }); + + catchGenericError(result); + + return result.body; + } + + /** + * @throws ApiError + */ + public static async putCallWithoutParametersAndResponse(): Promise { + + const result = await request({ + method: 'put', + path: \`/api/v\${OpenAPI.VERSION}/simple\` + }); + + catchGenericError(result); + + return result.body; + } + +}" +`; + +exports[`generation v3 typescript file(./test/result/v3/typescript/services/TypesService.ts): ./test/result/v3/typescript/services/TypesService.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { ApiError, catchGenericError } from '../core/ApiError'; +import { request } from '../core/request'; +import { OpenAPI } from '../core/OpenAPI'; + +export class TypesService { + + /** + * @param parameterNumber This is a number parameter + * @param parameterString This is a string parameter + * @param parameterBoolean This is a boolean parameter + * @param parameterObject This is an object parameter + * @param parameterArray This is an array parameter + * @param parameterDictionary This is a dictionary parameter + * @param id This is a number parameter + * @result any Response is a simple number + * @throws ApiError + */ + public static async types( + parameterNumber: any, + parameterString: any, + parameterBoolean: any, + parameterObject: any, + parameterArray: any, + parameterDictionary: any, + id?: number + ): Promise { + + const result = await request({ + method: 'get', + path: \`/api/v\${OpenAPI.VERSION}/types\`, + query: { + 'parameterNumber': parameterNumber, + 'parameterString': parameterString, + 'parameterBoolean': parameterBoolean, + 'parameterObject': parameterObject, + 'parameterArray': parameterArray, + 'parameterDictionary': parameterDictionary + } + }); + + catchGenericError(result); + + return result.body; + } + +}" +`; diff --git a/test/index.js b/test/index.js index a2396b28..b87a616a 100644 --- a/test/index.js +++ b/test/index.js @@ -1,5 +1,19 @@ const OpenAPI = require('../dist'); +OpenAPI.generate( + './test/mock/spec-v2.json', + './test/result/v2/typescript/', + OpenAPI.Language.TYPESCRIPT, + OpenAPI.HttpClient.FETCH, +); + +OpenAPI.generate( + './test/mock/spec-v2.json', + './test/result/v2/javascript/', + OpenAPI.Language.JAVASCRIPT, + OpenAPI.HttpClient.XHR, +); + OpenAPI.generate( './test/mock/spec-v3.json', './test/result/v3/typescript/', @@ -7,18 +21,12 @@ OpenAPI.generate( OpenAPI.HttpClient.FETCH, ); -// OpenAPI.generate( -// './test/mock/spec-v2.json', -// './test/result/v2/typescript/', -// OpenAPI.Language.TYPESCRIPT, -// OpenAPI.HttpClient.FETCH, -// ); +OpenAPI.generate( + './test/mock/spec-v3.json', + './test/result/v3/javascript/', + OpenAPI.Language.JAVASCRIPT, + OpenAPI.HttpClient.XHR, +); -// OpenAPI.generate( -// './test/mock/spec-v2.json', -// './test/result/v2/javascript/', -// OpenAPI.Language.JAVASCRIPT, -// OpenAPI.HttpClient.XHR, -// ); - -// OpenAPI.compile('./test/result/v2/typescript/'); +OpenAPI.compile('./test/result/v2/typescript/'); +OpenAPI.compile('./test/result/v3/typescript/'); diff --git a/test/mock/spec-v2.json b/test/mock/spec-v2.json index aabd59f6..a503b02f 100644 --- a/test/mock/spec-v2.json +++ b/test/mock/spec-v2.json @@ -618,18 +618,59 @@ } } }, + "ModelWithProperties": { + "description": "This is a model with one nested property", + "type": "object", + "required": [ + "required", + "requiredAndreadOnly" + ], + "properties": { + "required": { + "type": "string" + }, + "requiredAndreadOnly": { + "type": "string", + "readOnly": true + }, + "string": { + "type": "string" + }, + "number": { + "type": "number" + }, + "boolean": { + "type": "boolean" + }, + "reference": { + "$ref": "#/definitions/ModelWithString" + } + } + }, "ModelWithNestedProperties": { "description": "This is a model with one nested property", "type": "object", + "required": [ + "first" + ], "properties": { "first": { "type": "object", + "required": [ + "second" + ], + "readOnly": true, "properties": { "second": { "type": "object", + "required": [ + "third" + ], + "readOnly": true, "properties": { "third": { - "type": "string" + "type": "string", + "readOnly": true } } } diff --git a/test/mock/spec-v3.json b/test/mock/spec-v3.json index 255cea30..5f2cabaa 100644 --- a/test/mock/spec-v3.json +++ b/test/mock/spec-v3.json @@ -1,3823 +1,371 @@ { "openapi": "3.0.1", "info": { - "title": "Access Management API", + "title": "swagger", "version": "v1" }, "servers": [ { - "url": "/access-manager" + "url": "/api" } ], "paths": { - "/api/v{api-version}/ApiResources/getByName/{name}": { + "/api/v{api-version}/simple": { "get": { "tags": [ - "ApiResources" + "Simple" ], - "operationId": "GetByName", - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResource" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResource" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResource" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/ApiResources": { - "get": { - "tags": [ - "ApiResources" - ], - "operationId": "Get", - "parameters": [ - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResource" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResource" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResource" - } - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/ApiResources/{id}": { - "get": { - "tags": [ - "ApiResources" - ], - "operationId": "Get", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ApiResource" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ApiResource" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ApiResource" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/Applications/getByName/{name}": { - "get": { - "tags": [ - "Applications" - ], - "operationId": "GetByName", - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/Application" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/Application" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/Application" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/Applications/getByClientId/{clientId}": { - "get": { - "tags": [ - "Applications" - ], - "operationId": "GetByClientId", - "parameters": [ - { - "name": "clientId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/Application" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/Application" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/Application" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/Applications/{id}": { + "operationId": "GetCallWithoutParametersAndResponse" + }, "put": { "tags": [ - "Applications" + "Simple" ], - "operationId": "Update", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "title": "Application", - "required": [ - "name", - "redirectUrls" - ], - "type": "object", - "properties": { - "clientId": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true - }, - "name": { - "maxLength": 256, - "type": "string", - "nullable": true, - "readOnly": true - }, - "redirectUrls": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - } - } - } - }, - "application/json": { - "schema": { - "title": "Application", - "required": [ - "name", - "redirectUrls" - ], - "type": "object", - "properties": { - "clientId": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true - }, - "name": { - "maxLength": 256, - "type": "string", - "nullable": true, - "readOnly": true - }, - "redirectUrls": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - } - } - } - }, - "text/json": { - "schema": { - "title": "Application", - "required": [ - "name", - "redirectUrls" - ], - "type": "object", - "properties": { - "clientId": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true - }, - "name": { - "maxLength": 256, - "type": "string", - "nullable": true, - "readOnly": true - }, - "redirectUrls": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - } - } - } - }, - "application/*+json": { - "schema": { - "title": "Application", - "required": [ - "name", - "redirectUrls" - ], - "type": "object", - "properties": { - "clientId": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true - }, - "name": { - "maxLength": 256, - "type": "string", - "nullable": true, - "readOnly": true - }, - "redirectUrls": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/Application" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/Application" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/Application" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } + "operationId": "PutCallWithoutParametersAndResponse" }, - "get": { - "tags": [ - "Applications" - ], - "operationId": "Get", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/Application" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/Application" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/Application" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/Applications": { - "get": { - "tags": [ - "Applications" - ], - "operationId": "Get", - "parameters": [ - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Application" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Application" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Application" - } - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/Claims": { - "get": { - "tags": [ - "Claims" - ], - "operationId": "Get", - "parameters": [ - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success" - } - } - } - }, - "/api/v{api-version}/IdentityProviders/icon/{name}": { - "get": { - "tags": [ - "IdentityProviders" - ], - "operationId": "GetIcon", - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success" - }, - "204": { - "description": "Success" - }, - "206": { - "description": "Success" - }, - "416": { - "description": "Client Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, - "/api/v{api-version}/IdentityProviders/loginOptions": { - "get": { - "tags": [ - "IdentityProviders" - ], - "operationId": "GetLoginOptions", - "parameters": [ - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/LoginOption" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/LoginOption" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/LoginOption" - } - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/IdentityProviders/getParametersForIdentityProviderType/{providerType}": { - "get": { - "tags": [ - "IdentityProviders" - ], - "operationId": "GetParametersForIdentityProviderType", - "parameters": [ - { - "name": "providerType", - "in": "path", - "required": true, - "schema": { - "$ref": "#/components/schemas/IdentityProviderType" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/IdentityProviderParameters" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProviderParameters" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProviderParameters" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/IdentityProviders": { "post": { "tags": [ - "IdentityProviders" + "Simple" ], - "operationId": "Create", - "parameters": [ - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - } - } - }, - "responses": { - "201": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "get": { - "tags": [ - "IdentityProviders" - ], - "operationId": "Get", - "parameters": [ - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/IdentityProvider" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/IdentityProvider" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/IdentityProvider" - } - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/IdentityProviders/{id}": { - "put": { - "tags": [ - "IdentityProviders" - ], - "operationId": "Update", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } + "operationId": "PostCallWithoutParametersAndResponse" }, "delete": { "tags": [ - "IdentityProviders" + "Simple" ], - "operationId": "Delete", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "204": { - "description": "Success" - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } + "operationId": "DeleteCallWithoutParametersAndResponse" }, - "get": { + "options": { "tags": [ - "IdentityProviders" + "Simple" ], - "operationId": "Get", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/IdentityProvider" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/ServiceAccounts": { - "get": { - "tags": [ - "ServiceAccounts" - ], - "operationId": "Get", - "parameters": [ - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ServiceAccount" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ServiceAccount" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ServiceAccount" - } - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/ServiceAccounts/{id}": { - "get": { - "tags": [ - "ServiceAccounts" - ], - "operationId": "Get", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ServiceAccount" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ServiceAccount" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ServiceAccount" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/ServiceAccounts/{serviceAccountId}/generateClientSecret": { - "post": { - "tags": [ - "ServiceAccounts" - ], - "operationId": "GenerateClientSecret", - "parameters": [ - { - "name": "serviceAccountId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/ServiceAccounts/{serviceAccountId}/clientSecrets/{secretId}": { - "put": { - "tags": [ - "ServiceAccounts" - ], - "operationId": "UpdateClientSecret", - "parameters": [ - { - "name": "secretId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "serviceAccountId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } + "operationId": "OptionsCallWithoutParametersAndResponse" }, - "delete": { + "head": { "tags": [ - "ServiceAccounts" + "Simple" ], - "operationId": "DeleteClientSecret", - "parameters": [ - { - "name": "serviceAccountId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "secretId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } + "operationId": "HeadCallWithoutParametersAndResponse" + }, + "patch": { + "tags": [ + "Simple" ], - "responses": { - "204": { - "description": "Success" - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } + "operationId": "PatchCallWithoutParametersAndResponse" } }, - "/api/v{api-version}/Suggestions/claimTypes": { + "/api/v{api-version}/parameters": { "get": { "tags": [ - "Suggestions" + "Parameters" ], - "operationId": "GetClaimTypes", + "operationId": "CallWithParameters", "parameters": [ { - "name": "searchText", + "description": "This is the parameter that goes into the request header", + "name": "parameterHeader", + "in": "header", + "type": "string", + "required": true, + "nullable": true + }, + { + "description": "This is the parameter that goes into the request query params", + "name": "parameterQuery", "in": "query", - "schema": { - "type": "string" - } + "type": "string", + "required": true, + "nullable": true + }, + { + "description": "This is the parameter that goes into the request form data", + "name": "parameterForm", + "in": "formData", + "type": "string", + "required": true, + "nullable": true + }, + { + "description": "This is the parameter that is send as request body", + "name": "parameterBody", + "in": "body", + "type": "string", + "required": true, + "nullable": true }, { "name": "api-version", "in": "path", + "type": "string", "required": true, - "schema": { - "type": "string" - } + "nullable": true } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } + ] } }, - "/api/v{api-version}/Users/{userId}/generateClientSecret": { - "post": { - "tags": [ - "Users" - ], - "operationId": "GenerateClientSecret", - "parameters": [ - { - "name": "userId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/Users/{userId}/clientSecrets/{secretId}": { - "put": { - "tags": [ - "Users" - ], - "operationId": "UpdateClientSecret", - "parameters": [ - { - "name": "secretId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "userId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/UserClientSecret" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "delete": { - "tags": [ - "Users" - ], - "operationId": "DeleteClientSecret", - "parameters": [ - { - "name": "userId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "secretId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "204": { - "description": "Success" - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/api/v{api-version}/Users/{id}": { - "put": { - "tags": [ - "Users" - ], - "operationId": "Update", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "title": "User", - "required": [ - "identityProviderId", - "identityProviderKey", - "name", - "subject" - ], - "type": "object", - "properties": { - "name": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "email": { - "maxLength": 256, - "type": "string", - "format": "email", - "nullable": true - }, - "subject": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "identityProviderId": { - "type": "integer", - "format": "int32", - "readOnly": true - }, - "identityProviderKey": { - "maxLength": 256, - "type": "string", - "nullable": true, - "readOnly": true - }, - "clientId": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "lastLoginAt": { - "type": "string", - "format": "date-time", - "nullable": true, - "readOnly": true - }, - "clientSecrets": { - "maxLength": 2, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserClientSecret" - }, - "nullable": true, - "readOnly": true - }, - "accessControlEntry": { - "title": "UserBasedAccessControlEntry", - "type": "object", - "properties": { - "applications": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApplicationLink" - }, - "nullable": true - }, - "apiResources": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceLink" - }, - "nullable": true - }, - "apiResourceRoles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceRoleLink" - }, - "nullable": true - } - } - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true - } - } - } - }, - "application/json": { - "schema": { - "title": "User", - "required": [ - "identityProviderId", - "identityProviderKey", - "name", - "subject" - ], - "type": "object", - "properties": { - "name": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "email": { - "maxLength": 256, - "type": "string", - "format": "email", - "nullable": true - }, - "subject": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "identityProviderId": { - "type": "integer", - "format": "int32", - "readOnly": true - }, - "identityProviderKey": { - "maxLength": 256, - "type": "string", - "nullable": true, - "readOnly": true - }, - "clientId": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "lastLoginAt": { - "type": "string", - "format": "date-time", - "nullable": true, - "readOnly": true - }, - "clientSecrets": { - "maxLength": 2, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserClientSecret" - }, - "nullable": true, - "readOnly": true - }, - "accessControlEntry": { - "title": "UserBasedAccessControlEntry", - "type": "object", - "properties": { - "applications": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApplicationLink" - }, - "nullable": true - }, - "apiResources": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceLink" - }, - "nullable": true - }, - "apiResourceRoles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceRoleLink" - }, - "nullable": true - } - } - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true - } - } - } - }, - "text/json": { - "schema": { - "title": "User", - "required": [ - "identityProviderId", - "identityProviderKey", - "name", - "subject" - ], - "type": "object", - "properties": { - "name": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "email": { - "maxLength": 256, - "type": "string", - "format": "email", - "nullable": true - }, - "subject": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "identityProviderId": { - "type": "integer", - "format": "int32", - "readOnly": true - }, - "identityProviderKey": { - "maxLength": 256, - "type": "string", - "nullable": true, - "readOnly": true - }, - "clientId": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "lastLoginAt": { - "type": "string", - "format": "date-time", - "nullable": true, - "readOnly": true - }, - "clientSecrets": { - "maxLength": 2, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserClientSecret" - }, - "nullable": true, - "readOnly": true - }, - "accessControlEntry": { - "title": "UserBasedAccessControlEntry", - "type": "object", - "properties": { - "applications": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApplicationLink" - }, - "nullable": true - }, - "apiResources": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceLink" - }, - "nullable": true - }, - "apiResourceRoles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceRoleLink" - }, - "nullable": true - } - } - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true - } - } - } - }, - "application/*+json": { - "schema": { - "title": "User", - "required": [ - "identityProviderId", - "identityProviderKey", - "name", - "subject" - ], - "type": "object", - "properties": { - "name": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "email": { - "maxLength": 256, - "type": "string", - "format": "email", - "nullable": true - }, - "subject": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "identityProviderId": { - "type": "integer", - "format": "int32", - "readOnly": true - }, - "identityProviderKey": { - "maxLength": 256, - "type": "string", - "nullable": true, - "readOnly": true - }, - "clientId": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "lastLoginAt": { - "type": "string", - "format": "date-time", - "nullable": true, - "readOnly": true - }, - "clientSecrets": { - "maxLength": 2, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserClientSecret" - }, - "nullable": true, - "readOnly": true - }, - "accessControlEntry": { - "title": "UserBasedAccessControlEntry", - "type": "object", - "properties": { - "applications": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApplicationLink" - }, - "nullable": true - }, - "apiResources": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceLink" - }, - "nullable": true - }, - "apiResourceRoles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceRoleLink" - }, - "nullable": true - } - } - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/User" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "delete": { - "tags": [ - "Users" - ], - "operationId": "Delete", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "204": { - "description": "Success" - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, + "/api/v{api-version}/response": { "get": { "tags": [ - "Users" - ], - "operationId": "Get", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - }, - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } + "Response" ], + "operationId": "CallWithResponse", "responses": { - "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/User" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } + "default": { + "description": "Message for default response", + "schema": { + "$ref": "#/components/schemas/ModelWithString" } } } - } - }, - "/api/v{api-version}/Users": { + }, "post": { "tags": [ - "Users" + "Response" ], - "operationId": "Create", - "parameters": [ - { - "name": "api-version", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json-patch+json": { - "schema": { - "$ref": "#/components/schemas/User" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - }, - "application/*+json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, + "operationId": "CallWithDuplicateResponses", "responses": { + "default": { + "description": "Message for default response", + "schema": { + "$ref": "#/components/schemas/ModelWithString" + } + }, "201": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/User" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } + "description": "Message for 201 response", + "schema": { + "$ref": "#/components/schemas/ModelWithString" } }, - "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } + "202": { + "description": "Message for 202 response", + "schema": { + "$ref": "#/components/schemas/ModelWithString" } }, "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } + "description": "Message for 500 error", + "schema": { + "$ref": "#/components/schemas/ModelWithString" + } + }, + "501": { + "description": "Message for 501 error", + "schema": { + "$ref": "#/components/schemas/ModelWithString" + } + }, + "502": { + "description": "Message for 502 error", + "schema": { + "$ref": "#/components/schemas/ModelWithString" } } } }, + "put": { + "tags": [ + "Response" + ], + "operationId": "CallWithResponses", + "responses": { + "default": { + "description": "Message for default response", + "schema": { + "$ref": "#/components/schemas/ModelWithString" + } + }, + "201": { + "description": "Message for 201 response", + "schema": { + "$ref": "#/components/schemas/ModelThatExtends" + } + }, + "202": { + "description": "Message for 202 response", + "schema": { + "$ref": "#/components/schemas/ModelThatExtendsExtends" + } + }, + "500": { + "description": "Message for 500 error", + "schema": { + "$ref": "#/components/schemas/ModelWithString" + } + }, + "501": { + "description": "Message for 501 error", + "schema": { + "$ref": "#/components/schemas/ModelWithString" + } + }, + "502": { + "description": "Message for 502 error", + "schema": { + "$ref": "#/components/schemas/ModelWithString" + } + } + } + } + }, + "/api/v{api-version}/types": { "get": { "tags": [ - "Users" + "Types" ], - "operationId": "Get", + "operationId": "Types", "parameters": [ { - "name": "api-version", - "in": "path", + "description": "This is a number parameter", + "name": "parameterNumber", + "in": "query", "required": true, - "schema": { + "default": 123, + "type": "int" + }, + { + "description": "This is a string parameter", + "name": "parameterString", + "in": "query", + "required": true, + "nullable": true, + "default": "default", + "type": "string" + }, + { + "description": "This is a boolean parameter", + "name": "parameterBoolean", + "in": "query", + "required": true, + "nullable": true, + "default": true, + "type": "boolean" + }, + { + "description": "This is an object parameter", + "name": "parameterObject", + "in": "query", + "required": true, + "nullable": true, + "default": null, + "type": "object" + }, + { + "description": "This is an array parameter", + "name": "parameterArray", + "in": "query", + "required": true, + "nullable": true, + "type": "array", + "items": { "type": "string" } + }, + { + "description": "This is a dictionary parameter", + "name": "parameterDictionary", + "in": "query", + "required": true, + "nullable": true, + "type": "object", + "items": { + "type": "string" + } + }, + { + "description": "This is a number parameter", + "name": "id", + "in": "path", + "schema": { + "type": "integer", + "format": "int32" + } } ], "responses": { "200": { - "description": "Success", - "content": { - "text/plain": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/User" - } - } - }, - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/User" - } - } - }, - "text/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/User" + "description": "Response is a simple number", + "schema": { + "type": "number" + } + }, + "201": { + "description": "Response is a simple string", + "schema": { + "type": "string" + } + }, + "202": { + "description": "Response is a simple boolean", + "schema": { + "type": "boolean" + } + }, + "203": { + "description": "Response is a simple object", + "default": null, + "schema": { + "type": "object" + } + } + } + } + }, + "/api/v{api-version}/complex": { + "get": { + "tags": [ + "Complex" + ], + "operationId": "ComplexTypes", + "parameters": [ + { + "description": "Parameter containing object", + "name": "parameterObject", + "in": "query", + "required": true, + "schema": { + "type": "object", + "properties": { + "first": { + "type": "object", + "properties": { + "second": { + "type": "object", + "properties": { + "third": { + "type": "string" + } + } + } } } } } }, + { + "description": "Parameter containing reference", + "name": "parameterReference", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/ModelWithString" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ModelWithString" + } + } + }, "400": { - "description": "Bad Request", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } + "description": "400 server error" }, "500": { - "description": "Server Error", - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } + "description": "500 server error" } } } @@ -3825,867 +373,403 @@ }, "components": { "schemas": { - "ApiResourceRole": { - "required": [ - "key", - "name" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "key": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "name": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "apiResource": { - "$ref": "#/components/schemas/ApiResource" - } - }, - "additionalProperties": false + "SimpleInteger": { + "description": "This is a simple number", + "type": "integer" }, - "ApiResource": { - "required": [ - "key", - "name" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "key": { - "maxLength": 256, - "pattern": "^[a-zA-Z0-9-_.]*$", - "type": "string", - "nullable": true - }, - "name": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "roles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceRole" - }, - "nullable": true - } - }, - "additionalProperties": false + "SimpleBoolean": { + "description": "This is a simple boolean", + "type": "boolean" }, - "IInnerError": { - "type": "object", - "properties": { - "code": { - "type": "string", - "nullable": true - }, - "innerError": { - "$ref": "#/components/schemas/IInnerError" - } - }, - "additionalProperties": false - }, - "ErrorMessage": { - "type": "object", - "properties": { - "code": { - "type": "string", - "nullable": true - }, - "message": { - "type": "string", - "nullable": true - }, - "localizedMessage": { - "type": "string", - "nullable": true - }, - "target": { - "type": "string", - "nullable": true - }, - "details": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ErrorMessage" - }, - "nullable": true - }, - "innerError": { - "$ref": "#/components/schemas/IInnerError" - }, - "stackTrace": { - "type": "string", - "nullable": true - }, - "innerException": { - "$ref": "#/components/schemas/ErrorMessage" - } - }, - "additionalProperties": false - }, - "ErrorResponse": { - "type": "object", - "properties": { - "errorMessage": { - "$ref": "#/components/schemas/ErrorMessage" - } - }, - "additionalProperties": false - }, - "Application": { - "required": [ - "name", - "redirectUrls" - ], - "type": "object", - "properties": { - "clientId": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "redirectUrls": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false - }, - "ProblemDetails": { - "type": "object", - "properties": { - "type": { - "type": "string", - "nullable": true - }, - "title": { - "type": "string", - "nullable": true - }, - "status": { - "type": "integer", - "format": "int32", - "nullable": true - }, - "detail": { - "type": "string", - "nullable": true - }, - "instance": { - "type": "string", - "nullable": true - }, - "extensions": { - "type": "object", - "additionalProperties": { - "type": "object", - "additionalProperties": false - }, - "nullable": true, - "readOnly": true - } - }, - "additionalProperties": false - }, - "LoginOption": { - "required": [ - "name" - ], - "type": "object", - "properties": { - "name": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "loginTriggerUrl": { - "type": "string", - "nullable": true - }, - "iconUrl": { - "type": "string", - "nullable": true - } - }, - "additionalProperties": false - }, - "IdentityProviderType": { - "enum": [ - "OpenIdConnect", - "SAML2P", - "LDAP", - "Windows" - ], + "SimpleString": { + "description": "This is a simple string", "type": "string" }, - "OpenIdParameters": { - "required": [ - "authority", - "clientId", - "fullNameClaim", - "usernameClaim" - ], - "type": "object", - "properties": { - "clientId": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "authority": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "clientSecret": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "endSessionEndpoint": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "sendIdTokenHintDuringLogout": { - "type": "boolean" - }, - "separator": { - "maxLength": 1, - "type": "string", - "nullable": true - }, - "usernameClaim": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "fullNameClaim": { - "maxLength": 256, - "type": "string", - "nullable": true - } - }, - "additionalProperties": false + "SimpleFile": { + "description": "This is a simple file", + "type": "File" }, - "SamlParameters": { - "required": [ - "certificates", - "fullNameClaim", - "issuerName", - "serviceProviderName", - "singleLogoutServiceUrl", - "singleSignOnServiceUrl", - "usernameClaim" - ], - "type": "object", - "properties": { - "issuerName": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "serviceProviderName": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "singleSignOnServiceUrl": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "singleLogoutServiceUrl": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "certificates": { - "minLength": 1, - "type": "array", - "items": { + "SimpleReference": { + "description": "This is a simple reference", + "$ref": "#/components/schemas/ModelWithString" + }, + "EnumWithStrings": { + "description": "This is a simple enum with strings", + "enum": [ + "Success", + "Warning", + "Error" + ] + }, + "EnumWithNumbers": { + "description": "This is a simple enum with numbers", + "enum": [ + 1, + 2, + 3 + ] + }, + "EnumFromDescription": { + "description": "Success=1,Warning=2,Error=3", + "type": "int" + }, + "ArrayWithNumbers": { + "description": "This is a simple array with numbers", + "type": "array", + "items": { + "type": "integer" + } + }, + "ArrayWithBooleans": { + "description": "This is a simple array with booleans", + "type": "array", + "items": { + "type": "boolean" + } + }, + "ArrayWithStrings": { + "description": "This is a simple array with strings", + "type": "array", + "items": { + "type": "string" + } + }, + "ArrayWithReferences": { + "description": "This is a simple array with references", + "type": "array", + "items": { + "$ref": "#/components/schemas/ModelWithString" + } + }, + "ArrayWithArray": { + "description": "This is a simple array containing an array", + "type": "array", + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ModelWithString" + } + } + }, + "ArrayWithProperties": { + "description": "This is a simple array with properties", + "type": "array", + "items": { + "type": "object", + "properties": { + "foo": { "type": "string" }, - "nullable": true - }, - "separator": { - "maxLength": 1, - "type": "string", - "nullable": true - }, - "usernameClaim": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "fullNameClaim": { - "maxLength": 256, - "type": "string", - "nullable": true + "bar": { + "type": "string" + } } - }, - "additionalProperties": false + } }, - "LdapParameters": { - "required": [ - "fullNameClaim", - "port", - "searchAccount", - "searchAccountPassword", - "serverAddress", - "userBaseDn", - "usernameClaim", - "useSsl" - ], + "DictionaryWithString": { + "description": "This is a string dictionary", "type": "object", - "properties": { - "serverAddress": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "port": { - "type": "integer", - "format": "int32" - }, - "useSsl": { - "type": "boolean" - }, - "searchAccount": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "searchAccountPassword": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "userBaseDn": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "groupBaseDn": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "groupMemberAttribute": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "additionalAttributes": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "separator": { - "maxLength": 1, - "type": "string", - "nullable": true - }, - "usernameClaim": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "fullNameClaim": { - "maxLength": 256, - "type": "string", - "nullable": true + "additionalProperties": { + "type": "string" + } + }, + "DictionaryWithReference": { + "description": "This is a string reference", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/ModelWithString" + } + }, + "DictionaryWithArray": { + "description": "This is a complex dictionary", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ModelWithString" } - }, - "additionalProperties": false + } }, - "WindowsParameters": { + "DictionaryWithDictionary": { + "description": "This is a string dictionary", "type": "object", - "additionalProperties": false - }, - "IdentityProviderParameters": { - "type": "object", - "oneOf": [ - { - "$ref": "#/components/schemas/OpenIdParameters" - }, - { - "$ref": "#/components/schemas/SamlParameters" - }, - { - "$ref": "#/components/schemas/LdapParameters" - }, - { - "$ref": "#/components/schemas/WindowsParameters" + "additionalProperties": { + "type": "object", + "additionalProperties": { + "type": "string" } - ], - "additionalProperties": false + } }, - "ApplicationLink": { + "DictionaryWithProperties": { + "description": "This is a complex dictionary", "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string", - "nullable": true, - "readOnly": true - } - }, - "additionalProperties": false - }, - "ApiResourceLink": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string", - "nullable": true, - "readOnly": true - } - }, - "additionalProperties": false - }, - "ApiResourceRoleLink": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string", - "nullable": true, - "readOnly": true - } - }, - "additionalProperties": false - }, - "ClaimBasedAccessControlEntry": { - "type": "object", - "properties": { - "claimType": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "claimValue": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "applications": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApplicationLink" - }, - "nullable": true - }, - "apiResources": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceLink" - }, - "nullable": true - }, - "apiResourceRoles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceRoleLink" - }, - "nullable": true - } - }, - "additionalProperties": false - }, - "IdentityProvider": { - "required": [ - "key", - "name", - "parameters", - "type" - ], - "type": "object", - "properties": { - "key": { - "maxLength": 64, - "pattern": "^[a-zA-Z0-9_]*$", - "type": "string", - "nullable": true - }, - "name": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "isEnabled": { - "type": "boolean", - "default": true - }, - "description": { - "maxLength": 2048, - "type": "string", - "nullable": true - }, - "type": { - "$ref": "#/components/schemas/IdentityProviderType" - }, - "iconUrl": { - "type": "string", - "nullable": true - }, - "iconViewUrl": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "accessControlList": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ClaimBasedAccessControlEntry" - }, - "nullable": true - }, - "forwardedClaims": { - "type": "array", - "items": { + "additionalProperties": { + "type": "object", + "properties": { + "foo": { "type": "string" }, - "nullable": true - }, - "parameters": { - "$ref": "#/components/schemas/IdentityProviderParameters" - }, - "redirectUrl": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "postLogoutRedirectUrl": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "validateUrl": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true + "bar": { + "type": "string" + } } - }, - "additionalProperties": false + } }, - "UserClientSecret": { + "ModelWithInteger": { + "description": "This is a model with one number property", + "type": "object", + "properties": { + "prop": { + "description": "This is a simple number property", + "type": "integer" + } + } + }, + "ModelWithBoolean": { + "description": "This is a model with one boolean property", + "type": "object", + "properties": { + "prop": { + "description": "This is a simple boolean property", + "type": "boolean" + } + } + }, + "ModelWithString": { + "description": "This is a model with one string property", + "type": "object", + "properties": { + "prop": { + "description": "This is a simple string property", + "type": "string" + } + } + }, + "ModelWithEnum": { + "description": "This is a model with one enum", + "type": "object", + "properties": { + "Test": { + "description": "This is a simple enum with strings", + "enum": [ + "Success", + "Warning", + "Error" + ] + } + } + }, + "ModelWithEnumFromDescription": { + "description": "This is a model with one enum", + "type": "object", + "properties": { + "Test": { + "type": "integer", + "description": "Success=1,Warning=2,Error=3" + } + } + }, + "ModelWithReference": { + "description": "This is a model with one property containing a reference", + "type": "object", + "properties": { + "prop": { + "$ref": "#/components/schemas/ModelWithString" + } + } + }, + "ModelWithArray": { + "description": "This is a model with one property containing an array", + "type": "object", + "properties": { + "prop": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ModelWithString" + } + } + } + }, + "ModelWithDictionary": { + "description": "This is a model with one property containing a dictionary", + "type": "object", + "properties": { + "prop": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "ModelLink": { + "description": "This is a model that can have a template??", + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "ModelWithLink": { + "description": "This is a model that can have a template??", + "type": "object", + "properties": { + "prop": { + "$ref": "#/components/schemas/ModelLink[ModelWithString]" + } + } + }, + "ModelWithCircularReference": { + "description": "This is a model with one property containing a circular reference", + "type": "object", + "properties": { + "prop": { + "$ref": "#/components/schemas/ModelWithCircularReference" + } + } + }, + "ModelWithProperties": { + "description": "This is a model with one nested property", + "type": "object", "required": [ - "clientSecret", - "expiresAt" + "required", + "requiredAndReadOnly", + "requiredAndNullable" ], - "type": "object", "properties": { - "clientSecret": { - "maxLength": 4000, + "required": { + "type": "string" + }, + "requiredAndReadOnly": { "type": "string", - "nullable": true, "readOnly": true }, - "clientSecretUnHashed": { + "requiredAndNullable": { "type": "string", - "nullable": true, - "readOnly": true - }, - "expiresAt": { - "type": "string", - "format": "date-time" - }, - "lastLoginAt": { - "type": "string", - "format": "date-time", - "nullable": true, - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true - } - }, - "additionalProperties": false - }, - "ServiceAccountBasedAccessControlEntry": { - "type": "object", - "properties": { - "apiResources": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceLink" - }, "nullable": true }, - "apiResourceRoles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceRoleLink" - }, - "nullable": true + "string": { + "type": "string" + }, + "number": { + "type": "number" + }, + "boolean": { + "type": "boolean" + }, + "reference": { + "$ref": "#/components/schemas/ModelWithString" } - }, - "additionalProperties": false + } }, - "ServiceAccount": { + "ModelWithNestedProperties": { + "description": "This is a model with one nested property", + "type": "object", "required": [ - "name" + "first" ], - "type": "object", "properties": { - "name": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "clientId": { - "type": "string", + "first": { + "type": "object", + "required": [ + "second" + ], + "readOnly": true, "nullable": true, - "readOnly": true - }, - "lastLoginAt": { - "type": "string", - "format": "date-time", - "nullable": true, - "readOnly": true - }, - "clientSecrets": { - "maxLength": 2, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserClientSecret" - }, - "nullable": true, - "readOnly": true - }, - "accessControlEntry": { - "$ref": "#/components/schemas/ServiceAccountBasedAccessControlEntry" - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true + "properties": { + "second": { + "type": "object", + "required": [ + "third" + ], + "readOnly": true, + "nullable": true, + "properties": { + "third": { + "type": "string", + "required": true, + "readOnly": true, + "nullable": true + } + } + } + } } - }, - "additionalProperties": false + } }, - "UserBasedAccessControlEntry": { + "ModelWithDuplicateProperties": { + "description": "This is a model with duplicated properties", "type": "object", "properties": { - "applications": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApplicationLink" - }, - "nullable": true + "prop": { + "$ref": "#/components/schemas/ModelWithString" }, - "apiResources": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceLink" - }, - "nullable": true + "prop": { + "$ref": "#/components/schemas/ModelWithString" }, - "apiResourceRoles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiResourceRoleLink" - }, - "nullable": true + "prop": { + "$ref": "#/components/schemas/ModelWithString" } - }, - "additionalProperties": false + } }, - "User": { - "required": [ - "identityProviderId", - "identityProviderKey", - "name", - "subject" - ], + "ModelWithDuplicateImports": { + "description": "This is a model with duplicated imports", "type": "object", "properties": { - "name": { - "maxLength": 256, - "type": "string", - "nullable": true + "propA": { + "$ref": "#/components/schemas/ModelWithString" }, - "email": { - "maxLength": 256, - "type": "string", - "format": "email", - "nullable": true + "propB": { + "$ref": "#/components/schemas/ModelWithString" }, - "subject": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "identityProviderId": { - "type": "integer", - "format": "int32" - }, - "identityProviderKey": { - "maxLength": 256, - "type": "string", - "nullable": true - }, - "clientId": { - "type": "string", - "nullable": true, - "readOnly": true - }, - "lastLoginAt": { - "type": "string", - "format": "date-time", - "nullable": true, - "readOnly": true - }, - "clientSecrets": { - "maxLength": 2, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserClientSecret" - }, - "nullable": true, - "readOnly": true - }, - "accessControlEntry": { - "$ref": "#/components/schemas/UserBasedAccessControlEntry" - }, - "createdBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "modifiedBy": { - "type": "integer", - "format": "int32", - "nullable": true, - "readOnly": true - }, - "createdAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "modifiedAt": { - "type": "string", - "format": "date-time", - "readOnly": true - }, - "id": { - "type": "integer", - "format": "int32", - "readOnly": true + "propC": { + "$ref": "#/components/schemas/ModelWithString" } - }, - "additionalProperties": false + } + }, + "ModelThatExtends": { + "description": "This is a model that extends another model", + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ModelWithString" + }, + { + "type": "object", + "properties": { + "propExtendsA": { + "type": "string" + }, + "propExtendsB": { + "$ref": "#/components/schemas/ModelWithString" + } + } + } + ] + }, + "ModelThatExtendsExtends": { + "description": "This is a model that extends another model", + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/ModelWithString" + }, + { + "$ref": "#/components/schemas/ModelThatExtends" + }, + { + "type": "object", + "properties": { + "propExtendsC": { + "type": "string" + }, + "propExtendsD": { + "$ref": "#/components/schemas/ModelWithString" + } + } + } + ] } } }