@postman/sdk-config 0.19.1 → 0.21.0
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/dist/index.cjs +367 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +367 -55
- package/dist/index.js.map +1 -1
- package/dist/sdk-config/index.cjs +313 -9
- package/dist/sdk-config/index.cjs.map +1 -1
- package/dist/sdk-config/index.d.cts +1 -1
- package/dist/sdk-config/index.d.ts +1 -1
- package/dist/sdk-config/index.js +313 -9
- package/dist/sdk-config/index.js.map +1 -1
- package/dist/sdk-config/v1/index.cjs +313 -9
- package/dist/sdk-config/v1/index.cjs.map +1 -1
- package/dist/sdk-config/v1/index.d.cts +929 -30
- package/dist/sdk-config/v1/index.d.ts +929 -30
- package/dist/sdk-config/v1/index.js +313 -9
- package/dist/sdk-config/v1/index.js.map +1 -1
- package/dist/sdk-config-ir/index.cjs +348 -51
- package/dist/sdk-config-ir/index.cjs.map +1 -1
- package/dist/sdk-config-ir/index.d.cts +1 -1
- package/dist/sdk-config-ir/index.d.ts +1 -1
- package/dist/sdk-config-ir/index.js +348 -52
- package/dist/sdk-config-ir/index.js.map +1 -1
- package/dist/sdk-config-ir/v1/index.cjs +348 -51
- package/dist/sdk-config-ir/v1/index.cjs.map +1 -1
- package/dist/sdk-config-ir/v1/index.d.cts +607 -4
- package/dist/sdk-config-ir/v1/index.d.ts +607 -4
- package/dist/sdk-config-ir/v1/index.js +348 -52
- package/dist/sdk-config-ir/v1/index.js.map +1 -1
- package/dist/{typescript-D0YeGxxS.d.cts → typescript-DNic6Rq5.d.cts} +80 -1
- package/dist/{typescript-D0YeGxxS.d.ts → typescript-DNic6Rq5.d.ts} +80 -1
- package/package.json +2 -2
- package/src/sdk-config/v1/README.md +82 -15
- package/src/sdk-config-ir/v1/README.md +39 -0
|
@@ -140,6 +140,39 @@ var publicClientIdSchema = nonEmptyStringSchema.refine((value) => value.trim() =
|
|
|
140
140
|
}).refine((value) => !value.includes("${"), {
|
|
141
141
|
message: "must be a literal public client ID, not an environment expression"
|
|
142
142
|
});
|
|
143
|
+
var oauthExtraParametersSchema = zod.z.record(zod.z.string().min(1), zod.z.string());
|
|
144
|
+
function parseUrl(value) {
|
|
145
|
+
try {
|
|
146
|
+
return new URL(value);
|
|
147
|
+
} catch {
|
|
148
|
+
return void 0;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
var loopbackRedirectUriSchema = nonEmptyStringSchema.refine(
|
|
152
|
+
(value) => {
|
|
153
|
+
const url = parseUrl(value);
|
|
154
|
+
return url !== void 0 && url.protocol === "http:" && (url.hostname === "127.0.0.1" || url.hostname === "localhost") && url.port !== "";
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
message: "must be an http URL on 127.0.0.1 or localhost that pins a port, such as http://127.0.0.1:8484/callback"
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
function containsControlCharacter(value) {
|
|
161
|
+
return [...value].some((character) => {
|
|
162
|
+
const code = character.charCodeAt(0);
|
|
163
|
+
return code <= 31 || code === 127;
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
var hostedPageUrlSchema = nonEmptyStringSchema.refine(
|
|
167
|
+
(value) => {
|
|
168
|
+
const url = parseUrl(value);
|
|
169
|
+
return url !== void 0 && (url.protocol === "http:" || url.protocol === "https:");
|
|
170
|
+
},
|
|
171
|
+
{ message: "must be an absolute http or https URL" }
|
|
172
|
+
).refine((value) => !containsControlCharacter(value), {
|
|
173
|
+
message: "must not contain control characters"
|
|
174
|
+
});
|
|
175
|
+
var redirectPortSchema = zod.z.number().int().min(1).max(65535);
|
|
143
176
|
var oauthFlowSchema = zod.z.discriminatedUnion("type", [
|
|
144
177
|
zod.z.strictObject({
|
|
145
178
|
type: zod.z.literal("authorization-code").describe("Uses the OAuth authorization code flow."),
|
|
@@ -149,7 +182,25 @@ var oauthFlowSchema = zod.z.discriminatedUnion("type", [
|
|
|
149
182
|
scopes: zod.z.array(oauthScopeSchema).optional().describe("The scopes supported by this flow."),
|
|
150
183
|
clientId: publicClientIdSchema.optional().describe(
|
|
151
184
|
"The public, non-secret OAuth client ID that generated interactive login flows, such as CLI browser login with PKCE, send to the authorization and token endpoints. It is embedded verbatim in generated code, so it must never be a client secret."
|
|
152
|
-
)
|
|
185
|
+
),
|
|
186
|
+
redirectUri: loopbackRedirectUriSchema.optional().describe(
|
|
187
|
+
"The loopback callback of the interactive login, such as http://127.0.0.1:8484/callback. The login binds this exact host, port and path and sends it to the authorization server, so it must match the redirect registered there. Without it the login uses a free port chosen by the operating system."
|
|
188
|
+
),
|
|
189
|
+
redirectUriBackupPorts: zod.z.array(redirectPortSchema).min(1).optional().describe(
|
|
190
|
+
"Ports tried in order when the port of redirectUri is busy. Each reuses the host and path of redirectUri, and every resulting URI must be registered with the authorization server. Requires redirectUri."
|
|
191
|
+
),
|
|
192
|
+
successRedirectUrl: hostedPageUrlSchema.optional().describe(
|
|
193
|
+
"A page the browser is sent to once the login captured the authorization code. Without it the login shows its own page."
|
|
194
|
+
),
|
|
195
|
+
errorRedirectUrl: hostedPageUrlSchema.optional().describe(
|
|
196
|
+
"A page the browser is sent to when the login fails; the error and error_description query parameters are added. Without it the login shows its own page."
|
|
197
|
+
),
|
|
198
|
+
authorizationParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the authorization request, such as audience."),
|
|
199
|
+
tokenParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the authorization code exchange request."),
|
|
200
|
+
refreshParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the token refresh request.")
|
|
201
|
+
}).refine((flow) => flow.redirectUriBackupPorts === void 0 || flow.redirectUri !== void 0, {
|
|
202
|
+
message: "redirectUriBackupPorts requires redirectUri",
|
|
203
|
+
path: ["redirectUriBackupPorts"]
|
|
153
204
|
}),
|
|
154
205
|
zod.z.strictObject({
|
|
155
206
|
type: zod.z.literal("client-credentials").describe("Uses the OAuth client credentials flow."),
|
|
@@ -168,21 +219,47 @@ var oauthFlowSchema = zod.z.discriminatedUnion("type", [
|
|
|
168
219
|
tokenUrl: nonEmptyStringSchema.describe("The URL used to obtain access tokens."),
|
|
169
220
|
refreshUrl: nonEmptyStringSchema.optional().describe("The URL used to refresh access tokens."),
|
|
170
221
|
scopes: zod.z.array(oauthScopeSchema).optional().describe("The scopes supported by this flow.")
|
|
222
|
+
}),
|
|
223
|
+
zod.z.strictObject({
|
|
224
|
+
type: zod.z.literal("device-code").describe(
|
|
225
|
+
"Uses the OAuth device authorization flow (RFC 8628) for logins without a browser."
|
|
226
|
+
),
|
|
227
|
+
clientId: publicClientIdSchema.describe(
|
|
228
|
+
"The public, non-secret OAuth client ID sent to the device authorization and token endpoints. It is embedded verbatim in generated code, so it must never be a client secret."
|
|
229
|
+
),
|
|
230
|
+
deviceAuthorizationUrl: nonEmptyStringSchema.describe(
|
|
231
|
+
"The URL that issues the device code, the user code and the verification URL."
|
|
232
|
+
),
|
|
233
|
+
tokenUrl: nonEmptyStringSchema.describe(
|
|
234
|
+
"The URL polled to exchange the device code for tokens once the user approved."
|
|
235
|
+
),
|
|
236
|
+
refreshUrl: nonEmptyStringSchema.optional().describe("The URL used to refresh access tokens."),
|
|
237
|
+
scopes: zod.z.array(oauthScopeSchema).optional().describe("The scopes supported by this flow."),
|
|
238
|
+
deviceAuthorizationParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the device authorization request, such as audience."),
|
|
239
|
+
tokenParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the token polling request."),
|
|
240
|
+
refreshParameters: oauthExtraParametersSchema.optional().describe("Extra parameters added to the token refresh request.")
|
|
171
241
|
})
|
|
172
242
|
]);
|
|
173
|
-
var
|
|
243
|
+
var oauth2AuthObjectSchema = zod.z.strictObject({
|
|
174
244
|
id: nonEmptyStringSchema.describe("A unique identifier for this authentication scheme."),
|
|
175
245
|
type: zod.z.literal("oauth2").describe("Identifies an OAuth 2.0 authentication scheme."),
|
|
176
246
|
flows: zod.z.array(oauthFlowSchema).min(1).describe("The OAuth flows supported by the API."),
|
|
177
247
|
clientId: authVariableSchema.optional().describe("The OAuth client ID parameter exposed by the SDK."),
|
|
178
248
|
clientSecret: authVariableSchema.optional().describe("The OAuth client secret parameter exposed by the SDK."),
|
|
179
249
|
tokenHeader: nonEmptyStringSchema.optional().describe("The request header that carries the OAuth access token."),
|
|
180
|
-
tokenPrefix: nonEmptyStringSchema.optional().describe(
|
|
250
|
+
tokenPrefix: nonEmptyStringSchema.optional().describe('The prefix added before the OAuth access token. Defaults to "Bearer" when omitted.'),
|
|
251
|
+
omitTokenPrefix: zod.z.boolean().optional().describe(
|
|
252
|
+
'Whether the OAuth access token is sent as-is, with no prefix. Without it, a missing tokenPrefix means "Bearer". Cannot be combined with tokenPrefix.'
|
|
253
|
+
),
|
|
181
254
|
refreshBufferSeconds: zod.z.number().nonnegative().optional().describe("How early, in seconds, the client refreshes a token before it expires."),
|
|
182
255
|
description: zod.z.string().optional().describe(
|
|
183
256
|
"A description of the authentication scheme included in generated SDK documentation."
|
|
184
257
|
)
|
|
185
258
|
});
|
|
259
|
+
var oauth2AuthSchema = oauth2AuthObjectSchema.refine(
|
|
260
|
+
(scheme) => !(scheme.omitTokenPrefix === true && scheme.tokenPrefix !== void 0),
|
|
261
|
+
{ message: "omitTokenPrefix cannot be combined with tokenPrefix", path: ["omitTokenPrefix"] }
|
|
262
|
+
);
|
|
186
263
|
var customAuthParameterSchema = zod.z.strictObject({
|
|
187
264
|
location: zod.z.enum(["header", "query", "cookie"]).describe("Where the custom authentication value is sent."),
|
|
188
265
|
name: nonEmptyStringSchema.describe("The header, query parameter, or cookie name."),
|
|
@@ -592,6 +669,9 @@ var RESERVED_PROFILES_COMMAND_NAMES = /* @__PURE__ */ new Set([
|
|
|
592
669
|
var binaryNameSchema = nonEmptyStringSchema.regex(ALPHANUMERIC_PATTERN, {
|
|
593
670
|
message: "binaryName must contain at least one ASCII letter or digit"
|
|
594
671
|
});
|
|
672
|
+
var crateNameSchema = zod.z.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,63}$/, {
|
|
673
|
+
message: "crateName must start with a letter, contain only letters, digits, hyphens, and underscores, and be at most 64 characters"
|
|
674
|
+
});
|
|
595
675
|
var rootGroupSchema = zod.z.string().regex(ROOT_GROUP_PATTERN, {
|
|
596
676
|
message: "rootGroup must start with a lowercase letter and contain only lowercase letters, digits, hyphens, and underscores"
|
|
597
677
|
});
|
|
@@ -641,6 +721,28 @@ function fieldNameMapSchema(field) {
|
|
|
641
721
|
}
|
|
642
722
|
});
|
|
643
723
|
}
|
|
724
|
+
var SAFE_TEXT_PATTERN = /^[^"\\\x00-\x1f]*$/;
|
|
725
|
+
var HEX_COLOR_PATTERN = /^#[0-9a-fA-F]{6}$/;
|
|
726
|
+
var provisionFlagSchema = zod.z.string().regex(KEBAB_NAME_PATTERN, {
|
|
727
|
+
message: 'profiles.provisionOperation.flag must be a kebab-case flag name without dashes, such as "api-key"'
|
|
728
|
+
});
|
|
729
|
+
var provisionParametersSchema = zod.z.record(zod.z.string(), zod.z.string()).superRefine((value, context) => {
|
|
730
|
+
for (const [key, text] of Object.entries(value)) {
|
|
731
|
+
if (!FIELD_NAME_PATTERN.test(key)) {
|
|
732
|
+
context.addIssue({
|
|
733
|
+
code: "custom",
|
|
734
|
+
message: "profiles.provisionOperation.parameters keys must be field names containing only [A-Za-z0-9_.-]",
|
|
735
|
+
path: [key]
|
|
736
|
+
});
|
|
737
|
+
} else if (!SAFE_TEXT_PATTERN.test(text)) {
|
|
738
|
+
context.addIssue({
|
|
739
|
+
code: "custom",
|
|
740
|
+
message: "profiles.provisionOperation.parameters values must not contain quotes, backslashes or control characters",
|
|
741
|
+
path: [key]
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
});
|
|
644
746
|
var profilesProvisionOperationSchema = zod.z.strictObject({
|
|
645
747
|
operation: dottedCommandPathSchema("profiles.provisionOperation.operation").describe(
|
|
646
748
|
"The dotted command path of the operation that mints a profile credential."
|
|
@@ -648,7 +750,16 @@ var profilesProvisionOperationSchema = zod.z.strictObject({
|
|
|
648
750
|
credential: fieldNameMapSchema("profiles.provisionOperation.credential").refine((value) => Object.keys(value).length > 0, {
|
|
649
751
|
message: "profiles.provisionOperation.credential must map at least one credential field"
|
|
650
752
|
}).describe("Maps each stored credential field to the response field that supplies it."),
|
|
651
|
-
revokeParameters: fieldNameMapSchema("profiles.provisionOperation.revokeParameters").optional().describe("Maps each revoke-operation parameter to the response field that supplies it.")
|
|
753
|
+
revokeParameters: fieldNameMapSchema("profiles.provisionOperation.revokeParameters").optional().describe("Maps each revoke-operation parameter to the response field that supplies it."),
|
|
754
|
+
flag: provisionFlagSchema.optional().describe(
|
|
755
|
+
'The long name of the "profiles create" flag, without "--". The generator defaults it to "provision", which stays accepted as a hidden alias.'
|
|
756
|
+
),
|
|
757
|
+
parameters: provisionParametersSchema.optional().describe(
|
|
758
|
+
"Extra request values sent with the operation. {cli}, {profile}, {user} and {host} are substituted; a value the profile sets wins."
|
|
759
|
+
),
|
|
760
|
+
profileParameters: fieldNameMapSchema("profiles.provisionOperation.profileParameters").optional().describe(
|
|
761
|
+
"Maps each profile parameter to the typed credential field it is copied from, so requests keep it once the credential is replaced by the provisioned key."
|
|
762
|
+
)
|
|
652
763
|
});
|
|
653
764
|
var profilesConfigSchema = zod.z.strictObject({
|
|
654
765
|
enabled: zod.z.boolean().describe("Whether the CLI emits profile commands and the global --profile flag."),
|
|
@@ -656,17 +767,99 @@ var profilesConfigSchema = zod.z.strictObject({
|
|
|
656
767
|
revokeOperation: dottedCommandPathSchema("profiles.revokeOperation").optional().describe('The dotted command path called by "profiles remove --revoke".'),
|
|
657
768
|
provisionOperation: profilesProvisionOperationSchema.optional().describe('The operation called by "profiles create --provision" and its response mapping.')
|
|
658
769
|
});
|
|
770
|
+
var bannerColorsSchema = (field) => zod.z.array(
|
|
771
|
+
zod.z.string().regex(HEX_COLOR_PATTERN, {
|
|
772
|
+
message: `banner.${field} must hold 6-digit hex colours such as "#4949F2"`
|
|
773
|
+
})
|
|
774
|
+
);
|
|
775
|
+
var bannerObjectSchema = zod.z.strictObject({
|
|
776
|
+
text: nonEmptyStringSchema.describe("The banner text. May span several lines."),
|
|
777
|
+
colors: bannerColorsSchema("colors").optional().describe("One colour for a solid banner, or several for a gradient along the direction."),
|
|
778
|
+
lineColors: bannerColorsSchema("lineColors").optional().describe("One colour per line of the banner. Exclusive with colors."),
|
|
779
|
+
direction: zod.z.enum(["horizontal", "vertical", "diagonal"]).optional().describe("The direction of the gradient. The generator defaults to horizontal."),
|
|
780
|
+
animate: zod.z.boolean().optional().describe(
|
|
781
|
+
"Whether root --help on an interactive terminal plays a short shimmer across the banner before printing it."
|
|
782
|
+
)
|
|
783
|
+
}).refine((banner) => banner.colors === void 0 || banner.lineColors === void 0, {
|
|
784
|
+
message: "banner must set either colors (a gradient) or lineColors (one colour per line), not both",
|
|
785
|
+
path: ["lineColors"]
|
|
786
|
+
});
|
|
787
|
+
var bannerSchema = zod.z.union([nonEmptyStringSchema, bannerObjectSchema]);
|
|
788
|
+
var oauthPropertyPathSchema = zod.z.string().regex(FIELD_NAME_PATTERN, {
|
|
789
|
+
message: 'must be a property name, or a dotted path to a nested property, such as "data.token"'
|
|
790
|
+
}).regex(/^[^.]+(\.[^.]+)*$/, { message: "must not have an empty path segment" });
|
|
791
|
+
var oauthTokenRequestPropertiesSchema = zod.z.strictObject({
|
|
792
|
+
clientId: oauthPropertyPathSchema.optional().describe('The request property that carries the client ID. Defaults to "client_id".'),
|
|
793
|
+
clientSecret: oauthPropertyPathSchema.optional().describe('The request property that carries the client secret. Defaults to "client_secret".'),
|
|
794
|
+
scopes: oauthPropertyPathSchema.optional().describe('The request property that carries the scopes. Defaults to "scope".')
|
|
795
|
+
});
|
|
796
|
+
var oauthTokenResponsePropertiesSchema = zod.z.strictObject({
|
|
797
|
+
accessToken: oauthPropertyPathSchema.optional().describe('The response property that holds the access token. Defaults to "access_token".'),
|
|
798
|
+
expiresIn: oauthPropertyPathSchema.optional().describe(
|
|
799
|
+
'The response property that holds the lifetime in seconds. Defaults to "expires_in".'
|
|
800
|
+
),
|
|
801
|
+
refreshToken: oauthPropertyPathSchema.optional().describe('The response property that holds the refresh token. Defaults to "refresh_token".')
|
|
802
|
+
});
|
|
803
|
+
var oauthTokenEndpointsSchema = zod.z.strictObject({
|
|
804
|
+
token: zod.z.strictObject({
|
|
805
|
+
requestProperties: oauthTokenRequestPropertiesSchema.optional().describe("The names of the properties of the token request."),
|
|
806
|
+
responseProperties: oauthTokenResponsePropertiesSchema.optional().describe("The names of the properties of the token response.")
|
|
807
|
+
}).optional().describe("The token endpoint of the client credentials flow (its tokenUrl)."),
|
|
808
|
+
refresh: zod.z.strictObject({
|
|
809
|
+
requestProperties: zod.z.strictObject({
|
|
810
|
+
refreshToken: oauthPropertyPathSchema.optional().describe(
|
|
811
|
+
'The request property that carries the refresh token. Defaults to "refresh_token".'
|
|
812
|
+
)
|
|
813
|
+
}).optional().describe("The names of the properties of the refresh request."),
|
|
814
|
+
responseProperties: oauthTokenResponsePropertiesSchema.optional().describe("The names of the properties of the refresh response.")
|
|
815
|
+
}).optional().describe("The refresh endpoint of the client credentials flow (its refreshUrl).")
|
|
816
|
+
});
|
|
817
|
+
function oauthTokenEndpointsIssues(oauthTokenEndpoints, schemes, basePath) {
|
|
818
|
+
const flowsById = /* @__PURE__ */ new Map();
|
|
819
|
+
for (const scheme of schemes ?? []) {
|
|
820
|
+
const flow = scheme.type === "oauth2" ? scheme.flows?.find((f) => f.type === "client-credentials") : void 0;
|
|
821
|
+
if (flow !== void 0) {
|
|
822
|
+
flowsById.set(scheme.id, flow);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return Object.entries(oauthTokenEndpoints ?? {}).flatMap(([id, endpoints]) => {
|
|
826
|
+
const flow = flowsById.get(id);
|
|
827
|
+
if (flow === void 0) {
|
|
828
|
+
return [
|
|
829
|
+
{
|
|
830
|
+
message: `oauthTokenEndpoints "${id}" must name an OAuth scheme with a client-credentials flow`,
|
|
831
|
+
path: [...basePath, id]
|
|
832
|
+
}
|
|
833
|
+
];
|
|
834
|
+
}
|
|
835
|
+
return endpoints.refresh !== void 0 && flow.refreshUrl === void 0 ? [
|
|
836
|
+
{
|
|
837
|
+
message: `oauthTokenEndpoints "${id}" has refresh settings, but its flow has no refreshUrl`,
|
|
838
|
+
path: [...basePath, id, "refresh"]
|
|
839
|
+
}
|
|
840
|
+
] : [];
|
|
841
|
+
});
|
|
842
|
+
}
|
|
659
843
|
var cliGenerationConfigSchema = zod.z.strictObject({
|
|
660
844
|
paginationParameters: zod.z.array(nonEmptyStringSchema).optional().describe("Request parameter names treated as pagination controls by the CLI."),
|
|
661
845
|
skills: zod.z.boolean().optional().describe("Whether the generated CLI includes skills that teach AI agents to invoke commands."),
|
|
662
846
|
binaryName: binaryNameSchema.optional().describe(
|
|
663
847
|
"The CLI executable name. The generator kebab-cases it and also uses it for the source directory and env-var prefix."
|
|
664
848
|
),
|
|
849
|
+
crateName: crateNameSchema.optional().describe(
|
|
850
|
+
"The name of the generated Cargo package, which release archives and installers are named after. The generator defaults it to the binary name when the output is delivered to GitHub."
|
|
851
|
+
),
|
|
665
852
|
customCommands: zod.z.boolean().optional().describe("Whether hand-written command support is generated. The generator defaults to true."),
|
|
666
853
|
rootGroup: rootGroupSchema.optional().describe("A command group that every spec-derived command is nested under."),
|
|
667
854
|
profiles: profilesConfigSchema.optional().describe("Named profile command configuration."),
|
|
668
855
|
splitTypeCrates: zod.z.boolean().optional().describe("Whether generated types are split into one crate per API behind a facade crate."),
|
|
669
|
-
userAgentSuffixFlag: userAgentSuffixFlagSchema.optional().describe('The long flag name, without "--", that appends a product token to the User-Agent.')
|
|
856
|
+
userAgentSuffixFlag: userAgentSuffixFlagSchema.optional().describe('The long flag name, without "--", that appends a product token to the User-Agent.'),
|
|
857
|
+
banner: bannerSchema.optional().describe(
|
|
858
|
+
"The banner printed above root --help: a string, or text with colours, a gradient direction, per-line colours and an animation switch."
|
|
859
|
+
),
|
|
860
|
+
oauthTokenEndpoints: zod.z.record(nonEmptyStringSchema, oauthTokenEndpointsSchema).optional().describe(
|
|
861
|
+
"Per OAuth scheme id (api.auth.schemes[].id), the names of the properties of the token and refresh requests and responses, for the client credentials flow of an API whose token endpoint does not use the RFC 6749 names."
|
|
862
|
+
)
|
|
670
863
|
});
|
|
671
864
|
var csharpGenerationConfigSchema = zod.z.strictObject({
|
|
672
865
|
useOptionalWrapper: zod.z.boolean().optional().describe("Whether optional values use an explicit Optional wrapper."),
|
|
@@ -1340,6 +1533,52 @@ var outputConfigSchema = zod.z.discriminatedUnion(
|
|
|
1340
1533
|
var replayConfigSchema = zod.z.strictObject({
|
|
1341
1534
|
enabled: zod.z.boolean().describe("Whether regeneration reapplies customer-authored repository changes.")
|
|
1342
1535
|
});
|
|
1536
|
+
var errorResponsesHttpMethodSchema = zod.z.enum([
|
|
1537
|
+
"get",
|
|
1538
|
+
"post",
|
|
1539
|
+
"put",
|
|
1540
|
+
"patch",
|
|
1541
|
+
"delete",
|
|
1542
|
+
"head",
|
|
1543
|
+
"options",
|
|
1544
|
+
"trace"
|
|
1545
|
+
]);
|
|
1546
|
+
var errorResponsesEnsureSchema = zod.z.strictObject({
|
|
1547
|
+
statusCode: zod.z.number().int().min(400).max(599).describe("The 4xx or 5xx status code added to an operation that does not declare it."),
|
|
1548
|
+
methods: zod.z.array(errorResponsesHttpMethodSchema).optional().describe("The HTTP methods whose operations receive the response. Defaults to all methods.")
|
|
1549
|
+
});
|
|
1550
|
+
var errorResponsesSchema = zod.z.strictObject({
|
|
1551
|
+
schema: zod.z.record(zod.z.string(), zod.z.unknown()).describe(
|
|
1552
|
+
"The OpenAPI schema of error response bodies, inline. The client resolves a schema file to its content before the config reaches the generator. Any $ref inside must be a local #/components/... pointer into the spec it is applied to."
|
|
1553
|
+
),
|
|
1554
|
+
name: nonEmptyStringSchema.optional().describe(
|
|
1555
|
+
"The name of the generated error body type. Defaults to the schema title, then ProblemDetails."
|
|
1556
|
+
),
|
|
1557
|
+
applyTo: zod.z.enum(["all", "untyped"]).optional().describe(
|
|
1558
|
+
"all replaces the body of every 4xx/5xx response with the schema. untyped only fills in 4xx/5xx responses that declare no body schema. Defaults to all."
|
|
1559
|
+
),
|
|
1560
|
+
ensure: zod.z.array(errorResponsesEnsureSchema).optional().describe("Error responses added to operations that do not already declare them.")
|
|
1561
|
+
});
|
|
1562
|
+
var exampleDepthSchema = zod.z.strictObject({
|
|
1563
|
+
maxDepth: zod.z.number().int().min(0).optional().describe("How many levels of optional properties an example includes. 0 leaves them out.")
|
|
1564
|
+
});
|
|
1565
|
+
var exampleGenerationSchema = zod.z.strictObject({
|
|
1566
|
+
request: exampleDepthSchema.optional().describe("Depth of generated request examples."),
|
|
1567
|
+
response: exampleDepthSchema.optional().describe("Depth of generated response examples.")
|
|
1568
|
+
});
|
|
1569
|
+
var resolveAliasesSchema = zod.z.union([
|
|
1570
|
+
zod.z.boolean(),
|
|
1571
|
+
zod.z.strictObject({
|
|
1572
|
+
except: zod.z.array(nonEmptyStringSchema).optional().describe("Component schema names whose aliases are kept.")
|
|
1573
|
+
})
|
|
1574
|
+
]);
|
|
1575
|
+
var endpointFilterSchema = zod.z.strictObject({
|
|
1576
|
+
endpoints: zod.z.array(
|
|
1577
|
+
nonEmptyStringSchema.describe(
|
|
1578
|
+
'An endpoint to keep, as "METHOD /path/template". An entry in another shape is ignored.'
|
|
1579
|
+
)
|
|
1580
|
+
).describe("The only endpoints imported. Every other operation is dropped before conversion.")
|
|
1581
|
+
});
|
|
1343
1582
|
var apiImportSettingsSchema = zod.z.strictObject({
|
|
1344
1583
|
respectNullableSchemas: zod.z.boolean().optional().describe("Whether nullable schemas remain nullable in generated types."),
|
|
1345
1584
|
titleAsSchemaName: zod.z.boolean().optional().describe("Whether a schema title can determine the generated type name."),
|
|
@@ -1368,7 +1607,56 @@ var apiImportSettingsSchema = zod.z.strictObject({
|
|
|
1368
1607
|
resolveSchemaCollisions: zod.z.boolean().optional().describe("Whether colliding imported schema names are resolved automatically."),
|
|
1369
1608
|
asyncApiMessageNaming: zod.z.enum(["v1", "v2"]).optional().describe("The naming strategy used for messages imported from AsyncAPI."),
|
|
1370
1609
|
defaultIntegerFormat: zod.z.enum(["int32", "int64", "uint32", "uint64"]).optional().describe("The integer format used when a schema does not declare one."),
|
|
1371
|
-
respectByteFormat: zod.z.boolean().optional().describe("Whether string schemas with format byte are imported as base64-encoded bytes.")
|
|
1610
|
+
respectByteFormat: zod.z.boolean().optional().describe("Whether string schemas with format byte are imported as base64-encoded bytes."),
|
|
1611
|
+
additionalPropertiesDefaultsTo: zod.z.boolean().optional().describe(
|
|
1612
|
+
"Whether an object schema that does not declare additionalProperties admits any extra property."
|
|
1613
|
+
),
|
|
1614
|
+
optionalAdditionalProperties: zod.z.boolean().optional().describe("Whether the values of a nullable map are also nullable."),
|
|
1615
|
+
anyOfSiblingPropertiesAsObject: zod.z.boolean().optional().describe(
|
|
1616
|
+
"Whether an anyOf that only constrains which sibling properties are present imports as the object it sits beside."
|
|
1617
|
+
),
|
|
1618
|
+
preserveSingleSchemaOneOf: zod.z.boolean().optional().describe(
|
|
1619
|
+
"Whether a oneOf with a single member stays a union instead of collapsing to that member."
|
|
1620
|
+
),
|
|
1621
|
+
preserveOneOfInAllOf: zod.z.boolean().optional().describe(
|
|
1622
|
+
"Whether a oneOf inside an allOf stays a union of the merged variants instead of being flattened."
|
|
1623
|
+
),
|
|
1624
|
+
removeDiscriminantsFromSchemas: zod.z.enum(["always", "never"]).optional().describe(
|
|
1625
|
+
"Whether the discriminator property is removed from the schemas of a discriminated union."
|
|
1626
|
+
),
|
|
1627
|
+
coerceConstsTo: zod.z.enum(["literals", "enums", "enums-coerceable-to-literals"]).optional().describe(
|
|
1628
|
+
"What a const imports as: a literal, a single-value enum, or an enum that coerceEnumsToLiterals can turn into a literal."
|
|
1629
|
+
),
|
|
1630
|
+
resolveAliases: resolveAliasesSchema.optional().describe(
|
|
1631
|
+
"Whether references to alias-like schemas are replaced by the schema they alias, optionally keeping the named exceptions."
|
|
1632
|
+
),
|
|
1633
|
+
respectForwardCompatibleEnums: zod.z.boolean().optional().describe(
|
|
1634
|
+
"Whether a query or header parameter that accepts an enum or any string keeps both options."
|
|
1635
|
+
),
|
|
1636
|
+
inferForwardCompatible: zod.z.boolean().optional().describe(
|
|
1637
|
+
"Whether a oneOf or anyOf of an enum and a plain string imports as a forward-compatible enum."
|
|
1638
|
+
),
|
|
1639
|
+
respectOperationIdWordBoundaries: zod.z.boolean().optional().describe(
|
|
1640
|
+
"Whether operation ids are split at every word boundary when method names are derived."
|
|
1641
|
+
),
|
|
1642
|
+
namespacedErrors: zod.z.boolean().optional().describe("Whether an error response takes the x-fern-sdk-namespace it declares."),
|
|
1643
|
+
defaultFormParameterEncoding: zod.z.enum(["form", "json"]).optional().describe("How multipart form properties without an explicit content type are encoded."),
|
|
1644
|
+
respectParameterContent: zod.z.boolean().optional().describe(
|
|
1645
|
+
"Whether a header declared with a JSON content entry instead of a schema is typed by that content."
|
|
1646
|
+
),
|
|
1647
|
+
useBytesForBinaryResponse: zod.z.boolean().optional().describe("Whether a binary response is returned as bytes instead of a file stream."),
|
|
1648
|
+
useReadVariantForResponses: zod.z.boolean().optional().describe(
|
|
1649
|
+
"Whether responses use the read variant of a schema that has read-only properties. Needs respectReadonlySchemas."
|
|
1650
|
+
),
|
|
1651
|
+
exampleGeneration: exampleGenerationSchema.optional().describe("How deep the examples generated for operations without one go."),
|
|
1652
|
+
filter: endpointFilterSchema.optional().describe("Restricts the import to a list of endpoints."),
|
|
1653
|
+
groupEnvironmentsByHost: zod.z.boolean().optional().describe("Whether HTTP and WebSocket servers with the same host become one environment."),
|
|
1654
|
+
multiServerStrategy: zod.z.enum(["environment-per-server", "urls-per-environment"]).optional().describe(
|
|
1655
|
+
"Whether each named server is its own environment or a named URL of one environment."
|
|
1656
|
+
),
|
|
1657
|
+
inferDefaultEnvironment: zod.z.boolean().optional().describe("Whether the first server becomes the default environment."),
|
|
1658
|
+
respectPerSpecBasePath: zod.z.boolean().optional().describe("Whether each spec's plain x-fern-base-path applies to that spec's endpoints."),
|
|
1659
|
+
errorResponses: errorResponsesSchema.optional().describe("A shared error body schema applied to the 4xx/5xx responses of the specs.")
|
|
1372
1660
|
});
|
|
1373
1661
|
var sourceSpecTypeSchema = zod.z.enum([
|
|
1374
1662
|
"openapi",
|
|
@@ -1554,63 +1842,71 @@ var sdkConfigIrV1Schema = zod.z.strictObject({
|
|
|
1554
1842
|
"Shared and language-specific generation behavior."
|
|
1555
1843
|
),
|
|
1556
1844
|
compatibility: compatibilityConfigSchema.optional().describe("Temporary provenance and diagnostics retained during legacy migration.")
|
|
1557
|
-
}).superRefine(
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
[
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1845
|
+
}).superRefine(
|
|
1846
|
+
({ api, compatibility, generation, output, package: packageConfig, target }, context) => {
|
|
1847
|
+
const configuredLanguages = Object.keys(generation.language ?? {});
|
|
1848
|
+
const requiresExternalPublishIdentity = output.delivery === "github" || output.publish !== void 0;
|
|
1849
|
+
if (requiresExternalPublishIdentity) {
|
|
1850
|
+
[
|
|
1851
|
+
["apiName", "target.apiName is required for external publishing"],
|
|
1852
|
+
["organizationName", "target.organizationName is required for external publishing"]
|
|
1853
|
+
].forEach(([field, message]) => {
|
|
1854
|
+
if (!target[field]) {
|
|
1855
|
+
context.addIssue({
|
|
1856
|
+
code: "custom",
|
|
1857
|
+
message,
|
|
1858
|
+
path: ["target", field]
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
oauthTokenEndpointsIssues(generation.language?.cli?.oauthTokenEndpoints, api.auth?.schemes, [
|
|
1864
|
+
"generation",
|
|
1865
|
+
"language",
|
|
1866
|
+
"cli",
|
|
1867
|
+
"oauthTokenEndpoints"
|
|
1868
|
+
]).forEach((issue) => context.addIssue({ code: "custom", ...issue }));
|
|
1869
|
+
configuredLanguages.forEach((language) => {
|
|
1870
|
+
if (language !== target.language) {
|
|
1566
1871
|
context.addIssue({
|
|
1567
1872
|
code: "custom",
|
|
1568
|
-
message
|
|
1569
|
-
path: ["
|
|
1873
|
+
message: `generation.language.${language} does not match target language "${target.language}"`,
|
|
1874
|
+
path: ["generation", "language", language]
|
|
1570
1875
|
});
|
|
1571
1876
|
}
|
|
1572
1877
|
});
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1878
|
+
if (output.publish && !publishRegistryLanguages[output.publish.registry].some(
|
|
1879
|
+
(language) => language === target.language
|
|
1880
|
+
)) {
|
|
1576
1881
|
context.addIssue({
|
|
1577
1882
|
code: "custom",
|
|
1578
|
-
message: `
|
|
1579
|
-
path: ["
|
|
1883
|
+
message: `registry "${output.publish.registry}" is not supported for target language "${target.language}"`,
|
|
1884
|
+
path: ["output", "publish", "registry"]
|
|
1580
1885
|
});
|
|
1581
1886
|
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
}
|
|
1592
|
-
if (output.publish) {
|
|
1593
|
-
validatePublishingIdentity(packageConfig, output.publish.registry, context);
|
|
1594
|
-
if (output.delivery !== "github" && output.publish.shouldGeneratePublishWorkflow === true) {
|
|
1595
|
-
context.addIssue({
|
|
1596
|
-
code: "custom",
|
|
1597
|
-
message: "output.publish.shouldGeneratePublishWorkflow requires GitHub delivery",
|
|
1598
|
-
path: ["output", "publish", "shouldGeneratePublishWorkflow"]
|
|
1599
|
-
});
|
|
1887
|
+
if (output.publish) {
|
|
1888
|
+
validatePublishingIdentity(packageConfig, output.publish.registry, context);
|
|
1889
|
+
if (output.delivery !== "github" && output.publish.shouldGeneratePublishWorkflow === true) {
|
|
1890
|
+
context.addIssue({
|
|
1891
|
+
code: "custom",
|
|
1892
|
+
message: "output.publish.shouldGeneratePublishWorkflow requires GitHub delivery",
|
|
1893
|
+
path: ["output", "publish", "shouldGeneratePublishWorkflow"]
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1600
1896
|
}
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
}
|
|
1897
|
+
validateCliOutput(output, target.language, context);
|
|
1898
|
+
if (compatibility?.legacyInput) {
|
|
1899
|
+
const expectedKind = target.sourceOrigin === "postman" ? "postman-build-parameters" : "fern-generator-invocation";
|
|
1900
|
+
if (compatibility.legacyInput.kind !== expectedKind) {
|
|
1901
|
+
context.addIssue({
|
|
1902
|
+
code: "custom",
|
|
1903
|
+
message: `compatibility.legacyInput kind "${compatibility.legacyInput.kind}" does not match target.sourceOrigin "${target.sourceOrigin}"`,
|
|
1904
|
+
path: ["compatibility", "legacyInput", "kind"]
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1611
1907
|
}
|
|
1612
1908
|
}
|
|
1613
|
-
|
|
1909
|
+
);
|
|
1614
1910
|
function parseSdkConfigIrV1(value) {
|
|
1615
1911
|
return sdkConfigIrV1Schema.parse(value);
|
|
1616
1912
|
}
|
|
@@ -1794,6 +2090,7 @@ exports.legacyInputSchema = legacyInputSchema;
|
|
|
1794
2090
|
exports.mcpAvailabilityStatuses = mcpAvailabilityStatuses;
|
|
1795
2091
|
exports.mcpGenerationConfigSchema = mcpGenerationConfigSchema;
|
|
1796
2092
|
exports.nonEmptyStringSchema = nonEmptyStringSchema;
|
|
2093
|
+
exports.oauthTokenEndpointsIssues = oauthTokenEndpointsIssues;
|
|
1797
2094
|
exports.outputConfigSchema = outputConfigSchema;
|
|
1798
2095
|
exports.packageConfigSchema = packageConfigSchema;
|
|
1799
2096
|
exports.parentRelativePathSchema = parentRelativePathSchema;
|