@kubb/adapter-oas 5.29.2 → 5.29.4

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.d.cts CHANGED
@@ -1277,12 +1277,11 @@ type ServerOptions = {
1277
1277
  */
1278
1278
  type AdapterOasOptions = {
1279
1279
  /**
1280
- * Validate the OpenAPI spec with `@readme/openapi-parser` before parsing. Each problem is
1281
- * reported as a `KUBB_INVALID_SPEC` warning and generation continues. Set to `false` to skip the
1282
- * check, which also makes generation faster on a large spec. An OpenAPI 3.2 document is not
1283
- * validated yet and gets one warning that says so.
1280
+ * Check the OpenAPI spec with `@readme/openapi-parser` while generating, and report each problem
1281
+ * as a `KUBB_INVALID_SPEC` warning without stopping the build. The check is off by default
1282
+ * because it slows down a large spec. Run `kubb validate` to check a spec on its own.
1284
1283
  *
1285
- * @default true
1284
+ * @default false
1286
1285
  */
1287
1286
  validate?: boolean;
1288
1287
  /**
@@ -1355,9 +1354,9 @@ type AdapterOas = AdapterFactoryOptions<'oas', AdapterOasOptions, AdapterOasReso
1355
1354
  export declare const adapterOasName = "oas";
1356
1355
  /**
1357
1356
  * Default Kubb adapter for OpenAPI 2.0, 3.0, 3.1, and 3.2 specifications. Reads the
1358
- * spec from `input` (a file path, URL, inline content, or parsed object), validates
1359
- * it, resolves the base URL, and converts every schema and operation into the
1360
- * universal AST that every downstream plugin consumes.
1357
+ * spec from `input` (a file path, URL, inline content, or parsed object), resolves
1358
+ * the base URL, and converts every schema and operation into the universal AST that
1359
+ * every downstream plugin consumes. Set `validate: true` to also check the spec.
1361
1360
  *
1362
1361
  * Configure once on `defineConfig`. The adapter's choices (date representation,
1363
1362
  * integer width, server URL) apply to every plugin in the build.
package/dist/index.d.ts CHANGED
@@ -1277,12 +1277,11 @@ type ServerOptions = {
1277
1277
  */
1278
1278
  type AdapterOasOptions = {
1279
1279
  /**
1280
- * Validate the OpenAPI spec with `@readme/openapi-parser` before parsing. Each problem is
1281
- * reported as a `KUBB_INVALID_SPEC` warning and generation continues. Set to `false` to skip the
1282
- * check, which also makes generation faster on a large spec. An OpenAPI 3.2 document is not
1283
- * validated yet and gets one warning that says so.
1280
+ * Check the OpenAPI spec with `@readme/openapi-parser` while generating, and report each problem
1281
+ * as a `KUBB_INVALID_SPEC` warning without stopping the build. The check is off by default
1282
+ * because it slows down a large spec. Run `kubb validate` to check a spec on its own.
1284
1283
  *
1285
- * @default true
1284
+ * @default false
1286
1285
  */
1287
1286
  validate?: boolean;
1288
1287
  /**
@@ -1355,9 +1354,9 @@ type AdapterOas = AdapterFactoryOptions<'oas', AdapterOasOptions, AdapterOasReso
1355
1354
  export declare const adapterOasName = "oas";
1356
1355
  /**
1357
1356
  * Default Kubb adapter for OpenAPI 2.0, 3.0, 3.1, and 3.2 specifications. Reads the
1358
- * spec from `input` (a file path, URL, inline content, or parsed object), validates
1359
- * it, resolves the base URL, and converts every schema and operation into the
1360
- * universal AST that every downstream plugin consumes.
1357
+ * spec from `input` (a file path, URL, inline content, or parsed object), resolves
1358
+ * the base URL, and converts every schema and operation into the universal AST that
1359
+ * every downstream plugin consumes. Set `validate: true` to also check the spec.
1361
1360
  *
1362
1361
  * Configure once on `defineConfig`. The adapter's choices (date representation,
1363
1362
  * integer width, server URL) apply to every plugin in the build.
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var compatibility = {
14
14
  "node": ">=22.22"
15
15
  };
16
16
  // package.json
17
- var version = "5.29.2";
17
+ var version = "5.29.4";
18
18
  // src/constants.ts
19
19
  /**
20
20
  * Default parser options applied when no explicit options are provided.
@@ -4007,8 +4007,10 @@ function convertObject({ schema, name, nullable, defaultValue, options, parse, r
4007
4007
  * Converts an OAS 3.1 `prefixItems` tuple into a `TupleSchemaNode`.
4008
4008
  */
4009
4009
  function convertTuple({ schema, name, nullable, defaultValue, options, parse }) {
4010
- const tupleItems = (schema.prefixItems ?? []).map((item) => parse({ schema: item }));
4011
- const tail = schema.items ?? schema.unevaluatedItems;
4010
+ const prefixItems = schema.prefixItems ?? [];
4011
+ const isClosed = schema.maxItems !== void 0 && schema.maxItems <= prefixItems.length;
4012
+ const tupleItems = (isClosed ? prefixItems.slice(0, schema.maxItems) : prefixItems).map((item) => parse({ schema: item }));
4013
+ const tail = isClosed ? false : schema.items ?? schema.unevaluatedItems;
4012
4014
  const rest = tail === false ? void 0 : !tail || tail === true ? ast.factory.createSchema({ type: options.unknownType }) : parse({ schema: tail });
4013
4015
  return createNode({
4014
4016
  schema,
@@ -4644,9 +4646,9 @@ function toInputMeta({ document, server, authSchemes }) {
4644
4646
  }
4645
4647
  /**
4646
4648
  * Default Kubb adapter for OpenAPI 2.0, 3.0, 3.1, and 3.2 specifications. Reads the
4647
- * spec from `input` (a file path, URL, inline content, or parsed object), validates
4648
- * it, resolves the base URL, and converts every schema and operation into the
4649
- * universal AST that every downstream plugin consumes.
4649
+ * spec from `input` (a file path, URL, inline content, or parsed object), resolves
4650
+ * the base URL, and converts every schema and operation into the universal AST that
4651
+ * every downstream plugin consumes. Set `validate: true` to also check the spec.
4650
4652
  *
4651
4653
  * Configure once on `defineConfig`. The adapter's choices (date representation,
4652
4654
  * integer width, server URL) apply to every plugin in the build.
@@ -4677,7 +4679,7 @@ const adapterOas = defineExtension({
4677
4679
  compatibility,
4678
4680
  issues: "https://github.com/kubb-labs/kubb/issues"
4679
4681
  },
4680
- setup: ({ validate = true, contentType, server, discriminator = "preserve", enums = "inline", pathParamsCasing, dateType = DEFAULT_PARSER_OPTIONS.dateType, integerType = DEFAULT_PARSER_OPTIONS.integerType, unknownType = DEFAULT_PARSER_OPTIONS.unknownType, enumSuffix = DEFAULT_PARSER_OPTIONS.enumSuffix, emptySchemaType = unknownType || DEFAULT_PARSER_OPTIONS.emptySchemaType }) => ({
4682
+ setup: ({ validate = false, contentType, server, discriminator = "preserve", enums = "inline", pathParamsCasing, dateType = DEFAULT_PARSER_OPTIONS.dateType, integerType = DEFAULT_PARSER_OPTIONS.integerType, unknownType = DEFAULT_PARSER_OPTIONS.unknownType, enumSuffix = DEFAULT_PARSER_OPTIONS.enumSuffix, emptySchemaType = unknownType || DEFAULT_PARSER_OPTIONS.emptySchemaType }) => ({
4681
4683
  validate,
4682
4684
  contentType,
4683
4685
  server,