@postman/sdk-config 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -36,9 +36,7 @@ const input: SdkConfigV1Input = {
36
36
  source: {
37
37
  specs: [{ id: 'example', type: 'openapi', path: './openapi.yml' }],
38
38
  },
39
- api: {},
40
39
  client: { timeoutMs: 30_000 },
41
- package: {},
42
40
  output: { delivery: 'zip', fileName: 'example-typescript.zip' },
43
41
  docs: { includeApiReference: true },
44
42
  generation: { includeWatermark: true },
@@ -59,6 +57,9 @@ const sdkConfig: SdkConfigV1 = parseSdkConfigV1(document);
59
57
  Use `parseSdkConfigV1` when entering the runtime boundary and materializing the shared domain
60
58
  defaults. For validation without throwing, use the exported schema:
61
59
 
60
+ Empty top-level `api`, `client`, `package`, `docs`, and `generation` blocks may be omitted from the
61
+ customer document. Runtime parsing materializes those blocks and their versioned defaults.
62
+
62
63
  ```ts
63
64
  import { sdkConfigV1Schema } from '@postman/sdk-config/sdk-config/v1';
64
65
 
package/dist/index.cjs CHANGED
@@ -283,8 +283,8 @@ var clientConfigSchema = zod.z.strictObject({
283
283
  var sdkConfigV1ClientConfigSchema = clientConfigSchema;
284
284
  var sdkConfigV1ClientConfigOverrideSchema = clientConfigOverrideSchema;
285
285
  var goModulePathSchema = relativePathSchema.regex(
286
- /^(?!.*(?:^|\/)\.{1,2}(?:\/|$))[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)+$/,
287
- "Go module path must be a slash-delimited path using letters, numbers, dots, dashes, underscores, or tildes"
286
+ /^(?!.*(?:^|\/)\.{1,2}(?:\/|$))[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)*$/,
287
+ "Go module path must use letters, numbers, dots, dashes, underscores or tildes, in slash-delimited segments"
288
288
  );
289
289
  var composerPackageNameSchema = nonEmptyStringSchema.regex(
290
290
  /^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$/,
@@ -549,6 +549,9 @@ function compact(value) {
549
549
  function optional(key, value) {
550
550
  return value === void 0 ? {} : { [key]: value };
551
551
  }
552
+ function optionalObject(key, value) {
553
+ return Object.keys(value).length === 0 ? {} : { [key]: value };
554
+ }
552
555
  function isObject(value) {
553
556
  return value !== null && typeof value === "object" && !Array.isArray(value);
554
557
  }
@@ -1558,12 +1561,12 @@ var sdkConfigV1Schema = zod.z.strictObject({
1558
1561
  sdkVersion: nonEmptyStringSchema.default("1.0.0"),
1559
1562
  apiVersion: nonEmptyStringSchema.optional(),
1560
1563
  source: sdkConfigV1SourceConfigSchema,
1561
- api: sdkConfigV1ApiConfigSchema,
1562
- client: sdkConfigV1ClientConfigSchema,
1563
- package: sdkConfigV1PackageConfigSchema,
1564
+ api: sdkConfigV1ApiConfigSchema.prefault({}),
1565
+ client: sdkConfigV1ClientConfigSchema.prefault({}),
1566
+ package: sdkConfigV1PackageConfigSchema.prefault({}),
1564
1567
  output: sdkConfigV1OutputConfigSchema.optional(),
1565
- docs: sdkConfigV1DocsConfigSchema,
1566
- generation: sdkConfigV1GenerationConfigSchema,
1568
+ docs: sdkConfigV1DocsConfigSchema.prefault({}),
1569
+ generation: sdkConfigV1GenerationConfigSchema.prefault({}),
1567
1570
  targets: zod.z.array(sdkConfigV1TargetSchema).min(1)
1568
1571
  }).superRefine(({ output, package: globalPackage, targets }, context) => {
1569
1572
  const configuredLanguages = /* @__PURE__ */ new Set();
@@ -1679,11 +1682,10 @@ function mapFernConfigToSdkConfigV1(input) {
1679
1682
  source: input.source,
1680
1683
  ...optional("sdkVersion", input.sdkVersion),
1681
1684
  ...optional("apiVersion", input.apiVersion),
1682
- api,
1683
- client: clients.shared,
1684
- package: {},
1685
- docs: docs.shared,
1686
- generation: generations.shared,
1685
+ ...optionalObject("api", api),
1686
+ ...optionalObject("client", clients.shared),
1687
+ ...optionalObject("docs", docs.shared),
1688
+ ...optionalObject("generation", generations.shared),
1687
1689
  targets
1688
1690
  };
1689
1691
  const parsed = sdkConfigV1Schema.safeParse(sdkConfig);