@scalar/oas-utils 0.2.42 → 0.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/diff/diff.d.ts +13 -0
- package/dist/diff/diff.d.ts.map +1 -0
- package/dist/diff/index.d.ts +1 -0
- package/dist/diff/index.d.ts.map +1 -0
- package/dist/diff/index.js +1 -0
- package/dist/entities/{workspace/cookie → cookie}/cookie.d.ts +1 -17
- package/dist/entities/cookie/cookie.d.ts.map +1 -0
- package/dist/entities/{workspace/cookie → cookie}/cookie.js +1 -4
- package/dist/entities/cookie/index.d.ts.map +1 -0
- package/dist/entities/cookie/index.js +1 -0
- package/dist/entities/environment/environment.d.ts +24 -0
- package/dist/entities/environment/environment.d.ts.map +1 -0
- package/dist/entities/environment/environment.js +12 -0
- package/dist/entities/environment/index.d.ts.map +1 -0
- package/dist/entities/environment/index.js +1 -0
- package/dist/entities/{workspace/consts/hot-keys.d.ts → hotkeys/hotkeys.d.ts} +2 -2
- package/dist/entities/hotkeys/hotkeys.d.ts.map +1 -0
- package/dist/entities/{workspace/consts/hot-keys.js → hotkeys/hotkeys.js} +1 -0
- package/dist/entities/hotkeys/index.d.ts +2 -0
- package/dist/entities/hotkeys/index.d.ts.map +1 -0
- package/dist/entities/hotkeys/index.js +1 -0
- package/dist/entities/index.d.ts +1 -1
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +1 -1
- package/dist/entities/shared/index.d.ts.map +1 -0
- package/dist/entities/shared/utility.d.ts.map +1 -0
- package/dist/entities/spec/collection.d.ts +489 -0
- package/dist/entities/spec/collection.d.ts.map +1 -0
- package/dist/entities/spec/collection.js +63 -0
- package/dist/entities/spec/index.d.ts +10 -0
- package/dist/entities/spec/index.d.ts.map +1 -0
- package/dist/entities/spec/index.js +7 -0
- package/dist/entities/spec/parameters.d.ts +42 -0
- package/dist/entities/spec/parameters.d.ts.map +1 -0
- package/dist/entities/spec/parameters.js +30 -0
- package/dist/entities/spec/request-examples.d.ts +915 -0
- package/dist/entities/spec/request-examples.d.ts.map +1 -0
- package/dist/entities/spec/request-examples.js +168 -0
- package/dist/entities/spec/requests.d.ts +317 -0
- package/dist/entities/spec/requests.d.ts.map +1 -0
- package/dist/entities/{workspace/spec → spec}/requests.js +56 -32
- package/dist/entities/spec/security.d.ts +964 -0
- package/dist/entities/spec/security.d.ts.map +1 -0
- package/dist/entities/spec/security.js +222 -0
- package/dist/entities/spec/server.d.ts +82 -0
- package/dist/entities/spec/server.d.ts.map +1 -0
- package/dist/entities/{workspace/server → spec}/server.js +11 -13
- package/dist/entities/spec/spec-objects.d.ts +279 -0
- package/dist/entities/spec/spec-objects.d.ts.map +1 -0
- package/dist/entities/{workspace/collection/collection.js → spec/spec-objects.js} +21 -45
- package/dist/entities/workspace/index.js +1 -1
- package/dist/entities/workspace/workspace.d.ts +24 -43
- package/dist/entities/workspace/workspace.d.ts.map +1 -1
- package/dist/entities/workspace/workspace.js +6 -7
- package/dist/helpers/httpMethods.d.ts +16 -82
- package/dist/helpers/httpMethods.d.ts.map +1 -1
- package/dist/helpers/httpMethods.js +45 -41
- package/dist/helpers/index.d.ts +2 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +4 -2
- package/dist/helpers/local-storage.d.ts +16 -0
- package/dist/helpers/local-storage.d.ts.map +1 -0
- package/dist/helpers/local-storage.js +17 -0
- package/dist/helpers/redirectToProxy.d.ts +2 -0
- package/dist/helpers/redirectToProxy.d.ts.map +1 -1
- package/dist/helpers/redirectToProxy.js +6 -7
- package/dist/helpers/regexHelpers.d.ts +2 -0
- package/dist/helpers/regexHelpers.d.ts.map +1 -0
- package/dist/helpers/regexHelpers.js +3 -0
- package/dist/helpers/schema-model.d.ts +2 -2
- package/dist/helpers/schema-model.d.ts.map +1 -1
- package/dist/helpers/schema-model.js +11 -17
- package/dist/migrations/data-version.d.ts +12 -0
- package/dist/migrations/data-version.d.ts.map +1 -0
- package/dist/migrations/data-version.js +13 -0
- package/dist/migrations/generate-types.d.ts +2 -0
- package/dist/migrations/generate-types.d.ts.map +1 -0
- package/dist/migrations/index.d.ts +4 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +3 -0
- package/dist/migrations/local-storage.d.ts +8 -0
- package/dist/migrations/local-storage.d.ts.map +1 -0
- package/dist/migrations/local-storage.js +36 -0
- package/dist/migrations/migrator.d.ts +4 -0
- package/dist/migrations/migrator.d.ts.map +1 -0
- package/dist/migrations/migrator.js +40 -0
- package/dist/migrations/semver.d.ts +5 -0
- package/dist/migrations/semver.d.ts.map +1 -0
- package/dist/migrations/semver.js +25 -0
- package/dist/migrations/v-0.0.0/index.d.ts +2 -0
- package/dist/migrations/v-0.0.0/index.d.ts.map +1 -0
- package/dist/migrations/v-0.0.0/index.js +1 -0
- package/dist/migrations/v-0.0.0/types.generated.d.ts +347 -0
- package/dist/migrations/v-0.0.0/types.generated.d.ts.map +1 -0
- package/dist/migrations/v-2.1.0/index.d.ts +3 -0
- package/dist/migrations/v-2.1.0/index.d.ts.map +1 -0
- package/dist/migrations/v-2.1.0/index.js +1 -0
- package/dist/migrations/v-2.1.0/migration.d.ts +334 -0
- package/dist/migrations/v-2.1.0/migration.d.ts.map +1 -0
- package/dist/migrations/v-2.1.0/migration.js +249 -0
- package/dist/migrations/v-2.1.0/types.generated.d.ts +42 -0
- package/dist/migrations/v-2.1.0/types.generated.d.ts.map +1 -0
- package/dist/spec-getters/getExampleFromSchema.d.ts.map +1 -1
- package/dist/spec-getters/getExampleFromSchema.js +21 -8
- package/dist/spec-getters/getParametersFromOperation.d.ts +1 -1
- package/dist/spec-getters/getParametersFromOperation.d.ts.map +1 -1
- package/dist/spec-getters/getParametersFromOperation.js +8 -7
- package/dist/spec-getters/getRequestBodyFromOperation.d.ts +12 -40
- package/dist/spec-getters/getRequestBodyFromOperation.d.ts.map +1 -1
- package/dist/spec-getters/getRequestBodyFromOperation.js +34 -23
- package/dist/spec-getters/getRequestFromOperation.d.ts.map +1 -1
- package/dist/spec-getters/getRequestFromOperation.js +1 -2
- package/dist/spec-getters/getServerVariableExamples.d.ts +4 -0
- package/dist/spec-getters/getServerVariableExamples.d.ts.map +1 -0
- package/dist/spec-getters/getServerVariableExamples.js +12 -0
- package/dist/spec-getters/index.d.ts +1 -0
- package/dist/spec-getters/index.d.ts.map +1 -1
- package/dist/spec-getters/index.js +1 -0
- package/dist/transforms/export-spec.d.ts +68 -0
- package/dist/transforms/export-spec.d.ts.map +1 -0
- package/dist/transforms/import-spec.d.ts +20 -68
- package/dist/transforms/import-spec.d.ts.map +1 -1
- package/dist/transforms/import-spec.js +209 -126
- package/package.json +43 -37
- package/dist/entities/workspace/collection/collection.d.ts +0 -330
- package/dist/entities/workspace/collection/collection.d.ts.map +0 -1
- package/dist/entities/workspace/collection/index.d.ts +0 -2
- package/dist/entities/workspace/collection/index.d.ts.map +0 -1
- package/dist/entities/workspace/collection/index.js +0 -1
- package/dist/entities/workspace/consts/hot-keys.d.ts.map +0 -1
- package/dist/entities/workspace/consts/index.d.ts +0 -2
- package/dist/entities/workspace/consts/index.d.ts.map +0 -1
- package/dist/entities/workspace/consts/index.js +0 -1
- package/dist/entities/workspace/cookie/cookie.d.ts.map +0 -1
- package/dist/entities/workspace/cookie/index.d.ts.map +0 -1
- package/dist/entities/workspace/cookie/index.js +0 -1
- package/dist/entities/workspace/environment/environment.d.ts +0 -55
- package/dist/entities/workspace/environment/environment.d.ts.map +0 -1
- package/dist/entities/workspace/environment/environment.js +0 -23
- package/dist/entities/workspace/environment/index.d.ts.map +0 -1
- package/dist/entities/workspace/environment/index.js +0 -1
- package/dist/entities/workspace/folder/folder.d.ts +0 -36
- package/dist/entities/workspace/folder/folder.d.ts.map +0 -1
- package/dist/entities/workspace/folder/folder.js +0 -21
- package/dist/entities/workspace/folder/index.d.ts +0 -2
- package/dist/entities/workspace/folder/index.d.ts.map +0 -1
- package/dist/entities/workspace/folder/index.js +0 -1
- package/dist/entities/workspace/security/index.d.ts +0 -3
- package/dist/entities/workspace/security/index.d.ts.map +0 -1
- package/dist/entities/workspace/security/index.js +0 -2
- package/dist/entities/workspace/security/security-requirement.d.ts +0 -13
- package/dist/entities/workspace/security/security-requirement.d.ts.map +0 -1
- package/dist/entities/workspace/security/security-requirement.js +0 -15
- package/dist/entities/workspace/security/security-schemes.d.ts +0 -696
- package/dist/entities/workspace/security/security-schemes.d.ts.map +0 -1
- package/dist/entities/workspace/security/security-schemes.js +0 -139
- package/dist/entities/workspace/server/index.d.ts +0 -2
- package/dist/entities/workspace/server/index.d.ts.map +0 -1
- package/dist/entities/workspace/server/index.js +0 -1
- package/dist/entities/workspace/server/server.d.ts +0 -91
- package/dist/entities/workspace/server/server.d.ts.map +0 -1
- package/dist/entities/workspace/shared/index.d.ts.map +0 -1
- package/dist/entities/workspace/shared/utility.d.ts.map +0 -1
- package/dist/entities/workspace/spec/components.d.ts +0 -3
- package/dist/entities/workspace/spec/components.d.ts.map +0 -1
- package/dist/entities/workspace/spec/index.d.ts +0 -5
- package/dist/entities/workspace/spec/index.d.ts.map +0 -1
- package/dist/entities/workspace/spec/index.js +0 -2
- package/dist/entities/workspace/spec/parameters.d.ts +0 -16
- package/dist/entities/workspace/spec/parameters.d.ts.map +0 -1
- package/dist/entities/workspace/spec/refs.d.ts +0 -30
- package/dist/entities/workspace/spec/refs.d.ts.map +0 -1
- package/dist/entities/workspace/spec/refs.js +0 -9
- package/dist/entities/workspace/spec/request-examples.d.ts +0 -1573
- package/dist/entities/workspace/spec/request-examples.d.ts.map +0 -1
- package/dist/entities/workspace/spec/request-examples.js +0 -96
- package/dist/entities/workspace/spec/requests.d.ts +0 -181
- package/dist/entities/workspace/spec/requests.d.ts.map +0 -1
- package/dist/entities/workspace/spec/spec.d.ts +0 -18
- package/dist/entities/workspace/spec/spec.d.ts.map +0 -1
- package/dist/entities/workspace/spec/spec.js +0 -8
- /package/dist/entities/{workspace/cookie → cookie}/index.d.ts +0 -0
- /package/dist/entities/{workspace/environment → environment}/index.d.ts +0 -0
- /package/dist/entities/{workspace/shared → shared}/index.d.ts +0 -0
- /package/dist/entities/{workspace/shared → shared}/index.js +0 -0
- /package/dist/entities/{workspace/shared → shared}/utility.d.ts +0 -0
- /package/dist/entities/{workspace/shared → shared}/utility.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/security.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { nanoidSchema } from '../shared/utility.js';
|
|
3
|
+
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Collection values for Security Schemes
|
|
6
|
+
const apiKeyExampleSchema = z.object({
|
|
7
|
+
type: z.literal('apiKey').default('apiKey'),
|
|
8
|
+
name: z.string().default(''),
|
|
9
|
+
value: z.string().default(''),
|
|
10
|
+
});
|
|
11
|
+
const httpExampleSchema = z.object({
|
|
12
|
+
type: z.literal('http').default('http'),
|
|
13
|
+
username: z.string().default(''),
|
|
14
|
+
password: z.string().default(''),
|
|
15
|
+
token: z.string().default(''),
|
|
16
|
+
});
|
|
17
|
+
const oauthImplicitExampleSchema = z.object({
|
|
18
|
+
type: z.literal('oauth-implicit').default('oauth-implicit'),
|
|
19
|
+
token: z.string().default(''),
|
|
20
|
+
});
|
|
21
|
+
const oauthPasswordExampleSchema = z.object({
|
|
22
|
+
type: z.literal('oauth-password').default('oauth-password'),
|
|
23
|
+
token: z.string().default(''),
|
|
24
|
+
username: z.string().default(''),
|
|
25
|
+
password: z.string().default(''),
|
|
26
|
+
clientSecret: z.string().default(''),
|
|
27
|
+
});
|
|
28
|
+
const oauthClientCredentialsExampleSchema = z.object({
|
|
29
|
+
type: z.literal('oauth-clientCredentials').default('oauth-clientCredentials'),
|
|
30
|
+
token: z.string().default(''),
|
|
31
|
+
clientSecret: z.string().default(''),
|
|
32
|
+
});
|
|
33
|
+
const oauthAuthorizationCodeExampleSchema = z.object({
|
|
34
|
+
type: z.literal('oauth-authorizationCode').default('oauth-authorizationCode'),
|
|
35
|
+
token: z.string().default(''),
|
|
36
|
+
clientSecret: z.string().default(''),
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Value schema for each type of OAuth Flow
|
|
40
|
+
* Request Examples can store populated values for a given security scheme
|
|
41
|
+
*/
|
|
42
|
+
const securitySchemeExampleValueSchema = z.union([
|
|
43
|
+
apiKeyExampleSchema,
|
|
44
|
+
httpExampleSchema,
|
|
45
|
+
oauthImplicitExampleSchema,
|
|
46
|
+
oauthPasswordExampleSchema,
|
|
47
|
+
oauthClientCredentialsExampleSchema,
|
|
48
|
+
oauthAuthorizationCodeExampleSchema,
|
|
49
|
+
]);
|
|
50
|
+
/**
|
|
51
|
+
* Generates a base set of example data for a given securityScheme
|
|
52
|
+
*
|
|
53
|
+
* TODO: we can probably remove this unless we really want to keep it separate
|
|
54
|
+
*/
|
|
55
|
+
function authExampleFromSchema(scheme, baseValues = {}) {
|
|
56
|
+
if (scheme.type === 'apiKey')
|
|
57
|
+
return apiKeyExampleSchema.parse({ name: scheme.name, ...baseValues });
|
|
58
|
+
if (scheme.type === 'http')
|
|
59
|
+
return httpExampleSchema.parse(baseValues);
|
|
60
|
+
if (scheme.type === 'oauth2') {
|
|
61
|
+
if (scheme.flow.type === 'authorizationCode')
|
|
62
|
+
return oauthAuthorizationCodeExampleSchema.parse(baseValues);
|
|
63
|
+
if (scheme.flow.type === 'clientCredentials')
|
|
64
|
+
return oauthClientCredentialsExampleSchema.parse(baseValues);
|
|
65
|
+
if (scheme.flow.type === 'implicit')
|
|
66
|
+
return oauthImplicitExampleSchema.parse(baseValues);
|
|
67
|
+
if (scheme.flow.type === 'password')
|
|
68
|
+
return oauthPasswordExampleSchema.parse(baseValues);
|
|
69
|
+
}
|
|
70
|
+
throw Error('INVALID SCHEMA FOR OAUTH EXAMPLE');
|
|
71
|
+
}
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// COMMON PROPS FOR ALL SECURITY SCHEMES
|
|
74
|
+
/** Some common properties used in all security schemes */
|
|
75
|
+
const commonProps = z.object({
|
|
76
|
+
/* A description for security scheme. CommonMark syntax MAY be used for rich text representation. */
|
|
77
|
+
description: z.string().optional(),
|
|
78
|
+
});
|
|
79
|
+
const extendedSecuritySchema = z.object({
|
|
80
|
+
uid: nanoidSchema,
|
|
81
|
+
/** The name key that links a security requirement to a security object */
|
|
82
|
+
nameKey: z.string().optional().default(''),
|
|
83
|
+
});
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
// API KEY
|
|
86
|
+
const securitySchemeApiKeyIn = ['query', 'header', 'cookie'];
|
|
87
|
+
const oasSecuritySchemeApiKey = commonProps.extend({
|
|
88
|
+
type: z.literal('apiKey'),
|
|
89
|
+
/** REQUIRED. The name of the header, query or cookie parameter to be used. */
|
|
90
|
+
name: z.string().optional().default(''),
|
|
91
|
+
/** REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie". */
|
|
92
|
+
in: z.enum(securitySchemeApiKeyIn).optional().default('header'),
|
|
93
|
+
});
|
|
94
|
+
const securityApiKeySchema = oasSecuritySchemeApiKey.merge(extendedSecuritySchema);
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
// HTTP
|
|
97
|
+
const oasSecuritySchemeHttp = commonProps.extend({
|
|
98
|
+
type: z.literal('http'),
|
|
99
|
+
/**
|
|
100
|
+
* REQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header as defined in
|
|
101
|
+
* [RFC7235]. The values used SHOULD be registered in the IANA Authentication Scheme registry.
|
|
102
|
+
*/
|
|
103
|
+
scheme: z.enum(['basic', 'bearer']).optional().default('basic'),
|
|
104
|
+
/**
|
|
105
|
+
* A hint to the client to identify how the bearer token is formatted.
|
|
106
|
+
* Bearer tokens are usually generated by an authorization server, so
|
|
107
|
+
* this information is primarily for documentation purposes.
|
|
108
|
+
*/
|
|
109
|
+
bearerFormat: z
|
|
110
|
+
.union([z.literal('JWT'), z.string()])
|
|
111
|
+
.optional()
|
|
112
|
+
.default('JWT'),
|
|
113
|
+
});
|
|
114
|
+
const securityHttpSchema = oasSecuritySchemeHttp.merge(extendedSecuritySchema);
|
|
115
|
+
// ---------------------------------------------------------------------------
|
|
116
|
+
// OPENID CONNECT
|
|
117
|
+
const oasSecuritySchemeOpenId = commonProps.extend({
|
|
118
|
+
type: z.literal('openIdConnect'),
|
|
119
|
+
/**
|
|
120
|
+
* REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the
|
|
121
|
+
* form of a URL. The OpenID Connect standard requires the use of TLS.
|
|
122
|
+
*/
|
|
123
|
+
openIdConnectUrl: z.string().optional().default(''),
|
|
124
|
+
});
|
|
125
|
+
const securityOpenIdSchema = oasSecuritySchemeOpenId.merge(extendedSecuritySchema);
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
/**
|
|
128
|
+
* REQUIRED. The authorization URL to be used for this flow. This MUST be in
|
|
129
|
+
* the form of a URL. The OAuth2 standard requires the use of TLS.
|
|
130
|
+
*/
|
|
131
|
+
const authorizationUrl = z.string().default('');
|
|
132
|
+
/**
|
|
133
|
+
* REQUIRED. The token URL to be used for this flow. This MUST be in the
|
|
134
|
+
* form of a URL. The OAuth2 standard requires the use of TLS.
|
|
135
|
+
*/
|
|
136
|
+
const tokenUrl = z.string().default('');
|
|
137
|
+
/** Common properties used across all oauth2 flows */
|
|
138
|
+
const oauthCommon = z.object({
|
|
139
|
+
/**
|
|
140
|
+
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a
|
|
141
|
+
* URL. The OAuth2 standard requires the use of TLS.
|
|
142
|
+
*/
|
|
143
|
+
refreshUrl: z.string().optional().default(''),
|
|
144
|
+
/**
|
|
145
|
+
* REQUIRED. The available scopes for the OAuth2 security scheme. A map
|
|
146
|
+
* between the scope name and a short description for it. The map MAY be empty.
|
|
147
|
+
*/
|
|
148
|
+
scopes: z
|
|
149
|
+
.union([
|
|
150
|
+
z.map(z.string(), z.string().optional()),
|
|
151
|
+
z.record(z.string(), z.string().optional()),
|
|
152
|
+
z.object({}),
|
|
153
|
+
])
|
|
154
|
+
.optional()
|
|
155
|
+
.default({}),
|
|
156
|
+
selectedScopes: z.array(z.string()).optional().default([]),
|
|
157
|
+
});
|
|
158
|
+
const oasOauthFlowSchema = z
|
|
159
|
+
.discriminatedUnion('type', [
|
|
160
|
+
/** Configuration for the OAuth Implicit flow */
|
|
161
|
+
oauthCommon.extend({
|
|
162
|
+
'type': z.literal('implicit'),
|
|
163
|
+
authorizationUrl,
|
|
164
|
+
'x-scalar-redirect-uri': z.string().optional().default(''),
|
|
165
|
+
}),
|
|
166
|
+
/** Configuration for the OAuth Resource Owner Password flow */
|
|
167
|
+
oauthCommon.extend({
|
|
168
|
+
type: z.literal('password'),
|
|
169
|
+
tokenUrl,
|
|
170
|
+
}),
|
|
171
|
+
/** Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. */
|
|
172
|
+
oauthCommon.extend({
|
|
173
|
+
type: z.literal('clientCredentials'),
|
|
174
|
+
tokenUrl,
|
|
175
|
+
}),
|
|
176
|
+
/** Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.*/
|
|
177
|
+
oauthCommon.extend({
|
|
178
|
+
'type': z.literal('authorizationCode'),
|
|
179
|
+
authorizationUrl,
|
|
180
|
+
'x-scalar-redirect-uri': z.string().optional().default(''),
|
|
181
|
+
tokenUrl,
|
|
182
|
+
}),
|
|
183
|
+
])
|
|
184
|
+
.optional()
|
|
185
|
+
.default({ type: 'implicit', authorizationUrl: 'http://localhost:8080' });
|
|
186
|
+
const oasSecuritySchemeOauth2 = commonProps.extend({
|
|
187
|
+
'type': z.literal('oauth2'),
|
|
188
|
+
/** REQUIRED. An object containing configuration information for the flow types supported. */
|
|
189
|
+
'flow': oasOauthFlowSchema,
|
|
190
|
+
/** Extension to save the client Id associated with an oauth flow */
|
|
191
|
+
'x-scalar-client-id': z.string().optional().default(''),
|
|
192
|
+
});
|
|
193
|
+
const securityOauthSchema = oasSecuritySchemeOauth2.merge(extendedSecuritySchema);
|
|
194
|
+
// ---------------------------------------------------------------------------
|
|
195
|
+
// Final Types
|
|
196
|
+
/**
|
|
197
|
+
* Security Requirement
|
|
198
|
+
* Lists the required security schemes to execute this operation OR the whole collection/spec.
|
|
199
|
+
* The name used for each property MUST correspond to a security scheme declared in the Security
|
|
200
|
+
* Schemes under the Components Object.
|
|
201
|
+
*
|
|
202
|
+
* The key (name) here will be matched to the key of the securityScheme for linking
|
|
203
|
+
*
|
|
204
|
+
* @see https://spec.openapis.org/oas/latest.html#security-requirement-object
|
|
205
|
+
*/
|
|
206
|
+
const oasSecurityRequirementSchema = z.record(z.string(), z.array(z.string()).optional().default([]));
|
|
207
|
+
/** OAS Compliant security schemes */
|
|
208
|
+
const oasSecuritySchemeSchema = z.union([
|
|
209
|
+
oasSecuritySchemeApiKey,
|
|
210
|
+
oasSecuritySchemeHttp,
|
|
211
|
+
oasSecuritySchemeOauth2,
|
|
212
|
+
oasSecuritySchemeOpenId,
|
|
213
|
+
]);
|
|
214
|
+
/** Extended security schemes for workspace usage */
|
|
215
|
+
const securitySchemeSchema = z.union([
|
|
216
|
+
securityApiKeySchema,
|
|
217
|
+
securityHttpSchema,
|
|
218
|
+
securityOpenIdSchema,
|
|
219
|
+
securityOauthSchema,
|
|
220
|
+
]);
|
|
221
|
+
|
|
222
|
+
export { authExampleFromSchema, oasSecurityRequirementSchema, oasSecuritySchemeSchema, securityApiKeySchema, securityHttpSchema, securityOauthSchema, securityOpenIdSchema, securitySchemeApiKeyIn, securitySchemeExampleValueSchema, securitySchemeSchema };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
2
|
+
import { type ZodSchema, z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Server variables
|
|
5
|
+
* An object representing a Server Variable for server URL template substitution.
|
|
6
|
+
*
|
|
7
|
+
* @see https://spec.openapis.org/oas/v3.1.0#server-variable-object
|
|
8
|
+
*
|
|
9
|
+
* NOTE: Typecase is required to handle enum string array type
|
|
10
|
+
*/
|
|
11
|
+
export declare const oasServerVariableSchema: ZodSchema<Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
12
|
+
enum?: [string, ...string[]];
|
|
13
|
+
}>;
|
|
14
|
+
export declare const oasServerSchema: z.ZodObject<{
|
|
15
|
+
/**
|
|
16
|
+
* REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that
|
|
17
|
+
* the host location is relative to the location where the OpenAPI document is being served. Variable substitutions
|
|
18
|
+
* will be made when a variable is named in {brackets}.
|
|
19
|
+
*/
|
|
20
|
+
url: z.ZodOptional<z.ZodString>;
|
|
21
|
+
/**
|
|
22
|
+
* An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text
|
|
23
|
+
* representation.
|
|
24
|
+
*/
|
|
25
|
+
description: z.ZodOptional<z.ZodString>;
|
|
26
|
+
/** A map between a variable name and its value. The value is used for substitution in the server’s URL template. */
|
|
27
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, ZodSchema<Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
28
|
+
enum?: [string, ...string[]];
|
|
29
|
+
}, z.ZodTypeDef, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
30
|
+
enum?: [string, ...string[]];
|
|
31
|
+
}>>>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
description?: string | undefined;
|
|
34
|
+
url?: string | undefined;
|
|
35
|
+
variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
36
|
+
enum?: [string, ...string[]];
|
|
37
|
+
}> | undefined;
|
|
38
|
+
}, {
|
|
39
|
+
description?: string | undefined;
|
|
40
|
+
url?: string | undefined;
|
|
41
|
+
variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
42
|
+
enum?: [string, ...string[]];
|
|
43
|
+
}> | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
export declare const serverSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
46
|
+
/**
|
|
47
|
+
* REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that
|
|
48
|
+
* the host location is relative to the location where the OpenAPI document is being served. Variable substitutions
|
|
49
|
+
* will be made when a variable is named in {brackets}.
|
|
50
|
+
*/
|
|
51
|
+
url: z.ZodOptional<z.ZodString>;
|
|
52
|
+
/**
|
|
53
|
+
* An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text
|
|
54
|
+
* representation.
|
|
55
|
+
*/
|
|
56
|
+
description: z.ZodOptional<z.ZodString>;
|
|
57
|
+
/** A map between a variable name and its value. The value is used for substitution in the server’s URL template. */
|
|
58
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, ZodSchema<Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
59
|
+
enum?: [string, ...string[]];
|
|
60
|
+
}, z.ZodTypeDef, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
61
|
+
enum?: [string, ...string[]];
|
|
62
|
+
}>>>;
|
|
63
|
+
}, {
|
|
64
|
+
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
65
|
+
}>, "strip", z.ZodTypeAny, {
|
|
66
|
+
uid: string;
|
|
67
|
+
description?: string | undefined;
|
|
68
|
+
url?: string | undefined;
|
|
69
|
+
variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
70
|
+
enum?: [string, ...string[]];
|
|
71
|
+
}> | undefined;
|
|
72
|
+
}, {
|
|
73
|
+
uid?: string | undefined;
|
|
74
|
+
description?: string | undefined;
|
|
75
|
+
url?: string | undefined;
|
|
76
|
+
variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
|
|
77
|
+
enum?: [string, ...string[]];
|
|
78
|
+
}> | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
export type Server = z.infer<typeof serverSchema>;
|
|
81
|
+
export type ServerPayload = z.input<typeof serverSchema>;
|
|
82
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,KAAK,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvC;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAc9B,SAAS,CACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG;IAC/C,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;CAC7B,CACF,CAAA;AAED,eAAO,MAAM,eAAe;IAC1B;;;;OAIG;;IAEH;;;OAGG;;IAEH,oHAAoH;;eAhB3G,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;eAArB,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;;;;;eAArB,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;;;;;eAArB,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;EAkBgB,CAAA;AAEhD,eAAO,MAAM,YAAY;IAfvB;;;;OAIG;;IAEH;;;OAGG;;IAEH,oHAAoH;;eAhB3G,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;eAArB,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;;;;;;;;eAArB,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;;;;;;eAArB,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;EAsB9B,CAAA;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AACjD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { deepMerge } from '@scalar/object-utils/merge';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
import { nanoidSchema } from '../shared/utility.js';
|
|
4
3
|
|
|
@@ -7,14 +6,15 @@ import { nanoidSchema } from '../shared/utility.js';
|
|
|
7
6
|
* An object representing a Server Variable for server URL template substitution.
|
|
8
7
|
*
|
|
9
8
|
* @see https://spec.openapis.org/oas/v3.1.0#server-variable-object
|
|
9
|
+
*
|
|
10
|
+
* NOTE: Typecase is required to handle enum string array type
|
|
10
11
|
*/
|
|
11
|
-
const
|
|
12
|
-
uid: nanoidSchema,
|
|
12
|
+
const oasServerVariableSchema = z.object({
|
|
13
13
|
/**
|
|
14
14
|
* An enumeration of string values to be used if the substitution options are from a limited set.
|
|
15
15
|
* The array MUST NOT be empty.
|
|
16
16
|
*/
|
|
17
|
-
enum: z.array(
|
|
17
|
+
enum: z.string().array().min(1).optional(),
|
|
18
18
|
/**
|
|
19
19
|
* REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied.
|
|
20
20
|
* Note this behavior is different than the Schema Object’s treatment of default values, because in those cases
|
|
@@ -23,26 +23,24 @@ const serverVariableSchema = z.object({
|
|
|
23
23
|
default: z.string().optional().default('default'),
|
|
24
24
|
/** An optional description for the server variable. CommonMark syntax MAY be used for rich text representation. */
|
|
25
25
|
description: z.string().optional(),
|
|
26
|
-
/** An optional value for the server variable */
|
|
27
|
-
value: z.string().optional(),
|
|
28
26
|
});
|
|
29
|
-
const
|
|
30
|
-
uid: nanoidSchema,
|
|
27
|
+
const oasServerSchema = z.object({
|
|
31
28
|
/**
|
|
32
29
|
* REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that
|
|
33
30
|
* the host location is relative to the location where the OpenAPI document is being served. Variable substitutions
|
|
34
31
|
* will be made when a variable is named in {brackets}.
|
|
35
32
|
*/
|
|
36
|
-
url: z.string().optional()
|
|
33
|
+
url: z.string().optional(),
|
|
37
34
|
/**
|
|
38
35
|
* An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text
|
|
39
36
|
* representation.
|
|
40
37
|
*/
|
|
41
38
|
description: z.string().optional(),
|
|
42
39
|
/** A map between a variable name and its value. The value is used for substitution in the server’s URL template. */
|
|
43
|
-
variables: z.record(z.string(),
|
|
40
|
+
variables: z.record(z.string(), oasServerVariableSchema).optional(),
|
|
41
|
+
});
|
|
42
|
+
const serverSchema = oasServerSchema.extend({
|
|
43
|
+
uid: nanoidSchema,
|
|
44
44
|
});
|
|
45
|
-
/** Create server helper */
|
|
46
|
-
const createServer = (payload) => deepMerge(serverSchema.parse({}), payload);
|
|
47
45
|
|
|
48
|
-
export {
|
|
46
|
+
export { oasServerSchema, oasServerVariableSchema, serverSchema };
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* License information for the exposed API.
|
|
4
|
+
*
|
|
5
|
+
* @see https://spec.openapis.org/oas/latest.html#license-object
|
|
6
|
+
*/
|
|
7
|
+
export declare const oasLicenseSchema: z.ZodObject<{
|
|
8
|
+
/** REQUIRED. The license name used for the API. */
|
|
9
|
+
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
10
|
+
/** An SPDX license expression for the API. The identifier field is mutually exclusive of the url field. */
|
|
11
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
12
|
+
/**
|
|
13
|
+
* A URL to the license used for the API. This MUST be in the form of a URL. The url field
|
|
14
|
+
* is mutually exclusive of the identifier field.
|
|
15
|
+
*/
|
|
16
|
+
url: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
name: string;
|
|
19
|
+
identifier?: string | undefined;
|
|
20
|
+
url?: string | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
name?: string | undefined;
|
|
23
|
+
identifier?: string | undefined;
|
|
24
|
+
url?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Contact
|
|
28
|
+
* Contact information for the exposed API.
|
|
29
|
+
*
|
|
30
|
+
* @see https://spec.openapis.org/oas/latest.html#contact-object
|
|
31
|
+
*/
|
|
32
|
+
export declare const oasContactSchema: z.ZodObject<{
|
|
33
|
+
/** The identifying name of the contact person/organization. */
|
|
34
|
+
name: z.ZodOptional<z.ZodString>;
|
|
35
|
+
/** The URL pointing to the contact information. This MUST be in the form of a URL. */
|
|
36
|
+
url: z.ZodOptional<z.ZodString>;
|
|
37
|
+
/** The email address of the contact person/organization. This MUST be in the form of an email address. */
|
|
38
|
+
email: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
name?: string | undefined;
|
|
41
|
+
url?: string | undefined;
|
|
42
|
+
email?: string | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
name?: string | undefined;
|
|
45
|
+
url?: string | undefined;
|
|
46
|
+
email?: string | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Info
|
|
50
|
+
* The object provides metadata about the API. The metadata MAY be used by the clients if needed,
|
|
51
|
+
* and MAY be presented in editing or documentation generation tools for convenience.
|
|
52
|
+
*
|
|
53
|
+
* @see https://spec.openapis.org/oas/latest.html#info-object
|
|
54
|
+
*/
|
|
55
|
+
export declare const oasInfoSchema: z.ZodObject<{
|
|
56
|
+
/** REQUIRED. The title of the API. */
|
|
57
|
+
title: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
58
|
+
/** A short summary of the API. */
|
|
59
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
60
|
+
/** A description of the API. CommonMark syntax MAY be used for rich text representation. */
|
|
61
|
+
description: z.ZodOptional<z.ZodString>;
|
|
62
|
+
/** A URL to the Terms of Service for the API. This MUST be in the form of a URL. */
|
|
63
|
+
termsOfService: z.ZodOptional<z.ZodString>;
|
|
64
|
+
/** The contact information for the exposed API. */
|
|
65
|
+
contact: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
/** The identifying name of the contact person/organization. */
|
|
67
|
+
name: z.ZodOptional<z.ZodString>;
|
|
68
|
+
/** The URL pointing to the contact information. This MUST be in the form of a URL. */
|
|
69
|
+
url: z.ZodOptional<z.ZodString>;
|
|
70
|
+
/** The email address of the contact person/organization. This MUST be in the form of an email address. */
|
|
71
|
+
email: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
name?: string | undefined;
|
|
74
|
+
url?: string | undefined;
|
|
75
|
+
email?: string | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
name?: string | undefined;
|
|
78
|
+
url?: string | undefined;
|
|
79
|
+
email?: string | undefined;
|
|
80
|
+
}>>;
|
|
81
|
+
/** The license information for the exposed API. */
|
|
82
|
+
license: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
/** REQUIRED. The license name used for the API. */
|
|
84
|
+
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
85
|
+
/** An SPDX license expression for the API. The identifier field is mutually exclusive of the url field. */
|
|
86
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
87
|
+
/**
|
|
88
|
+
* A URL to the license used for the API. This MUST be in the form of a URL. The url field
|
|
89
|
+
* is mutually exclusive of the identifier field.
|
|
90
|
+
*/
|
|
91
|
+
url: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
name: string;
|
|
94
|
+
identifier?: string | undefined;
|
|
95
|
+
url?: string | undefined;
|
|
96
|
+
}, {
|
|
97
|
+
name?: string | undefined;
|
|
98
|
+
identifier?: string | undefined;
|
|
99
|
+
url?: string | undefined;
|
|
100
|
+
}>>;
|
|
101
|
+
/**
|
|
102
|
+
* REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI
|
|
103
|
+
* Specification version or the API implementation version).
|
|
104
|
+
*/
|
|
105
|
+
version: z.ZodDefault<z.ZodString>;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
title: string;
|
|
108
|
+
version: string;
|
|
109
|
+
description?: string | undefined;
|
|
110
|
+
summary?: string | undefined;
|
|
111
|
+
termsOfService?: string | undefined;
|
|
112
|
+
contact?: {
|
|
113
|
+
name?: string | undefined;
|
|
114
|
+
url?: string | undefined;
|
|
115
|
+
email?: string | undefined;
|
|
116
|
+
} | undefined;
|
|
117
|
+
license?: {
|
|
118
|
+
name: string;
|
|
119
|
+
identifier?: string | undefined;
|
|
120
|
+
url?: string | undefined;
|
|
121
|
+
} | undefined;
|
|
122
|
+
}, {
|
|
123
|
+
description?: string | undefined;
|
|
124
|
+
title?: string | undefined;
|
|
125
|
+
summary?: string | undefined;
|
|
126
|
+
termsOfService?: string | undefined;
|
|
127
|
+
contact?: {
|
|
128
|
+
name?: string | undefined;
|
|
129
|
+
url?: string | undefined;
|
|
130
|
+
email?: string | undefined;
|
|
131
|
+
} | undefined;
|
|
132
|
+
license?: {
|
|
133
|
+
name?: string | undefined;
|
|
134
|
+
identifier?: string | undefined;
|
|
135
|
+
url?: string | undefined;
|
|
136
|
+
} | undefined;
|
|
137
|
+
version?: string | undefined;
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* External Documentation
|
|
141
|
+
* Allows referencing an external resource for extended documentation.
|
|
142
|
+
*
|
|
143
|
+
* @see https://spec.openapis.org/oas/latest.html#external-documentation-object
|
|
144
|
+
*/
|
|
145
|
+
export declare const oasExternalDocumentationSchema: z.ZodObject<{
|
|
146
|
+
/** A description of the target documentation. CommonMark syntax MAY be used for rich text representation. */
|
|
147
|
+
description: z.ZodOptional<z.ZodString>;
|
|
148
|
+
/** REQUIRED. The URL for the target documentation. This MUST be in the form of a URL. */
|
|
149
|
+
url: z.ZodDefault<z.ZodString>;
|
|
150
|
+
}, "strip", z.ZodTypeAny, {
|
|
151
|
+
url: string;
|
|
152
|
+
description?: string | undefined;
|
|
153
|
+
}, {
|
|
154
|
+
description?: string | undefined;
|
|
155
|
+
url?: string | undefined;
|
|
156
|
+
}>;
|
|
157
|
+
export type ExternalDocumentation = z.infer<typeof oasExternalDocumentationSchema>;
|
|
158
|
+
export declare const xScalarNestedSchema: z.ZodArray<z.ZodObject<{
|
|
159
|
+
tagName: z.ZodString;
|
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
tagName: string;
|
|
162
|
+
}, {
|
|
163
|
+
tagName: string;
|
|
164
|
+
}>, "many">;
|
|
165
|
+
/**
|
|
166
|
+
* Tag
|
|
167
|
+
* Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag
|
|
168
|
+
* Object per tag defined in the Operation Object instances.
|
|
169
|
+
*
|
|
170
|
+
* @see https://spec.openapis.org/oas/latest.html#tag-object
|
|
171
|
+
*/
|
|
172
|
+
export declare const oasTagSchema: z.ZodObject<{
|
|
173
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"tag">>>;
|
|
174
|
+
/** REQUIRED. The name of the tag. */
|
|
175
|
+
name: z.ZodString;
|
|
176
|
+
/** A description for the tag. CommonMark syntax MAY be used for rich text representation. */
|
|
177
|
+
description: z.ZodOptional<z.ZodString>;
|
|
178
|
+
/** Additional external documentation for this tag. */
|
|
179
|
+
externalDocs: z.ZodOptional<z.ZodObject<{
|
|
180
|
+
/** A description of the target documentation. CommonMark syntax MAY be used for rich text representation. */
|
|
181
|
+
description: z.ZodOptional<z.ZodString>;
|
|
182
|
+
/** REQUIRED. The URL for the target documentation. This MUST be in the form of a URL. */
|
|
183
|
+
url: z.ZodDefault<z.ZodString>;
|
|
184
|
+
}, "strip", z.ZodTypeAny, {
|
|
185
|
+
url: string;
|
|
186
|
+
description?: string | undefined;
|
|
187
|
+
}, {
|
|
188
|
+
description?: string | undefined;
|
|
189
|
+
url?: string | undefined;
|
|
190
|
+
}>>;
|
|
191
|
+
'x-scalar-children': z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
192
|
+
tagName: z.ZodString;
|
|
193
|
+
}, "strip", z.ZodTypeAny, {
|
|
194
|
+
tagName: string;
|
|
195
|
+
}, {
|
|
196
|
+
tagName: string;
|
|
197
|
+
}>, "many">>;
|
|
198
|
+
}, "strip", z.ZodTypeAny, {
|
|
199
|
+
type: "tag";
|
|
200
|
+
name: string;
|
|
201
|
+
'x-scalar-children': {
|
|
202
|
+
tagName: string;
|
|
203
|
+
}[];
|
|
204
|
+
description?: string | undefined;
|
|
205
|
+
externalDocs?: {
|
|
206
|
+
url: string;
|
|
207
|
+
description?: string | undefined;
|
|
208
|
+
} | undefined;
|
|
209
|
+
}, {
|
|
210
|
+
name: string;
|
|
211
|
+
type?: "tag" | undefined;
|
|
212
|
+
description?: string | undefined;
|
|
213
|
+
externalDocs?: {
|
|
214
|
+
description?: string | undefined;
|
|
215
|
+
url?: string | undefined;
|
|
216
|
+
} | undefined;
|
|
217
|
+
'x-scalar-children'?: {
|
|
218
|
+
tagName: string;
|
|
219
|
+
}[] | undefined;
|
|
220
|
+
}>;
|
|
221
|
+
export declare const tagSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
222
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"tag">>>;
|
|
223
|
+
/** REQUIRED. The name of the tag. */
|
|
224
|
+
name: z.ZodString;
|
|
225
|
+
/** A description for the tag. CommonMark syntax MAY be used for rich text representation. */
|
|
226
|
+
description: z.ZodOptional<z.ZodString>;
|
|
227
|
+
/** Additional external documentation for this tag. */
|
|
228
|
+
externalDocs: z.ZodOptional<z.ZodObject<{
|
|
229
|
+
/** A description of the target documentation. CommonMark syntax MAY be used for rich text representation. */
|
|
230
|
+
description: z.ZodOptional<z.ZodString>;
|
|
231
|
+
/** REQUIRED. The URL for the target documentation. This MUST be in the form of a URL. */
|
|
232
|
+
url: z.ZodDefault<z.ZodString>;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
url: string;
|
|
235
|
+
description?: string | undefined;
|
|
236
|
+
}, {
|
|
237
|
+
description?: string | undefined;
|
|
238
|
+
url?: string | undefined;
|
|
239
|
+
}>>;
|
|
240
|
+
'x-scalar-children': z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
241
|
+
tagName: z.ZodString;
|
|
242
|
+
}, "strip", z.ZodTypeAny, {
|
|
243
|
+
tagName: string;
|
|
244
|
+
}, {
|
|
245
|
+
tagName: string;
|
|
246
|
+
}>, "many">>;
|
|
247
|
+
}, {
|
|
248
|
+
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
249
|
+
children: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
|
|
250
|
+
}>, "strip", z.ZodTypeAny, {
|
|
251
|
+
type: "tag";
|
|
252
|
+
uid: string;
|
|
253
|
+
name: string;
|
|
254
|
+
'x-scalar-children': {
|
|
255
|
+
tagName: string;
|
|
256
|
+
}[];
|
|
257
|
+
children: string[];
|
|
258
|
+
description?: string | undefined;
|
|
259
|
+
externalDocs?: {
|
|
260
|
+
url: string;
|
|
261
|
+
description?: string | undefined;
|
|
262
|
+
} | undefined;
|
|
263
|
+
}, {
|
|
264
|
+
name: string;
|
|
265
|
+
type?: "tag" | undefined;
|
|
266
|
+
uid?: string | undefined;
|
|
267
|
+
description?: string | undefined;
|
|
268
|
+
externalDocs?: {
|
|
269
|
+
description?: string | undefined;
|
|
270
|
+
url?: string | undefined;
|
|
271
|
+
} | undefined;
|
|
272
|
+
'x-scalar-children'?: {
|
|
273
|
+
tagName: string;
|
|
274
|
+
}[] | undefined;
|
|
275
|
+
children?: (string | undefined)[] | undefined;
|
|
276
|
+
}>;
|
|
277
|
+
export type Tag = z.infer<typeof tagSchema>;
|
|
278
|
+
export type TagPayload = z.input<typeof tagSchema>;
|
|
279
|
+
//# sourceMappingURL=spec-objects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-objects.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/spec-objects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;IAC3B,mDAAmD;;IAEnD,2GAA2G;;IAE3G;;;OAGG;;;;;;;;;;EAEH,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;IAC3B,+DAA+D;;IAE/D,sFAAsF;;IAEtF,0GAA0G;;;;;;;;;;EAE1G,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;IACxB,sCAAsC;;IAEtC,kCAAkC;;IAElC,4FAA4F;;IAE5F,oFAAoF;;IAEpF,mDAAmD;;QAxBnD,+DAA+D;;QAE/D,sFAAsF;;QAEtF,0GAA0G;;;;;;;;;;;IAsB1G,mDAAmD;;QA5CnD,mDAAmD;;QAEnD,2GAA2G;;QAE3G;;;WAGG;;;;;;;;;;;IAuCH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;IACzC,6GAA6G;;IAE7G,yFAAyF;;;;;;;;EAEzF,CAAA;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CACzC,OAAO,8BAA8B,CACtC,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;WAItB,CAAA;AAEV;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;IAEvB,qCAAqC;;IAErC,6FAA6F;;IAE7F,sDAAsD;;QA5BtD,6GAA6G;;QAE7G,yFAAyF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BzF,CAAA;AAEF,eAAO,MAAM,SAAS;;IATpB,qCAAqC;;IAErC,6FAA6F;;IAE7F,sDAAsD;;QA5BtD,6GAA6G;;QAE7G,yFAAyF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCzF,CAAA;AAEF,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAC3C,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA"}
|