@tahminator/sapling 2.0.5-beta.66bccb38 → 2.0.5-beta.8f108a3e
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 +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -548,18 +548,18 @@ var OpenAPIGenerator = class {
|
|
|
548
548
|
const schemas = _getValidatorSchema(controllerClass, route.fnName);
|
|
549
549
|
const routeSchema = _getRouteSchema(controllerClass, route.fnName);
|
|
550
550
|
if (route.path instanceof RegExp) throw new Error(`You have a route with a regex path of ${route.path.source}. This is not compatible with OpenAPI.`);
|
|
551
|
-
const openApiPath = prefix + route.path;
|
|
551
|
+
const openApiPath = (prefix + route.path).replace(/:([A-Za-z0-9_]+)/g, "{$1}");
|
|
552
552
|
if (!paths[openApiPath]) paths[openApiPath] = {};
|
|
553
553
|
const responses = {};
|
|
554
554
|
if (schemas?.responseBody) {
|
|
555
|
-
const responseSchema = this.toJsonSchema(schemas.responseBody, "
|
|
555
|
+
const responseSchema = this.toJsonSchema(schemas.responseBody, "output");
|
|
556
556
|
responses["200"] = {
|
|
557
557
|
description: responseSchema.description ?? "Successful response",
|
|
558
558
|
content: { "application/json": { schema: responseSchema } }
|
|
559
559
|
};
|
|
560
560
|
} else responses["200"] = { description: "Successful response" };
|
|
561
561
|
if (routeSchema?.responses) for (const resp of routeSchema.responses) {
|
|
562
|
-
const responseSchema = this.toJsonSchema(resp.schema, "
|
|
562
|
+
const responseSchema = this.toJsonSchema(resp.schema, "output");
|
|
563
563
|
responses[String(resp.statusCode)] = {
|
|
564
564
|
description: responseSchema.description ?? `Response ${resp.statusCode}`,
|
|
565
565
|
content: { "application/json": { schema: responseSchema } }
|
package/dist/index.mjs
CHANGED
|
@@ -523,18 +523,18 @@ var OpenAPIGenerator = class {
|
|
|
523
523
|
const schemas = _getValidatorSchema(controllerClass, route.fnName);
|
|
524
524
|
const routeSchema = _getRouteSchema(controllerClass, route.fnName);
|
|
525
525
|
if (route.path instanceof RegExp) throw new Error(`You have a route with a regex path of ${route.path.source}. This is not compatible with OpenAPI.`);
|
|
526
|
-
const openApiPath = prefix + route.path;
|
|
526
|
+
const openApiPath = (prefix + route.path).replace(/:([A-Za-z0-9_]+)/g, "{$1}");
|
|
527
527
|
if (!paths[openApiPath]) paths[openApiPath] = {};
|
|
528
528
|
const responses = {};
|
|
529
529
|
if (schemas?.responseBody) {
|
|
530
|
-
const responseSchema = this.toJsonSchema(schemas.responseBody, "
|
|
530
|
+
const responseSchema = this.toJsonSchema(schemas.responseBody, "output");
|
|
531
531
|
responses["200"] = {
|
|
532
532
|
description: responseSchema.description ?? "Successful response",
|
|
533
533
|
content: { "application/json": { schema: responseSchema } }
|
|
534
534
|
};
|
|
535
535
|
} else responses["200"] = { description: "Successful response" };
|
|
536
536
|
if (routeSchema?.responses) for (const resp of routeSchema.responses) {
|
|
537
|
-
const responseSchema = this.toJsonSchema(resp.schema, "
|
|
537
|
+
const responseSchema = this.toJsonSchema(resp.schema, "output");
|
|
538
538
|
responses[String(resp.statusCode)] = {
|
|
539
539
|
description: responseSchema.description ?? `Response ${resp.statusCode}`,
|
|
540
540
|
content: { "application/json": { schema: responseSchema } }
|