@kubb/adapter-oas 5.0.0-alpha.11 → 5.0.0-alpha.12

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 CHANGED
@@ -185,9 +185,12 @@ function toCamelOrPascal(text, pascal) {
185
185
  * Splits `text` on `.` and applies `transformPart` to each segment.
186
186
  * The last segment receives `isLast = true`, all earlier segments receive `false`.
187
187
  * Segments are joined with `/` to form a file path.
188
+ *
189
+ * Only splits on dots followed by a letter so that version numbers
190
+ * embedded in operationIds (e.g. `v2025.0`) are kept intact.
188
191
  */
189
192
  function applyToFileParts(text, transformPart) {
190
- const parts = text.split(".");
193
+ const parts = text.split(/\.(?=[a-zA-Z])/);
191
194
  return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
192
195
  }
193
196
  /**
@@ -1822,18 +1825,26 @@ function createOasParser(oas, { contentType, collisionDetection } = {}) {
1822
1825
  function parseOperation(options, oas, operation) {
1823
1826
  const parameters = oas.getParameters(operation).map((param) => parseParameter(options, param));
1824
1827
  const requestBodySchema = oas.getRequestSchema(operation);
1825
- const requestBody = requestBodySchema ? convertSchema({ schema: requestBodySchema }, options) : void 0;
1828
+ const requestBodySchemaNode = requestBodySchema ? convertSchema({ schema: requestBodySchema }, options) : void 0;
1829
+ const requestBodyKeysToOmit = requestBodySchema?.properties ? Object.entries(requestBodySchema.properties).filter(([, prop]) => !isReference(prop) && prop.readOnly).map(([key]) => key) : void 0;
1830
+ const requestBody = requestBodySchemaNode ? {
1831
+ schema: requestBodySchemaNode,
1832
+ keysToOmit: requestBodyKeysToOmit?.length ? requestBodyKeysToOmit : void 0
1833
+ } : void 0;
1826
1834
  const responses = operation.getResponseStatusCodes().map((statusCode) => {
1827
1835
  const responseObj = operation.getResponseByStatusCode(statusCode);
1828
1836
  const responseSchema = oas.getResponseSchema(operation, statusCode);
1829
1837
  const schema = responseSchema && Object.keys(responseSchema).length > 0 ? convertSchema({ schema: responseSchema }, options) : (0, _kubb_ast.createSchema)({ type: resolveTypeOption(options.emptySchemaType) });
1830
1838
  const description = typeof responseObj === "object" && responseObj !== null && !Array.isArray(responseObj) ? responseObj.description : void 0;
1831
1839
  const rawContent = typeof responseObj === "object" && responseObj !== null && !Array.isArray(responseObj) ? responseObj.content : void 0;
1840
+ const mediaType = rawContent ? toMediaType(Object.keys(rawContent)[0] ?? "") : toMediaType(operation.contentType ?? "");
1841
+ const keysToOmit = responseSchema?.properties ? Object.entries(responseSchema.properties).filter(([, prop]) => !isReference(prop) && prop.writeOnly).map(([key]) => key) : void 0;
1832
1842
  return (0, _kubb_ast.createResponse)({
1833
1843
  statusCode,
1834
1844
  description,
1835
1845
  schema,
1836
- mediaType: rawContent ? toMediaType(Object.keys(rawContent)[0] ?? "") : toMediaType(operation.contentType ?? "")
1846
+ mediaType,
1847
+ keysToOmit: keysToOmit?.length ? keysToOmit : void 0
1837
1848
  });
1838
1849
  });
1839
1850
  return (0, _kubb_ast.createOperation)({