@innet/server 2.0.0-beta.12 → 2.0.0-beta.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.
package/hooks/useApi/useApi.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Context } from '@innet/jsx';
|
|
2
|
+
import { type ApiProps } from '../../plugins';
|
|
2
3
|
import { type Document, type Endpoints } from '../../types';
|
|
3
4
|
import { type Rule } from '../../utils';
|
|
4
5
|
export interface ApiContext {
|
|
5
6
|
docs: Document;
|
|
6
7
|
endpoints: Endpoints;
|
|
7
8
|
prefix: string;
|
|
9
|
+
props: ApiProps;
|
|
8
10
|
refRules: Record<string, Rule>;
|
|
9
11
|
}
|
|
10
12
|
export declare const apiContext: Context<ApiContext, ApiContext | undefined>;
|
|
@@ -30,9 +30,7 @@ function useSchemaType(type, { example, examples, ref, values, ...options } = {}
|
|
|
30
30
|
const arrayValues = values ? Array.isArray(values) ? values : Object.keys(values) : values;
|
|
31
31
|
const enumDescription = values && !Array.isArray(values)
|
|
32
32
|
? {
|
|
33
|
-
'x-
|
|
34
|
-
'x-enumDescriptions': values,
|
|
35
|
-
'x-enumNames': values,
|
|
33
|
+
[process.env.INNET_API_ENUM_DESCRIPTION_KEY || 'x-enumNames']: values,
|
|
36
34
|
}
|
|
37
35
|
: {};
|
|
38
36
|
return useNewSchema({
|
|
@@ -34,9 +34,7 @@ function useSchemaType(type, { example, examples, ref, values, ...options } = {}
|
|
|
34
34
|
const arrayValues = values ? Array.isArray(values) ? values : Object.keys(values) : values;
|
|
35
35
|
const enumDescription = values && !Array.isArray(values)
|
|
36
36
|
? {
|
|
37
|
-
'x-
|
|
38
|
-
'x-enumDescriptions': values,
|
|
39
|
-
'x-enumNames': values,
|
|
37
|
+
[process.env.INNET_API_ENUM_DESCRIPTION_KEY || 'x-enumNames']: values,
|
|
40
38
|
}
|
|
41
39
|
: {};
|
|
42
40
|
return useNewSchema.useNewSchema({
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ const api = () => {
|
|
|
23
23
|
paths: {},
|
|
24
24
|
};
|
|
25
25
|
const plugins = new Set();
|
|
26
|
-
const context = { docs, endpoints, prefix, refRules: {} };
|
|
26
|
+
const context = { docs, endpoints, prefix, props, refRules: {} };
|
|
27
27
|
const condition = (action) => {
|
|
28
28
|
const path = action.parsedUrl.path;
|
|
29
29
|
const url = path.endsWith('/') ? path.slice(0, -1) : path;
|
package/plugins/main/api/api.js
CHANGED
|
@@ -27,7 +27,7 @@ const api = () => {
|
|
|
27
27
|
paths: {},
|
|
28
28
|
};
|
|
29
29
|
const plugins = new Set();
|
|
30
|
-
const context = { docs, endpoints, prefix, refRules: {} };
|
|
30
|
+
const context = { docs, endpoints, prefix, props, refRules: {} };
|
|
31
31
|
const condition = (action) => {
|
|
32
32
|
const path = action.parsedUrl.path;
|
|
33
33
|
const url = path.endsWith('/') ? path.slice(0, -1) : path;
|