toolcraft-openapi 0.0.224 → 0.0.225
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/README.md +16 -0
- package/dist/composition.json +2 -2
- package/node_modules/@poe-code/frontmatter/README.md +2 -0
- package/node_modules/toolcraft-design/README.md +3 -3
- package/node_modules/toolcraft-schema/README.md +8 -5
- package/node_modules/toolcraft-schema/package.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -99,6 +99,9 @@ toolcraft-openapi-generate --check
|
|
|
99
99
|
|
|
100
100
|
- `bearerTokenAuth(opts)`
|
|
101
101
|
- `requestJson(options)`
|
|
102
|
+
- `generate(document, options)`
|
|
103
|
+
- `generateSkill(document, options)`
|
|
104
|
+
- `validateArrayJsonHelperValue(value, definition, label)`
|
|
102
105
|
- `HttpError`
|
|
103
106
|
- `readToolcraftConfig(path)`
|
|
104
107
|
- `validateToolcraftConfig(value)`
|
|
@@ -107,6 +110,7 @@ toolcraft-openapi-generate --check
|
|
|
107
110
|
- `formatDiagnostic(diagnostic)`
|
|
108
111
|
- `formatDiagnostics(diagnostics)`
|
|
109
112
|
- `resolveOpenApiBaseUrl(options)`
|
|
113
|
+
- `mockFetch(options)` from the `toolcraft-openapi/mock` subpath for spec-backed test doubles.
|
|
110
114
|
- `DIAGNOSTIC_CODES`
|
|
111
115
|
- `TokenSource`
|
|
112
116
|
- `CommandContributor`
|
|
@@ -167,6 +171,12 @@ Mapped idempotent methods with `client_settings.idempotency_header` get an optio
|
|
|
167
171
|
`rawResponse` param that returns `{ data, response }`; the CLI accepts both `--raw-response` and
|
|
168
172
|
`--raw`.
|
|
169
173
|
|
|
174
|
+
Generated JSON helper params for arrays validate `minItems` and `maxItems` before dispatch. Nested
|
|
175
|
+
request-body object fields are exposed as typed `S.Object(...)` params, including required
|
|
176
|
+
properties and `additionalProperties: false` validation when the OpenAPI schema forbids unknown
|
|
177
|
+
keys. For OpenAPI compositions where every equivalent `oneOf`/`anyOf` branch has enum values,
|
|
178
|
+
generation preserves the merged enum values in the resulting schema.
|
|
179
|
+
|
|
170
180
|
Diagnostics use stable codes:
|
|
171
181
|
|
|
172
182
|
- `TOOLCRAFT_OPENAPI_001` - endpoint is not mapped or listed in `unspecified_endpoints`.
|
|
@@ -177,6 +187,12 @@ Diagnostics use stable codes:
|
|
|
177
187
|
- `TOOLCRAFT_OPENAPI_006` - missing or unsupported edition.
|
|
178
188
|
- `TOOLCRAFT_OPENAPI_007` - invalid config shape.
|
|
179
189
|
|
|
190
|
+
### Mock fetch
|
|
191
|
+
|
|
192
|
+
`toolcraft-openapi/mock` exports `mockFetch(options)` for tests. It matches requests against an
|
|
193
|
+
OpenAPI document, records requests, validates path/query/header parameters and request bodies, and
|
|
194
|
+
validates response fixtures against exact or range response schemas such as `2XX`.
|
|
195
|
+
|
|
180
196
|
### `bearerTokenAuth(opts)`
|
|
181
197
|
|
|
182
198
|
- `serviceName: string` - auth-store service name and file-store key.
|
package/dist/composition.json
CHANGED
|
@@ -36,3 +36,5 @@ This package reads no environment variables.
|
|
|
36
36
|
## Configuration Options
|
|
37
37
|
|
|
38
38
|
This package has no configuration options.
|
|
39
|
+
|
|
40
|
+
Diagnostics retain source offsets, including CRLF input. Opening fences may have trailing spaces or tabs; a missing closing fence is reported as a diagnostic. Writing frontmatter requires an object root.
|
|
@@ -54,7 +54,7 @@ import { renderTable } from "toolcraft-design/render-table";
|
|
|
54
54
|
- `helpFormatter`, `helpFormatterPlain`: styled and plain help formatting APIs.
|
|
55
55
|
- `formatColumns`, `formatCommand`, `formatUsage`, `formatOption`, `formatCommandList`, `formatOptionList`: individual help-formatting functions.
|
|
56
56
|
- `formatCommandNotFound`, `formatCommandNotFoundPanel`: command error rendering.
|
|
57
|
-
- `renderTable`, `renderDetailCard`: tabular
|
|
57
|
+
- `renderTable`, `renderDetailCard`, `renderInspectorCard`, `renderResourceBrowser`: tabular, detail-card, inspector-panel, and grouped resource-browser rendering.
|
|
58
58
|
- `getTemplatePartialNames`, `renderTemplate`, `resolveTemplatePartials`: template rendering utilities.
|
|
59
59
|
- `openExternal`: opens a URL or file with the platform browser command.
|
|
60
60
|
- Types: `Color`, `LoggerOutput`, `CommandInfo`, `OptionInfo`, `FormatColumnsOptions`, `TableColumn`, `RenderTableOptions`, `DetailCardRow`, `DetailCardSection`, `RenderDetailCardOptions`, `RenderTemplateOptions`, `TemplateEscape`.
|
|
@@ -79,8 +79,8 @@ import { renderTable } from "toolcraft-design/render-table";
|
|
|
79
79
|
### Explorer
|
|
80
80
|
|
|
81
81
|
- `explorer`: namespace containing the complete explorer API.
|
|
82
|
-
- `runExplorer`, `singleDetail`: root-level explorer exports.
|
|
83
|
-
- Root-level types: `Row`, `DetailItem`, `Detail`, `DetailCtx`, `Action`, `ActionContext`, `ExplorerConfig`, `ReorderContext`, `Tone`.
|
|
82
|
+
- `runExplorer`, `runTwoPaneExplorer`, `singleDetail`: root-level explorer exports.
|
|
83
|
+
- Root-level types: `Row`, `DetailItem`, `Detail`, `DetailCtx`, `Action`, `ActionContext`, `ExplorerConfig`, `ReorderContext`, `Tone`, `TwoPaneExplorerConfig`, `TwoPaneRow`, `TwoPaneAction`, `TwoPaneActionContext`.
|
|
84
84
|
- The namespace also exports `createInitialState`, `resolveBindings`, and the remaining explorer event, binding, layout, size, state, and effect types.
|
|
85
85
|
|
|
86
86
|
Explorers declare one to three list or detail panes. Printable input always filters; actions use optional Ctrl accelerators:
|
|
@@ -19,10 +19,10 @@ import { S, toJsonSchema, toJsonSchemaDocument, validateValue } from "toolcraft-
|
|
|
19
19
|
import type { Static } from "toolcraft-schema";
|
|
20
20
|
|
|
21
21
|
const schema = S.Object({
|
|
22
|
-
name: S.String({ description: "User name" }),
|
|
23
|
-
retries: S.Optional(S.Number({ default: 3 })),
|
|
22
|
+
name: S.String({ description: "User name", minLength: 1 }),
|
|
23
|
+
retries: S.Optional(S.Number({ default: 3, minimum: 0, jsonType: "integer" })),
|
|
24
24
|
mode: S.Enum(["fast", "safe"] as const, { default: "safe" }),
|
|
25
|
-
tags: S.Array(S.String(), { default: [] })
|
|
25
|
+
tags: S.Array(S.String(), { default: [], maxItems: 5 })
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
type Input = Static<typeof schema>;
|
|
@@ -64,15 +64,18 @@ const validation = validateValue(schema, {
|
|
|
64
64
|
|
|
65
65
|
- `Static<typeof schema>` infers the runtime TypeScript shape for a schema descriptor.
|
|
66
66
|
- Object properties wrapped in `S.Optional(...)` become optional properties in `Static`.
|
|
67
|
+
- Schemas declared with `nullable: true` infer `null` in `Static` and emit `nullable: true` in JSON Schema.
|
|
67
68
|
|
|
68
69
|
### JSON Schema generation
|
|
69
70
|
|
|
70
71
|
- `toJsonSchema(schema)` converts any schema descriptor to standard JSON Schema.
|
|
71
72
|
- `toJsonSchemaDocument(schema, options)` wraps `toJsonSchema(schema)` in a full JSON Schema document with `$schema`, optional `$id`, `title`, and `description`.
|
|
72
73
|
- Object properties not wrapped in `S.Optional(...)` are emitted in `required`.
|
|
73
|
-
- Defaults provided to schema builders are emitted as JSON Schema `default
|
|
74
|
-
-
|
|
74
|
+
- Defaults provided to schema builders are emitted as JSON Schema `default` and must satisfy the schema.
|
|
75
|
+
- String, number, and array constraints are emitted as JSON Schema validation keywords.
|
|
76
|
+
- Nested `S.Object(...)` schemas produce nested JSON Schema objects. Object schemas default to `additionalProperties: false`; pass `additionalProperties: true` to allow unknown keys.
|
|
75
77
|
- `S.Enum(...)` rejects empty or duplicate values at runtime for JavaScript callers.
|
|
78
|
+
- Invalid builder configuration fails fast, including invalid regex patterns, negative lengths/counts, inverted min/max pairs, non-finite numeric bounds, and integer schemas with non-integer defaults.
|
|
76
79
|
|
|
77
80
|
### Runtime validation
|
|
78
81
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft-openapi",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.225",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"toolcraft-openapi-generate": "dist/bin/generate.js"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"toolcraft": "0.0.
|
|
33
|
+
"toolcraft": "0.0.225",
|
|
34
34
|
"fast-string-width": "^3.0.2",
|
|
35
35
|
"fast-wrap-ansi": "^0.2.0",
|
|
36
36
|
"sisteransi": "^1.0.5",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"directory": "packages/toolcraft-openapi"
|
|
46
46
|
},
|
|
47
47
|
"optionalDependencies": {
|
|
48
|
-
"toolcraft-schema": "0.0.
|
|
48
|
+
"toolcraft-schema": "0.0.225",
|
|
49
49
|
"toolcraft-design": "*",
|
|
50
50
|
"@poe-code/frontmatter": "*"
|
|
51
51
|
},
|