1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/openapi/index.ts

359 lines
9.0 KiB
TypeScript
Raw Normal View History

import { OpenAPIV3 } from 'openapi-types';
import {
adminFeaturesQuerySchema,
addonParameterSchema,
addonSchema,
addonsSchema,
addonTypeSchema,
apiTokenSchema,
apiTokensSchema,
applicationSchema,
applicationsSchema,
2023-03-15 07:37:06 +01:00
batchFeaturesSchema,
changePasswordSchema,
clientApplicationSchema,
clientFeatureSchema,
clientFeaturesQuerySchema,
clientFeaturesSchema,
clientMetricsSchema,
cloneFeatureSchema,
constraintSchema,
contextFieldSchema,
contextFieldsSchema,
createApiTokenSchema,
createFeatureSchema,
createFeatureStrategySchema,
createInvitedUserSchema,
createUserSchema,
dateSchema,
edgeTokenSchema,
emailSchema,
environmentProjectSchema,
environmentSchema,
environmentsProjectSchema,
environmentsSchema,
eventSchema,
eventsSchema,
2023-01-11 16:00:20 +01:00
exportResultSchema,
exportQuerySchema,
featureEnvironmentMetricsSchema,
featureEnvironmentSchema,
featureEventsSchema,
featureMetricsSchema,
featureSchema,
featuresSchema,
featureStrategySchema,
featureStrategySegmentSchema,
featureTagSchema,
featureTypeSchema,
featureTypesSchema,
featureUsageSchema,
featureVariantsSchema,
feedbackSchema,
groupSchema,
groupsSchema,
groupUserModelSchema,
healthCheckSchema,
healthOverviewSchema,
healthReportSchema,
idSchema,
instanceAdminStatsSchema,
legalValueSchema,
loginSchema,
meSchema,
nameSchema,
overrideSchema,
parametersSchema,
passwordSchema,
patchesSchema,
patchSchema,
patSchema,
patsSchema,
permissionSchema,
playgroundConstraintSchema,
playgroundFeatureSchema,
playgroundRequestSchema,
playgroundResponseSchema,
playgroundSegmentSchema,
playgroundStrategySchema,
profileSchema,
projectEnvironmentSchema,
projectSchema,
projectsSchema,
proxyClientSchema,
proxyFeatureSchema,
proxyFeaturesSchema,
publicSignupTokenCreateSchema,
projectStatsSchema,
publicSignupTokenSchema,
publicSignupTokensSchema,
publicSignupTokenUpdateSchema,
pushVariantsSchema,
resetPasswordSchema,
requestsPerSecondSchema,
requestsPerSecondSegmentedSchema,
roleSchema,
sdkContextSchema,
searchEventsSchema,
segmentSchema,
setStrategySortOrderSchema,
setUiConfigSchema,
sortOrderSchema,
splashSchema,
stateSchema,
strategiesSchema,
strategySchema,
2023-03-08 09:07:06 +01:00
tagsBulkAddSchema,
tagSchema,
tagsSchema,
tagTypeSchema,
tagTypesSchema,
tagWithVersionSchema,
tokenUserSchema,
uiConfigSchema,
updateApiTokenSchema,
updateFeatureSchema,
updateFeatureStrategySchema,
updateTagTypeSchema,
updateUserSchema,
upsertContextFieldSchema,
upsertSegmentSchema,
upsertStrategySchema,
userSchema,
usersGroupsBaseSchema,
usersSchema,
usersSearchSchema,
validateEdgeTokensSchema,
validatePasswordSchema,
validateTagTypeSchema,
variantSchema,
variantsSchema,
versionSchema,
projectOverviewSchema,
2023-02-16 08:08:51 +01:00
importTogglesSchema,
importTogglesValidateSchema,
importTogglesValidateItemSchema,
} from './spec';
import { IServerOption } from '../types';
import { mapValues, omitKeys } from '../util';
import { openApiTags } from './util';
import { URL } from 'url';
import apiVersion from '../util/version';
2022-12-21 12:23:44 +01:00
import { maintenanceSchema } from './spec/maintenance-schema';
2023-04-10 09:55:29 +02:00
import { toggleMaintenanceSchema } from './spec/toggle-maintenance-schema';
import { bulkRegistrationSchema } from './spec/bulk-registration-schema';
import { bulkMetricsSchema } from './spec/bulk-metrics-schema';
import { clientMetricsEnvSchema } from './spec/client-metrics-env-schema';
import { updateTagsSchema } from './spec/update-tags-schema';
2023-03-15 07:37:06 +01:00
import { batchStaleSchema } from './spec/batch-stale-schema';
// All schemas in `openapi/spec` should be listed here.
export const schemas = {
adminFeaturesQuerySchema,
addonParameterSchema,
addonSchema,
addonsSchema,
addonTypeSchema,
apiTokenSchema,
apiTokensSchema,
applicationSchema,
applicationsSchema,
2023-03-15 07:37:06 +01:00
batchFeaturesSchema,
batchStaleSchema,
bulkRegistrationSchema,
bulkMetricsSchema,
changePasswordSchema,
clientApplicationSchema,
clientFeatureSchema,
clientFeaturesQuerySchema,
clientFeaturesSchema,
clientMetricsSchema,
clientMetricsEnvSchema,
cloneFeatureSchema,
constraintSchema,
contextFieldSchema,
contextFieldsSchema,
createApiTokenSchema,
createFeatureSchema,
createFeatureStrategySchema,
createInvitedUserSchema,
createUserSchema,
dateSchema,
PublicSignupTokens (#2053) * PublicSignupTokens * bug fix * bug fixes and test * bug fixes and test * bug fixes and test * Add feature flag * tests * tests * Update 20220908093515-add-public-signup-tokens.js Bug Fix * task: use swc instead of ts-jest (#2042) * Add a counter for total number of environments (#1964) * add groupId to gradual rollout template (#2045) * add groupId to gradual rollout template * FMT * Improve tabs UI on smaller devices (#2014) * Improve tabs UI on smaller devices * Improve tabs UI on smaller devices * bug fix * add proper scrollable tabs * removed centered from Tabs (conflicts with scrollable) * PR comments * 4.15.0-beta.10 * Fix broken doc links (#2046) ## What This PR fixes some broken links that have been hanging around in the docs for what seems like a very long time. ## Why As discovered by the link check in #1912, there are a fair few broken links in the docs. Everyone hates broken links because it makes it harder to understand what they were supposed to be pointing at. ## How There are 3 types of links that have been fixed: - Links that should have been internal but were absolute. E.g. `https://docs.getunleash.io/path/article` that should have been `./article.md` - External links that have changed, such as Slack's API description - GitHub links to files that either no longer exist or that have been moved. These links generally pointed to `master`/`main`, meaning they are subject to change. They have been replaced with permalinks pointing to specific commits. ----- * docs: fix slack api doc link * docs: update links in migration guide * docs: fix broken link to ancient feature schema validation * docs: update links to v3 auth hooks * docs: update broken link in the go sdk article * Fix: use permalink for GitHub link * docs: fix wrong google auth link * 4.15.0 * 4.15.1 * docs: update link for symfony sdk (#2048) The doc link appears to have pointed at an address that is no longer reachable. Instead, let's point to the equivalent GitHub link Relates to and closes #2047 * docs: test broken links in website (#1912) The action triggers manually as a first step to test this functionality. In the near future, we might schedule it * Schedule link checker action (#2050) Runs at 12:30 UTC on Mon, Tue, Wed, Thu and Fri * fix: add env and project labels to feature updated metrics. (#2043) * Revert workflow (#2051) * update snapshot * PR comments * Added Events and tests * Throw error if token not found Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: Thomas Heartman <thomas@getunleash.ai> Co-authored-by: Gastón Fournier <gaston@getunleash.ai> Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com> Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-09-14 14:29:12 +02:00
edgeTokenSchema,
emailSchema,
environmentSchema,
environmentProjectSchema,
environmentsSchema,
environmentsProjectSchema,
eventSchema,
eventsSchema,
2023-01-11 16:00:20 +01:00
exportResultSchema,
exportQuerySchema,
featureEnvironmentMetricsSchema,
featureEnvironmentSchema,
featureEventsSchema,
featureMetricsSchema,
featureSchema,
featuresSchema,
featureStrategySchema,
featureStrategySegmentSchema,
featureTagSchema,
featureTypeSchema,
featureTypesSchema,
featureUsageSchema,
featureVariantsSchema,
feedbackSchema,
groupSchema,
groupsSchema,
groupUserModelSchema,
healthCheckSchema,
healthOverviewSchema,
healthReportSchema,
idSchema,
instanceAdminStatsSchema,
legalValueSchema,
loginSchema,
2022-12-21 12:23:44 +01:00
maintenanceSchema,
2023-04-10 09:55:29 +02:00
toggleMaintenanceSchema,
meSchema,
nameSchema,
overrideSchema,
parametersSchema,
passwordSchema,
patchesSchema,
patchSchema,
patSchema,
patsSchema,
permissionSchema,
feat(#1873/playground): Return detailed information on feature toggle evaluation (#1839) * Feat: return reasons why a feature evaluated to true or false Note: this is very rough and just straight ripped from the nodejs client. It will need a lot of work, but is a good place to start * Feat: add suggested shape for new payload * Chore: minor cleanup * Wip: make server compile again * Remove unused schema ref * Export new schemas * Chore: fix some tests to use sub property * Fix: fix some tests * Refactor: rename some variables, uncomment some stuff * Add segments type to bootstrap options * Add segments capability to offline feature evaluator * Fix function calls after turning params into an option abject * Feat: test strategy order, etc * Feat: add test to check that all strats are returned correctly * Feat: allow you to include strategy ids in clients * Wip: hook up segments in the offline client. Note: compared to regular clients, they still fail * Feat: add segments validation * Fix: fix test case invariant. * Chore: revert to returning only `boolean` from strategies. This _should_ make it work with custom strategies too 🤞 * Feat: make more properties of the returned feature required * Wip: add some comments and unfinished tests for edge cases * Feat: add `isEnabledInCurrentEnvironment` prop * Feat: consider more strategy failure cases * Feat: test that isenabledinenvironment matches expectations * Feat: add unknown strategies * Fix: fix property access typo * Feat: add unknown strategy for fallback purposes * Feat: test edge case: all unknown strategies * Feat: add custom strategy to arbitrary * Feat: test that features can be true, even if not enabled in env * Chore: add some comments * Wip: fix sdk tests * Remove comments, improve test logging * Feat: add descriptions and examples to playground feature schema * Switch `examples` for `example` * Update schemas with descriptions and examples * Fix: update snapshot * Fix: openapi example * Fix: merge issues * Fix: fix issue where feature evaluation state was wrong * Chore: update openapi spec * Fix: fix broken offline client tests * Refactor: move schemas into separate files * Refactor: remove "reason" for incomplete evaluation. The only instances where evaluation is incomplete is when we don't know what the strategy is. * Refactor: move unleash node client into test and dev dependencies * Wip: further removal of stuff * Chore: remove a bunch of code that we don't use * Chore: remove comment * Chore: remove unused code * Fix: fix some prettier errors * Type parameters in strategies to avoid `any` * Fix: remove commented out code * Feat: make `id` required on playground strategies * Chore: remove redundant type * Fix: remove redundant if and fix fallback evaluation * Refactor: reduce nesting and remove duplication * Fix: remove unused helper function * Refactor: type `parameters` as `unknown` * Chore: remove redundant comment * Refactor: move constraint code into a separate file * Refactor: rename `unleash` -> `feature-evaluator` * Rename class `Unleash` -> `FeatureEvaluator` * Refactor: remove this.ready and sync logic from feature evaluator * Refactor: remove unused code, rename config type * Refactor: remove event emission from the Unleash client * Remove unlistened-for events in feature evaluator * Refactor: make offline client synchronous; remove code * Fix: update openapi snapshot after adding required strategy ids * Feat: change `strategies` format. This commit changes the format of a playground feature's `strategies` properties from a list of strategies to an object with properties `result` and `data`. It looks a bit like this: ```ts type Strategies = { result: boolean | "unknown", data: Strategy[] } ``` The reason is that this allows us to avoid the breaking change that was previously suggested in the PR: `feature.isEnabled` used to be a straight boolean. Then, when we found out we couldn't necessarily evaluate all strategies (custom strats are hard!) we changed it to `boolean | 'unevaluated'`. However, this is confusing on a few levels as the playground results are no longer the same as the SDK would be, nor are they strictly boolean anymore. This change reverts the `isEnabled` functionality to what it was before (so it's always a mirror of what the SDK would show). The equivalent of `feature.isEnabled === 'unevaluated'` now becomes `feature.isEnabled && strategy.result === 'unknown'`. * Fix: Fold long string descriptions over multiple lines. * Fix: update snapshot after adding line breaks to descriptions
2022-08-04 15:41:52 +02:00
playgroundConstraintSchema,
playgroundFeatureSchema,
feat: add playground API post endpoint (#1791) * Chore: add unleash-client dependency * Feat: add openapi specs for basic sdk contexts and playground reqs * Feat: add openapi spec for response * Feat: add openAPI entry for playground endpoint * Fix: remove required 'projects' property that doesn't exist * Refactor: add test placeholders for playground api * Chore: improve openAPI description for playground request * Refactor: align example project names * Fix: update openapi snapshot * Fix: summary -> description; example -> examples * Feat: add fast-check and stub out one test. The test doesn't work yet. * Feat: add test and generator for sdk context schema * Feat: add generators and tests for all new schemas * Feat: test that the same input is returned exactly * Feat: add more tests and more schemas * Refactor: clean up tests some * Refactor: simplify url friendliness check * Refactor: fix types for playground request schema generator * Feat: add bad request test * Fix: make parameters the correct shape in generator * Feat: scaffold out tests for service and endpoint Liberal use of @ts-expect-error * Fix: update snapshot with new model * Add missing appName * wip: stub out some extra tests * Feat: model strategies for testing * Feat: model variant payloads better * Refactor: input params for function * Refactor: use email address for user id generation * Chore: update comment * Wip: start stubbing out e2e tests * Refactor: move tests requiring db to e2e file * Fix: make e2e tests run as expected * Fix: make toggle generator test work as expected * Fix: increase timeout for long-running e2e test * Wip: map toggles test * Wip: test movement and cleanup * Refactor: remove `AllowedStrings` in favor of typeof X[number] * Wip: add e2e tests for the service * Wip: tests in progress * Feat: return fuller variant value * Wip: delete redundant test. Both those tests were testing versions of the same thing, so let's delete one of them * Feat: update openAPI snapshot * Feat: hook up the playground service * Feat: fix test cases for e2e api * Refactor: get rid of _one_ 'as unknown as x' cast * Fix: wait for the client to be ready before we pass it back * Fix: weights go to 1000! * Fix: fix some test assertions, add one more test to be sure * Wip: add some test parameters to hopefully avoid timeouts * Fix: don't init the client if there are no toggles If you don't provide it with any toggles to bootstrap, then the client will never be ready. This avoids that. This adds two ways around it because we'll probably get away with a bit less computation if we don't even try to initialize it. However, we also don't want anyone else to make this mistake. * Chore: modify test params * Feat: use the type system to avoid empty lists for initialization * Refactor: make tests simpler * Feat: test basic context values * Feat: test dynamic context values * Fix: make custom context field test more reliable * Feat: use unique arrays for toggles * Feat: make `appName` required in context * Fix: sdk context schema arbitrary: make appName at least 1 char long * Fix: add a minimum length on appName in the context schema * Fix: fix tests that fail due to new requirements * Fix: update a test: remove variant mapping testing * Fix: fix remaining tests * Feat: rename response.toggles -> response.features * Refactor: avoid single-letter predicate variables * Refactor: extract offlineclient into its own file * Refactor: move arbitraries into separate file * Refactor: move playground requests into util function * Fix: remove duplicate declaration of urlFriendlyString * Chore: update comment * Refactor: align on arbitrary generator naming * Feat: Export single strategy arbitrary
2022-07-12 13:01:10 +02:00
playgroundRequestSchema,
playgroundResponseSchema,
playgroundSegmentSchema,
playgroundStrategySchema,
profileSchema,
projectEnvironmentSchema,
projectSchema,
projectsSchema,
PublicSignupTokens (#2053) * PublicSignupTokens * bug fix * bug fixes and test * bug fixes and test * bug fixes and test * Add feature flag * tests * tests * Update 20220908093515-add-public-signup-tokens.js Bug Fix * task: use swc instead of ts-jest (#2042) * Add a counter for total number of environments (#1964) * add groupId to gradual rollout template (#2045) * add groupId to gradual rollout template * FMT * Improve tabs UI on smaller devices (#2014) * Improve tabs UI on smaller devices * Improve tabs UI on smaller devices * bug fix * add proper scrollable tabs * removed centered from Tabs (conflicts with scrollable) * PR comments * 4.15.0-beta.10 * Fix broken doc links (#2046) ## What This PR fixes some broken links that have been hanging around in the docs for what seems like a very long time. ## Why As discovered by the link check in #1912, there are a fair few broken links in the docs. Everyone hates broken links because it makes it harder to understand what they were supposed to be pointing at. ## How There are 3 types of links that have been fixed: - Links that should have been internal but were absolute. E.g. `https://docs.getunleash.io/path/article` that should have been `./article.md` - External links that have changed, such as Slack's API description - GitHub links to files that either no longer exist or that have been moved. These links generally pointed to `master`/`main`, meaning they are subject to change. They have been replaced with permalinks pointing to specific commits. ----- * docs: fix slack api doc link * docs: update links in migration guide * docs: fix broken link to ancient feature schema validation * docs: update links to v3 auth hooks * docs: update broken link in the go sdk article * Fix: use permalink for GitHub link * docs: fix wrong google auth link * 4.15.0 * 4.15.1 * docs: update link for symfony sdk (#2048) The doc link appears to have pointed at an address that is no longer reachable. Instead, let's point to the equivalent GitHub link Relates to and closes #2047 * docs: test broken links in website (#1912) The action triggers manually as a first step to test this functionality. In the near future, we might schedule it * Schedule link checker action (#2050) Runs at 12:30 UTC on Mon, Tue, Wed, Thu and Fri * fix: add env and project labels to feature updated metrics. (#2043) * Revert workflow (#2051) * update snapshot * PR comments * Added Events and tests * Throw error if token not found Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: Thomas Heartman <thomas@getunleash.ai> Co-authored-by: Gastón Fournier <gaston@getunleash.ai> Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com> Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-09-14 14:29:12 +02:00
proxyClientSchema,
proxyFeatureSchema,
proxyFeaturesSchema,
publicSignupTokenCreateSchema,
publicSignupTokenSchema,
publicSignupTokensSchema,
publicSignupTokenUpdateSchema,
pushVariantsSchema,
projectStatsSchema,
resetPasswordSchema,
requestsPerSecondSchema,
requestsPerSecondSegmentedSchema,
roleSchema,
feat: add playground API post endpoint (#1791) * Chore: add unleash-client dependency * Feat: add openapi specs for basic sdk contexts and playground reqs * Feat: add openapi spec for response * Feat: add openAPI entry for playground endpoint * Fix: remove required 'projects' property that doesn't exist * Refactor: add test placeholders for playground api * Chore: improve openAPI description for playground request * Refactor: align example project names * Fix: update openapi snapshot * Fix: summary -> description; example -> examples * Feat: add fast-check and stub out one test. The test doesn't work yet. * Feat: add test and generator for sdk context schema * Feat: add generators and tests for all new schemas * Feat: test that the same input is returned exactly * Feat: add more tests and more schemas * Refactor: clean up tests some * Refactor: simplify url friendliness check * Refactor: fix types for playground request schema generator * Feat: add bad request test * Fix: make parameters the correct shape in generator * Feat: scaffold out tests for service and endpoint Liberal use of @ts-expect-error * Fix: update snapshot with new model * Add missing appName * wip: stub out some extra tests * Feat: model strategies for testing * Feat: model variant payloads better * Refactor: input params for function * Refactor: use email address for user id generation * Chore: update comment * Wip: start stubbing out e2e tests * Refactor: move tests requiring db to e2e file * Fix: make e2e tests run as expected * Fix: make toggle generator test work as expected * Fix: increase timeout for long-running e2e test * Wip: map toggles test * Wip: test movement and cleanup * Refactor: remove `AllowedStrings` in favor of typeof X[number] * Wip: add e2e tests for the service * Wip: tests in progress * Feat: return fuller variant value * Wip: delete redundant test. Both those tests were testing versions of the same thing, so let's delete one of them * Feat: update openAPI snapshot * Feat: hook up the playground service * Feat: fix test cases for e2e api * Refactor: get rid of _one_ 'as unknown as x' cast * Fix: wait for the client to be ready before we pass it back * Fix: weights go to 1000! * Fix: fix some test assertions, add one more test to be sure * Wip: add some test parameters to hopefully avoid timeouts * Fix: don't init the client if there are no toggles If you don't provide it with any toggles to bootstrap, then the client will never be ready. This avoids that. This adds two ways around it because we'll probably get away with a bit less computation if we don't even try to initialize it. However, we also don't want anyone else to make this mistake. * Chore: modify test params * Feat: use the type system to avoid empty lists for initialization * Refactor: make tests simpler * Feat: test basic context values * Feat: test dynamic context values * Fix: make custom context field test more reliable * Feat: use unique arrays for toggles * Feat: make `appName` required in context * Fix: sdk context schema arbitrary: make appName at least 1 char long * Fix: add a minimum length on appName in the context schema * Fix: fix tests that fail due to new requirements * Fix: update a test: remove variant mapping testing * Fix: fix remaining tests * Feat: rename response.toggles -> response.features * Refactor: avoid single-letter predicate variables * Refactor: extract offlineclient into its own file * Refactor: move arbitraries into separate file * Refactor: move playground requests into util function * Fix: remove duplicate declaration of urlFriendlyString * Chore: update comment * Refactor: align on arbitrary generator naming * Feat: Export single strategy arbitrary
2022-07-12 13:01:10 +02:00
sdkContextSchema,
searchEventsSchema,
segmentSchema,
setStrategySortOrderSchema,
setUiConfigSchema,
sortOrderSchema,
splashSchema,
stateSchema,
strategiesSchema,
strategySchema,
2023-03-08 09:07:06 +01:00
tagsBulkAddSchema,
tagSchema,
tagsSchema,
tagTypeSchema,
tagTypesSchema,
tagWithVersionSchema,
tokenUserSchema,
uiConfigSchema,
updateApiTokenSchema,
updateFeatureSchema,
updateFeatureStrategySchema,
updateTagTypeSchema,
updateUserSchema,
updateTagsSchema,
upsertContextFieldSchema,
upsertSegmentSchema,
upsertStrategySchema,
userSchema,
usersGroupsBaseSchema,
usersSchema,
usersSearchSchema,
validateEdgeTokensSchema,
validatePasswordSchema,
validateTagTypeSchema,
variantSchema,
variantsSchema,
versionSchema,
projectOverviewSchema,
2023-02-16 08:08:51 +01:00
importTogglesSchema,
importTogglesValidateSchema,
importTogglesValidateItemSchema,
};
// Schemas must have an $id property on the form "#/components/schemas/mySchema".
export type SchemaId = typeof schemas[keyof typeof schemas]['$id'];
// Schemas must list all their $refs in `components`, including nested schemas.
export type SchemaRef = typeof schemas[keyof typeof schemas]['components'];
// JSON schema properties that should not be included in the OpenAPI spec.
export interface JsonSchemaProps {
$id: string;
components: object;
}
// Remove JSONSchema keys that would result in an invalid OpenAPI spec.
export const removeJsonSchemaProps = <T extends JsonSchemaProps>(
schema: T,
): OpenAPIV3.SchemaObject => {
return omitKeys(schema, '$id', 'components');
};
const findRootUrl: (unleashUrl: string, baseUriPath: string) => string = (
unleashUrl: string,
baseUriPath?: string,
) => {
if (!baseUriPath) {
return unleashUrl;
}
const baseUrl = new URL(unleashUrl);
if (baseUrl.pathname.indexOf(baseUriPath) >= 0) {
return `${baseUrl.protocol}//${baseUrl.host}`;
}
return baseUrl.toString();
};
export const createOpenApiSchema = ({
unleashUrl,
baseUriPath,
}: Pick<IServerOption, 'unleashUrl' | 'baseUriPath'>): Omit<
OpenAPIV3.Document,
'paths'
> => {
const url = findRootUrl(unleashUrl, baseUriPath);
return {
openapi: '3.0.3',
servers: url ? [{ url }] : [],
info: {
title: 'Unleash API',
version: apiVersion,
},
security: [{ apiKey: [] }],
components: {
securitySchemes: {
apiKey: {
type: 'apiKey',
in: 'header',
name: 'Authorization',
},
},
schemas: mapValues(schemas, removeJsonSchemaProps),
},
tags: openApiTags,
};
};
export * from './util';
export * from './spec';