@cinnabun/openapi 0.0.11 → 0.0.13
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.
|
@@ -26,7 +26,7 @@ describe("openapi-generator", () => {
|
|
|
26
26
|
class OpenApiSpecUserController {
|
|
27
27
|
@GetMapping("/")
|
|
28
28
|
@ApiOperation({ summary: "List users" })
|
|
29
|
-
@ApiResponse(200,
|
|
29
|
+
@ApiResponse({ status: 200, description: "List of users" })
|
|
30
30
|
findAll() {
|
|
31
31
|
return [];
|
|
32
32
|
}
|
|
@@ -146,7 +146,7 @@ describe("openapi-generator", () => {
|
|
|
146
146
|
@RestController("/openapi-response-users")
|
|
147
147
|
class OpenApiResponseUserController {
|
|
148
148
|
@GetMapping("/")
|
|
149
|
-
@ApiResponse(200,
|
|
149
|
+
@ApiResponse({ status: 200, description: "List of users" })
|
|
150
150
|
list() {
|
|
151
151
|
return [];
|
|
152
152
|
}
|
|
@@ -23,7 +23,7 @@ describe("route-scanner", () => {
|
|
|
23
23
|
class OpenApiRouteUserController {
|
|
24
24
|
@GetMapping("/")
|
|
25
25
|
@ApiOperation({ summary: "List users" })
|
|
26
|
-
@ApiResponse(200,
|
|
26
|
+
@ApiResponse({ status: 200, description: "List of users" })
|
|
27
27
|
findAll() {
|
|
28
28
|
return [];
|
|
29
29
|
}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type?: any;
|
|
4
|
-
}): MethodDecorator;
|
|
1
|
+
import { type ApiResponseMetadata } from "../metadata/openapi-storage.js";
|
|
2
|
+
export declare function ApiResponse(metadata: ApiResponseMetadata): MethodDecorator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { openApiMetadataStorage } from "../metadata/openapi-storage.js";
|
|
2
|
-
export function ApiResponse(
|
|
1
|
+
import { openApiMetadataStorage, } from "../metadata/openapi-storage.js";
|
|
2
|
+
export function ApiResponse(metadata) {
|
|
3
3
|
return (target, propertyKey) => {
|
|
4
|
-
openApiMetadataStorage.addResponse(target.constructor, propertyKey,
|
|
4
|
+
openApiMetadataStorage.addResponse(target.constructor, propertyKey, metadata);
|
|
5
5
|
};
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cinnabun/openapi",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build": "tsc"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@cinnabun/core": "
|
|
15
|
+
"@cinnabun/core": "*"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"zod-to-json-schema": "^3.24.1"
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
openApiMetadataStorage,
|
|
3
|
+
type ApiResponseMetadata,
|
|
4
|
+
} from "../metadata/openapi-storage.js";
|
|
2
5
|
|
|
3
|
-
export function ApiResponse(
|
|
4
|
-
status: number,
|
|
5
|
-
metadata: { description: string; type?: any },
|
|
6
|
-
): MethodDecorator {
|
|
6
|
+
export function ApiResponse(metadata: ApiResponseMetadata): MethodDecorator {
|
|
7
7
|
return (target: any, propertyKey: string | symbol) => {
|
|
8
8
|
openApiMetadataStorage.addResponse(
|
|
9
9
|
target.constructor,
|
|
10
10
|
propertyKey as string,
|
|
11
|
-
|
|
11
|
+
metadata,
|
|
12
12
|
);
|
|
13
13
|
};
|
|
14
14
|
}
|