more recursive docs types (#4028)
* more recursive Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates; Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * add the format Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * get the descriptions again Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
414406
docs/kcl/std.json
@ -9,7 +9,6 @@ Data to draw an angled line.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts any of the following:**
|
||||
|
||||
An angle and length with explicitly named parameters
|
||||
@ -23,12 +22,9 @@ An angle and length with explicitly named parameters
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
An angle and length given as a pair
|
||||
|
||||
|
||||
|
||||
**Type:** `array`
|
||||
|
||||
`[number, number]`
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for drawing an angled line that intersects with a given line.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data to draw an angled line to a point.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
@ -9,13 +9,10 @@ Data to draw an arc.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts any of the following:**
|
||||
|
||||
Angles and radius with an optional tag.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -34,8 +31,6 @@ Angles and radius with an optional tag.
|
||||
----
|
||||
Center, to and radius with an optional tag.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
50
docs/kcl/types/Axis.md
Normal file
@ -0,0 +1,50 @@
|
||||
---
|
||||
title: "Axis"
|
||||
excerpt: "Co-ordinate axis specifier.
|
||||
|
||||
See [cglearn.eu] for background reading.
|
||||
|
||||
[cglearn.eu]: https://cglearn.eu/pub/computer-graphics/introduction-to-geometry#material-coordinate-systems-1"
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Co-ordinate axis specifier.
|
||||
|
||||
See [cglearn.eu] for background reading.
|
||||
|
||||
[cglearn.eu]: https://cglearn.eu/pub/computer-graphics/introduction-to-geometry#material-coordinate-systems-1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
'Y' axis.
|
||||
|
||||
**enum:** `y`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
'Z' axis.
|
||||
|
||||
**enum:** `z`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
81
docs/kcl/types/AxisAndOrigin.md
Normal file
@ -0,0 +1,81 @@
|
||||
---
|
||||
title: "AxisAndOrigin"
|
||||
excerpt: "Axis and origin."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Axis and origin.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
X-axis.
|
||||
|
||||
**enum:** `X`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Y-axis.
|
||||
|
||||
**enum:** `Y`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Flip the X-axis.
|
||||
|
||||
**enum:** `-X`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Flip the Y-axis.
|
||||
|
||||
**enum:** `-Y`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `custom` |`object`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
22
docs/kcl/types/AxisDirectionPair.md
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
title: "AxisDirectionPair"
|
||||
excerpt: "An [`Axis`] paired with a [`Direction`]."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
An [`Axis`] paired with a [`Direction`].
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `axis` |[`Axis`](/docs/kcl/types/Axis)| Axis specifier. | No |
|
||||
| `direction` |[`Direction`](/docs/kcl/types/Direction)| Specifies which direction the axis is pointing. | No |
|
||||
|
||||
|
42
docs/kcl/types/AxisOrEdgeReference.md
Normal file
@ -0,0 +1,42 @@
|
||||
---
|
||||
title: "AxisOrEdgeReference"
|
||||
excerpt: "Axis or tagged edge."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Axis or tagged edge.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts any of the following:**
|
||||
|
||||
Axis and origin.
|
||||
|
||||
[`AxisAndOrigin`](/docs/kcl/types/AxisAndOrigin)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Tagged edge.
|
||||
|
||||
[`EdgeReference`](/docs/kcl/types/EdgeReference)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
||||
|
24
docs/kcl/types/BasePath.md
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
title: "BasePath"
|
||||
excerpt: "A base path."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
A base path.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data to draw a bezier curve.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for chamfers.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -19,6 +17,6 @@ Data for chamfers.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `length` |`number`| The length of the chamfer. | No |
|
||||
| `tags` |`[` **anyOf:** `string` **OR** [`TagIdentifier`](/docs/kcl/types#tag-identifier) `]`| The tags of the paths you want to chamfer. | No |
|
||||
| `tags` |`[` [`EdgeReference`](/docs/kcl/types/EdgeReference) `]`| The tags of the paths you want to chamfer. | No |
|
||||
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for drawing an circle
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for a circular pattern on a 2D sketch.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -18,7 +16,7 @@ Data for a circular pattern on a 2D sketch.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `repetitions` |`integer`| The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. | No |
|
||||
| `repetitions` |[`Uint`](/docs/kcl/types/Uint)| The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. | No |
|
||||
| `center` |`[number, number]`| The center about which to make the pattern. This is a 2D vector. | No |
|
||||
| `arcDegrees` |`number`| The arc angle (in degrees) to place the repetitions. Must be greater than 0. | No |
|
||||
| `rotateDuplicates` |`boolean`| Whether or not to rotate the duplicates as they are copied. | No |
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for a circular pattern on a 3D model.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -18,7 +16,7 @@ Data for a circular pattern on a 3D model.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `repetitions` |`integer`| The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. | No |
|
||||
| `repetitions` |[`Uint`](/docs/kcl/types/Uint)| The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. | No |
|
||||
| `axis` |`[number, number, number]`| The axis around which to make the pattern. This is a 3D vector. | No |
|
||||
| `center` |`[number, number, number]`| The center about which to make the pattern. This is a 3D vector. | No |
|
||||
| `arcDegrees` |`number`| The arc angle (in degrees) to place the repetitions. Must be greater than 0. | No |
|
||||
|
42
docs/kcl/types/Direction.md
Normal file
@ -0,0 +1,42 @@
|
||||
---
|
||||
title: "Direction"
|
||||
excerpt: "Specifies the sign of a co-ordinate axis."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Specifies the sign of a co-ordinate axis.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
Increasing numbers.
|
||||
|
||||
**enum:** `positive`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Decreasing numbers.
|
||||
|
||||
**enum:** `negative`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
58
docs/kcl/types/EdgeCut.md
Normal file
@ -0,0 +1,58 @@
|
||||
---
|
||||
title: "EdgeCut"
|
||||
excerpt: "A fillet or a chamfer."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
A fillet or a chamfer.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
A fillet.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `fillet`| | No |
|
||||
| `id` |`string`| The id of the engine command that called this fillet. | No |
|
||||
| `radius` |`number`| | No |
|
||||
| `edgeId` |`string`| The engine id of the edge to fillet. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| A fillet or a chamfer. | No |
|
||||
|
||||
|
||||
----
|
||||
A chamfer.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `chamfer`| | No |
|
||||
| `id` |`string`| The id of the engine command that called this chamfer. | No |
|
||||
| `length` |`number`| | No |
|
||||
| `edgeId` |`string`| The engine id of the edge to chamfer. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| A fillet or a chamfer. | No |
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
41
docs/kcl/types/EdgeReference.md
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
title: "EdgeReference"
|
||||
excerpt: "A tag or a uuid of an edge."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
A tag or a uuid of an edge.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts any of the following:**
|
||||
|
||||
A uuid of an edge.
|
||||
|
||||
**Type:** `string` (`uuid`)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
A tag of an edge.
|
||||
|
||||
[`TagIdentifier`](/docs/kcl/types#tag-identifier)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
||||
|
98
docs/kcl/types/ExtrudeSurface.md
Normal file
@ -0,0 +1,98 @@
|
||||
---
|
||||
title: "ExtrudeSurface"
|
||||
excerpt: "An extrude surface."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
An extrude surface.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
An extrude plane.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `extrudePlane`| | No |
|
||||
| `faceId` |`string`| The face id for the extrude plane. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||
| `id` |`string`| The id of the geometry. | No |
|
||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||
|
||||
|
||||
----
|
||||
An extruded arc.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `extrudeArc`| | No |
|
||||
| `faceId` |`string`| The face id for the extrude plane. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||
| `id` |`string`| The id of the geometry. | No |
|
||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||
|
||||
|
||||
----
|
||||
Geometry metadata.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `chamfer`| | No |
|
||||
| `faceId` |`string`| The id for the chamfer surface. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||
| `id` |`string`| The id of the geometry. | No |
|
||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||
|
||||
|
||||
----
|
||||
Geometry metadata.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `fillet`| | No |
|
||||
| `faceId` |`string`| The id for the fillet surface. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag. | No |
|
||||
| `id` |`string`| The id of the geometry. | No |
|
||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
@ -9,45 +9,17 @@ A tag for a face.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts any of the following:**
|
||||
|
||||
A tag for a face.
|
||||
|
||||
[`StartOrEnd`](/docs/kcl/types/StartOrEnd)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
The start face as in before you extruded. This could also be known as the bottom face. But we do not call it bottom because it would be the top face if you extruded it in the opposite direction or flipped the camera.
|
||||
|
||||
|
||||
|
||||
**enum:** `start`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The end face after you extruded. This could also be known as the top face. But we do not call it top because it would be the bottom face if you extruded it in the opposite direction or flipped the camera.
|
||||
|
||||
|
||||
|
||||
**enum:** `end`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
@ -62,7 +34,6 @@ A tag for the face.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for fillets.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -19,7 +17,7 @@ Data for fillets.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `radius` |`number`| The radius of the fillet. | No |
|
||||
| `tags` |`[` **anyOf:** `string` **OR** [`TagIdentifier`](/docs/kcl/types#tag-identifier) `]`| The tags of the paths you want to fillet. | No |
|
||||
| `tags` |`[` [`EdgeReference`](/docs/kcl/types/EdgeReference) `]`| The tags of the paths you want to fillet. | No |
|
||||
| `tolerance` |`number`| The tolerance for the fillet. | No |
|
||||
|
||||
|
||||
|
22
docs/kcl/types/GeoMeta.md
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
title: "GeoMeta"
|
||||
excerpt: "Geometry metadata."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Geometry metadata.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `id` |`string`| The id of the geometry. | No |
|
||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for helices.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
@ -10,13 +10,10 @@ Import format specifier
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
Autodesk Filmbox (FBX) format
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -33,8 +30,6 @@ Autodesk Filmbox (FBX) format
|
||||
----
|
||||
Binary glTF 2.0. We refer to this as glTF since that is how our customers refer to it, but this can also import binary glTF (glb).
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -51,8 +46,6 @@ Binary glTF 2.0. We refer to this as glTF since that is how our customers refer
|
||||
----
|
||||
Wavefront OBJ format.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -64,15 +57,13 @@ Wavefront OBJ format.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `obj`| | No |
|
||||
| `coords` |`object`| Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. | No |
|
||||
| `units` |**oneOf:** enum: `cm` **OR** enum: `ft` **OR** enum: `in` **OR** enum: `m` **OR** enum: `mm` **OR** enum: `yd`| The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. | No |
|
||||
| `coords` |[`System`](/docs/kcl/types/System)| Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. | No |
|
||||
| `units` |[`UnitLength`](/docs/kcl/types/UnitLength)| The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. | No |
|
||||
|
||||
|
||||
----
|
||||
The PLY Polygon File Format.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -84,15 +75,13 @@ The PLY Polygon File Format.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `ply`| | No |
|
||||
| `coords` |`object`| Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. | No |
|
||||
| `units` |**oneOf:** enum: `cm` **OR** enum: `ft` **OR** enum: `in` **OR** enum: `m` **OR** enum: `mm` **OR** enum: `yd`| The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. | No |
|
||||
| `coords` |[`System`](/docs/kcl/types/System)| Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. | No |
|
||||
| `units` |[`UnitLength`](/docs/kcl/types/UnitLength)| The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. | No |
|
||||
|
||||
|
||||
----
|
||||
SolidWorks part (SLDPRT) format.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -109,8 +98,6 @@ SolidWorks part (SLDPRT) format.
|
||||
----
|
||||
ISO 10303-21 (STEP) format.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -127,8 +114,6 @@ ISO 10303-21 (STEP) format.
|
||||
----
|
||||
ST**ereo**L**ithography format.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -140,8 +125,8 @@ ST**ereo**L**ithography format.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `stl`| | No |
|
||||
| `coords` |`object`| Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. | No |
|
||||
| `units` |**oneOf:** enum: `cm` **OR** enum: `ft` **OR** enum: `in` **OR** enum: `m` **OR** enum: `mm` **OR** enum: `yd`| The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. | No |
|
||||
| `coords` |[`System`](/docs/kcl/types/System)| Co-ordinate system of input data. Defaults to the [KittyCAD co-ordinate system. | No |
|
||||
| `units` |[`UnitLength`](/docs/kcl/types/UnitLength)| The units of the input data. This is very important for correct scaling and when calculating physics properties like mass, etc. Defaults to millimeters. | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for an imported geometry.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -20,6 +18,6 @@ Data for an imported geometry.
|
||||
|----------|------|-------------|----------|
|
||||
| `id` |`string`| The ID of the imported geometry. | No |
|
||||
| `value` |`[` `string` `]`| The original file paths. | No |
|
||||
| `__meta` |`[` `object` `]`| | No |
|
||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for a linear pattern on a 2D sketch.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -18,7 +16,7 @@ Data for a linear pattern on a 2D sketch.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `repetitions` |`integer`| The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. | No |
|
||||
| `repetitions` |[`Uint`](/docs/kcl/types/Uint)| The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. | No |
|
||||
| `distance` |`number`| The distance between each repetition. This can also be referred to as spacing. | No |
|
||||
| `axis` |`[number, number]`| The axis of the pattern. This is a 2D vector. | No |
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for a linear pattern on a 3D model.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -18,7 +16,7 @@ Data for a linear pattern on a 3D model.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `repetitions` |`integer`| The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. | No |
|
||||
| `repetitions` |[`Uint`](/docs/kcl/types/Uint)| The number of repetitions. Must be greater than 0. This excludes the original entity. For example, if `repetitions` is 1, the original entity will be copied once. | No |
|
||||
| `distance` |`number`| The distance between each repetition. This can also be referred to as spacing. | No |
|
||||
| `axis` |`[number, number, number]`| The axis of the pattern. | No |
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for a loft.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
21
docs/kcl/types/Metadata.md
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
title: "Metadata"
|
||||
excerpt: "Metadata."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Metadata.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `sourceRange` |`SourceRange`| The source range. | No |
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for a mirror.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -18,6 +16,6 @@ Data for a mirror.
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `axis` |**anyOf:** **oneOf:** enum: `X` **OR** enum: `Y` **OR** enum: `-X` **OR** enum: `-Y` **OR** `object` **OR** **anyOf:** `string` **OR** [`TagIdentifier`](/docs/kcl/types#tag-identifier)| Axis to use as mirror. | No |
|
||||
| `axis` |[`AxisOrEdgeReference`](/docs/kcl/types/AxisOrEdgeReference)| Axis to use as mirror. | No |
|
||||
|
||||
|
||||
|
168
docs/kcl/types/Path.md
Normal file
@ -0,0 +1,168 @@
|
||||
---
|
||||
title: "Path"
|
||||
excerpt: "A path."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
A path.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
A path that goes to a point.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `ToPoint`| | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
----
|
||||
A arc that is tangential to the last path segment that goes to a point
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `TangentialArcTo`| | No |
|
||||
| `center` |`[number, number]`| the arc's center | No |
|
||||
| `ccw` |`boolean`| arc's direction | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
----
|
||||
A arc that is tangential to the last path segment
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `TangentialArc`| | No |
|
||||
| `center` |`[number, number]`| the arc's center | No |
|
||||
| `ccw` |`boolean`| arc's direction | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
----
|
||||
a complete arc
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `Circle`| | No |
|
||||
| `center` |`[number, number]`| the arc's center | No |
|
||||
| `radius` |`number`| the arc's radius | No |
|
||||
| `ccw` |`boolean`| arc's direction | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
----
|
||||
A path that is horizontal.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `Horizontal`| | No |
|
||||
| `x` |`number`| The x coordinate. | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
----
|
||||
An angled line to.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `AngledLineTo`| | No |
|
||||
| `x` |`number`| The x coordinate. | No |
|
||||
| `y` |`number`| The y coordinate. | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
----
|
||||
A base path.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `Base`| | No |
|
||||
| `from` |`[number, number]`| The from point. | No |
|
||||
| `to` |`[number, number]`| The to point. | No |
|
||||
| `tag` |[`TagDeclarator`](/docs/kcl/types#tag-declaration)| The tag of the path. | No |
|
||||
| `__geoMeta` |[`GeoMeta`](/docs/kcl/types/GeoMeta)| Metadata. | No |
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
@ -10,13 +10,10 @@ Data for a plane.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
The XY plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `XY`
|
||||
|
||||
|
||||
@ -25,11 +22,10 @@ The XY plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The opposite side of the XY plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `-XY`
|
||||
|
||||
|
||||
@ -38,11 +34,10 @@ The opposite side of the XY plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The XZ plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `XZ`
|
||||
|
||||
|
||||
@ -51,11 +46,10 @@ The XZ plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The opposite side of the XZ plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `-XZ`
|
||||
|
||||
|
||||
@ -64,11 +58,10 @@ The opposite side of the XZ plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The YZ plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `YZ`
|
||||
|
||||
|
||||
@ -77,11 +70,10 @@ The YZ plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The opposite side of the YZ plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `-YZ`
|
||||
|
||||
|
||||
@ -90,11 +82,10 @@ The opposite side of the YZ plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
A defined plane.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
41
docs/kcl/types/PlaneType.md
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
title: "PlaneType"
|
||||
excerpt: "Type for a plane."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Type for a plane.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
|
||||
**enum:** `XY`, `XZ`, `YZ`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
A custom plane.
|
||||
|
||||
**enum:** `Custom`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
22
docs/kcl/types/Point3d.md
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
title: "Point3d"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `x` |`number`| | No |
|
||||
| `y` |`number`| | No |
|
||||
| `z` |`number`| | No |
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for polar coordinates.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for revolution surfaces.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -19,7 +17,7 @@ Data for revolution surfaces.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `angle` |`number`| Angle to revolve (in degrees). Default is 360. | No |
|
||||
| `axis` |**anyOf:** **oneOf:** enum: `X` **OR** enum: `Y` **OR** enum: `-X` **OR** enum: `-Y` **OR** `object` **OR** **anyOf:** `string` **OR** [`TagIdentifier`](/docs/kcl/types#tag-identifier)| Axis of revolution. | No |
|
||||
| `axis` |[`AxisOrEdgeReference`](/docs/kcl/types/AxisOrEdgeReference)| Axis of revolution. | No |
|
||||
| `tolerance` |`number`| Tolerance for the revolve operation. | No |
|
||||
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
Data for shells.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -19,6 +17,6 @@ Data for shells.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `thickness` |`number`| The thickness of the shell. | No |
|
||||
| `faces` |`[` **anyOf:** **oneOf:** enum: `start` **OR** enum: `end` **OR** [`TagIdentifier`](/docs/kcl/types#tag-identifier) `]`| The faces you want removed. | No |
|
||||
| `faces` |`[` [`FaceTag`](/docs/kcl/types/FaceTag) `]`| The faces you want removed. | No |
|
||||
|
||||
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
A sketch is a collection of paths.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -19,10 +17,10 @@ A sketch is a collection of paths.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `id` |`string`| The id of the sketch (this will change when the engine's reference to it changes. | No |
|
||||
| `value` |`[` **oneOf:** `object` **OR** `object` **OR** `object` **OR** `object` **OR** `object` **OR** `object` **OR** `object` `]`| The paths in the sketch. | No |
|
||||
| `on` |**oneOf:** `object` **OR** `object`| What the sketch is on (can be a plane or a face). | No |
|
||||
| `start` |`object`| The starting path. | No |
|
||||
| `value` |`[` [`Path`](/docs/kcl/types/Path) `]`| The paths in the sketch. | No |
|
||||
| `on` |[`SketchSurface`](/docs/kcl/types/SketchSurface)| What the sketch is on (can be a plane or a face). | No |
|
||||
| `start` |[`BasePath`](/docs/kcl/types/BasePath)| The starting path. | No |
|
||||
| `tags` |`object`| Tag identifiers that have been declared in this sketch. | No |
|
||||
| `__meta` |`[` `object` `]`| Metadata. | No |
|
||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| Metadata. | No |
|
||||
|
||||
|
||||
|
@ -9,10 +9,9 @@ Data for start sketch on. You can start a sketch on a plane or an solid.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts any of the following:**
|
||||
|
||||
Data for a plane.
|
||||
Data for start sketch on. You can start a sketch on a plane or an solid.
|
||||
|
||||
[`PlaneData`](/docs/kcl/types/PlaneData)
|
||||
|
||||
@ -23,30 +22,16 @@ Data for a plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
An solid is a collection of extrude surfaces.
|
||||
Data for start sketch on. You can start a sketch on a plane or an solid.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
[`Solid`](/docs/kcl/types/Solid)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `id` |`string`| The id of the solid. | No |
|
||||
| `value` |`[` **oneOf:** `object` **OR** `object` **OR** `object` **OR** `object` `]`| The extrude surfaces. | No |
|
||||
| `sketch` |`object`| The sketch. | No |
|
||||
| `height` |`number`| The height of the solid. | No |
|
||||
| `startCapId` |`string`| The id of the extrusion start cap | No |
|
||||
| `endCapId` |`string`| The id of the extrusion end cap | No |
|
||||
| `edgeCuts` |`[` **oneOf:** `object` **OR** `object` `]`| Chamfers or fillets on this solid. | No |
|
||||
| `__meta` |`[` `object` `]`| Metadata. | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -9,93 +9,29 @@ A sketch surface or a sketch.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts any of the following:**
|
||||
|
||||
A sketch type.
|
||||
A sketch surface or a sketch.
|
||||
|
||||
[`SketchSurface`](/docs/kcl/types/SketchSurface)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
A plane.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `plane`| | No |
|
||||
| `id` |`string`| The id of the plane. | No |
|
||||
| `value` |**oneOf:** enum: `XY`, `XZ`, `YZ` **OR** enum: `Custom`| Type for a plane. | No |
|
||||
| `origin` |`object`| Origin of the plane. | No |
|
||||
| `xAxis` |`object`| What should the plane’s X axis be? | No |
|
||||
| `yAxis` |`object`| What should the plane’s Y axis be? | No |
|
||||
| `zAxis` |`object`| The z-axis (normal). | No |
|
||||
| `__meta` |`[` `object` `]`| | No |
|
||||
|
||||
|
||||
----
|
||||
A face.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `face`| | No |
|
||||
| `id` |`string`| The id of the face. | No |
|
||||
| `value` |`string`| The tag of the face. | No |
|
||||
| `xAxis` |`object`| What should the face’s X axis be? | No |
|
||||
| `yAxis` |`object`| What should the face’s Y axis be? | No |
|
||||
| `zAxis` |`object`| The z-axis (normal). | No |
|
||||
| `solid` |`object`| The solid the face is on. | No |
|
||||
| `__meta` |`[` `object` `]`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
A sketch is a collection of paths.
|
||||
A sketch surface or a sketch.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
[`Sketch`](/docs/kcl/types/Sketch)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `id` |`string`| The id of the sketch (this will change when the engine's reference to it changes. | No |
|
||||
| `value` |`[` **oneOf:** `object` **OR** `object` **OR** `object` **OR** `object` **OR** `object` **OR** `object` **OR** `object` `]`| The paths in the sketch. | No |
|
||||
| `on` |**oneOf:** `object` **OR** `object`| What the sketch is on (can be a plane or a face). | No |
|
||||
| `start` |`object`| The starting path. | No |
|
||||
| `tags` |`object`| Tag identifiers that have been declared in this sketch. | No |
|
||||
| `__meta` |`[` `object` `]`| Metadata. | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -10,13 +10,10 @@ A sketch or a group of sketches.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
A sketch is a collection of paths.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -29,20 +26,18 @@ A sketch is a collection of paths.
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `sketch`| | No |
|
||||
| `id` |`string`| The id of the sketch (this will change when the engine's reference to it changes. | No |
|
||||
| `value` |`[` **oneOf:** `object` **OR** `object` **OR** `object` **OR** `object` **OR** `object` **OR** `object` **OR** `object` `]`| The paths in the sketch. | No |
|
||||
| `on` |**oneOf:** `object` **OR** `object`| What the sketch is on (can be a plane or a face). | No |
|
||||
| `start` |`object`| The starting path. | No |
|
||||
| `value` |`[` [`Path`](/docs/kcl/types/Path) `]`| The paths in the sketch. | No |
|
||||
| `on` |[`SketchSurface`](/docs/kcl/types/SketchSurface)| What the sketch is on (can be a plane or a face). | No |
|
||||
| `start` |[`BasePath`](/docs/kcl/types/BasePath)| The starting path. | No |
|
||||
| `tags` |`object`| Tag identifiers that have been declared in this sketch. | No |
|
||||
| `__meta` |`[` `object` `]`| Metadata. | No |
|
||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| Metadata. | No |
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
**Type:** `[object, array]`
|
||||
|
||||
`[` `object` `]`
|
||||
`[` [`Sketch`](/docs/kcl/types/Sketch) `]`
|
||||
|
||||
|
||||
|
||||
|
@ -10,13 +10,10 @@ A sketch type.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
A plane.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -29,19 +26,17 @@ A plane.
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `plane`| | No |
|
||||
| `id` |`string`| The id of the plane. | No |
|
||||
| `value` |**oneOf:** enum: `XY`, `XZ`, `YZ` **OR** enum: `Custom`| Type for a plane. | No |
|
||||
| `origin` |`object`| Origin of the plane. | No |
|
||||
| `xAxis` |`object`| What should the plane’s X axis be? | No |
|
||||
| `yAxis` |`object`| What should the plane’s Y axis be? | No |
|
||||
| `zAxis` |`object`| The z-axis (normal). | No |
|
||||
| `__meta` |`[` `object` `]`| | No |
|
||||
| `value` |[`PlaneType`](/docs/kcl/types/PlaneType)| A sketch type. | No |
|
||||
| `origin` |[`Point3d`](/docs/kcl/types/Point3d)| Origin of the plane. | No |
|
||||
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane’s X axis be? | No |
|
||||
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the plane’s Y axis be? | No |
|
||||
| `zAxis` |[`Point3d`](/docs/kcl/types/Point3d)| The z-axis (normal). | No |
|
||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||
|
||||
|
||||
----
|
||||
A face.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -55,11 +50,11 @@ A face.
|
||||
| `type` |enum: `face`| | No |
|
||||
| `id` |`string`| The id of the face. | No |
|
||||
| `value` |`string`| The tag of the face. | No |
|
||||
| `xAxis` |`object`| What should the face’s X axis be? | No |
|
||||
| `yAxis` |`object`| What should the face’s Y axis be? | No |
|
||||
| `zAxis` |`object`| The z-axis (normal). | No |
|
||||
| `solid` |`object`| The solid the face is on. | No |
|
||||
| `__meta` |`[` `object` `]`| | No |
|
||||
| `xAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face’s X axis be? | No |
|
||||
| `yAxis` |[`Point3d`](/docs/kcl/types/Point3d)| What should the face’s Y axis be? | No |
|
||||
| `zAxis` |[`Point3d`](/docs/kcl/types/Point3d)| The z-axis (normal). | No |
|
||||
| `solid` |[`Solid`](/docs/kcl/types/Solid)| The solid the face is on. | No |
|
||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||
|
||||
|
||||
----
|
||||
|
@ -6,8 +6,6 @@ layout: manual
|
||||
|
||||
An solid is a collection of extrude surfaces.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -19,12 +17,12 @@ An solid is a collection of extrude surfaces.
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `id` |`string`| The id of the solid. | No |
|
||||
| `value` |`[` **oneOf:** `object` **OR** `object` **OR** `object` **OR** `object` `]`| The extrude surfaces. | No |
|
||||
| `sketch` |`object`| The sketch. | No |
|
||||
| `value` |`[` [`ExtrudeSurface`](/docs/kcl/types/ExtrudeSurface) `]`| The extrude surfaces. | No |
|
||||
| `sketch` |[`Sketch`](/docs/kcl/types/Sketch)| The sketch. | No |
|
||||
| `height` |`number`| The height of the solid. | No |
|
||||
| `startCapId` |`string`| The id of the extrusion start cap | No |
|
||||
| `endCapId` |`string`| The id of the extrusion end cap | No |
|
||||
| `edgeCuts` |`[` **oneOf:** `object` **OR** `object` `]`| Chamfers or fillets on this solid. | No |
|
||||
| `__meta` |`[` `object` `]`| Metadata. | No |
|
||||
| `edgeCuts` |`[` [`EdgeCut`](/docs/kcl/types/EdgeCut) `]`| Chamfers or fillets on this solid. | No |
|
||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| Metadata. | No |
|
||||
|
||||
|
||||
|
@ -10,13 +10,10 @@ A solid or a group of solids.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
An solid is a collection of extrude surfaces.
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
@ -29,22 +26,20 @@ An solid is a collection of extrude surfaces.
|
||||
|----------|------|-------------|----------|
|
||||
| `type` |enum: `solid`| | No |
|
||||
| `id` |`string`| The id of the solid. | No |
|
||||
| `value` |`[` **oneOf:** `object` **OR** `object` **OR** `object` **OR** `object` `]`| The extrude surfaces. | No |
|
||||
| `sketch` |`object`| The sketch. | No |
|
||||
| `value` |`[` [`ExtrudeSurface`](/docs/kcl/types/ExtrudeSurface) `]`| The extrude surfaces. | No |
|
||||
| `sketch` |[`Sketch`](/docs/kcl/types/Sketch)| The sketch. | No |
|
||||
| `height` |`number`| The height of the solid. | No |
|
||||
| `startCapId` |`string`| The id of the extrusion start cap | No |
|
||||
| `endCapId` |`string`| The id of the extrusion end cap | No |
|
||||
| `edgeCuts` |`[` **oneOf:** `object` **OR** `object` `]`| Chamfers or fillets on this solid. | No |
|
||||
| `__meta` |`[` `object` `]`| Metadata. | No |
|
||||
| `edgeCuts` |`[` [`EdgeCut`](/docs/kcl/types/EdgeCut) `]`| Chamfers or fillets on this solid. | No |
|
||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| Metadata. | No |
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
**Type:** `[object, array]`
|
||||
|
||||
`[` `object` `]`
|
||||
`[` [`Solid`](/docs/kcl/types/Solid) `]`
|
||||
|
||||
|
||||
|
||||
|
@ -10,13 +10,10 @@ One of the standard planes.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
The XY plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `XY`
|
||||
|
||||
|
||||
@ -25,11 +22,10 @@ The XY plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The opposite side of the XY plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `-XY`
|
||||
|
||||
|
||||
@ -38,11 +34,10 @@ The opposite side of the XY plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The XZ plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `XZ`
|
||||
|
||||
|
||||
@ -51,11 +46,10 @@ The XZ plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The opposite side of the XZ plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `-XZ`
|
||||
|
||||
|
||||
@ -64,11 +58,10 @@ The opposite side of the XZ plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The YZ plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `YZ`
|
||||
|
||||
|
||||
@ -77,11 +70,10 @@ The YZ plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The opposite side of the YZ plane.
|
||||
|
||||
|
||||
|
||||
**enum:** `-YZ`
|
||||
|
||||
|
||||
@ -90,6 +82,7 @@ The opposite side of the YZ plane.
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
41
docs/kcl/types/StartOrEnd.md
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
title: "StartOrEnd"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
The start face as in before you extruded. This could also be known as the bottom face. But we do not call it bottom because it would be the top face if you extruded it in the opposite direction or flipped the camera.
|
||||
|
||||
**enum:** `start`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
The end face after you extruded. This could also be known as the top face. But we do not call it top because it would be the bottom face if you extruded it in the opposite direction or flipped the camera.
|
||||
|
||||
**enum:** `end`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
34
docs/kcl/types/System.md
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
title: "System"
|
||||
excerpt: "Co-ordinate system definition.
|
||||
|
||||
The `up` axis must be orthogonal to the `forward` axis.
|
||||
|
||||
See [cglearn.eu] for background reading.
|
||||
|
||||
[cglearn.eu](https://cglearn.eu/pub/computer-graphics/introduction-to-geometry#material-coordinate-systems-1)"
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Co-ordinate system definition.
|
||||
|
||||
The `up` axis must be orthogonal to the `forward` axis.
|
||||
|
||||
See [cglearn.eu] for background reading.
|
||||
|
||||
[cglearn.eu](https://cglearn.eu/pub/computer-graphics/introduction-to-geometry#material-coordinate-systems-1)
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `forward` |[`AxisDirectionPair`](/docs/kcl/types/AxisDirectionPair)| Axis the front face of a model looks along. | No |
|
||||
| `up` |[`AxisDirectionPair`](/docs/kcl/types/AxisDirectionPair)| Axis pointing up and away from a model. | No |
|
||||
|
||||
|
24
docs/kcl/types/TagEngineInfo.md
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
title: "TagEngineInfo"
|
||||
excerpt: "Engine information for a tag."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Engine information for a tag.
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `id` |`string`| The id of the tagged object. | No |
|
||||
| `sketch` |`string`| The sketch the tag is on. | No |
|
||||
| `path` |[`BasePath`](/docs/kcl/types/BasePath)| The path the tag is on. | No |
|
||||
| `surface` |[`ExtrudeSurface`](/docs/kcl/types/ExtrudeSurface)| The surface information for the tag. | No |
|
||||
|
||||
|
@ -9,12 +9,9 @@ Data to draw a tangential arc.
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts any of the following:**
|
||||
|
||||
|
||||
|
||||
|
||||
**Type:** `object`
|
||||
|
||||
|
||||
|
15
docs/kcl/types/Uint.md
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "Uint"
|
||||
excerpt: ""
|
||||
layout: manual
|
||||
---
|
||||
|
||||
|
||||
**Type:** `integer` (`uint32`)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
90
docs/kcl/types/UnitLength.md
Normal file
@ -0,0 +1,90 @@
|
||||
---
|
||||
title: "UnitLength"
|
||||
excerpt: "The valid types of length units."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
The valid types of length units.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**This schema accepts exactly one of the following:**
|
||||
|
||||
Centimeters <https://en.wikipedia.org/wiki/Centimeter>
|
||||
|
||||
**enum:** `cm`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Feet <https://en.wikipedia.org/wiki/Foot_(unit)>
|
||||
|
||||
**enum:** `ft`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Inches <https://en.wikipedia.org/wiki/Inch>
|
||||
|
||||
**enum:** `in`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Meters <https://en.wikipedia.org/wiki/Meter>
|
||||
|
||||
**enum:** `m`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Millimeters <https://en.wikipedia.org/wiki/Millimeter>
|
||||
|
||||
**enum:** `mm`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Yards <https://en.wikipedia.org/wiki/Yard>
|
||||
|
||||
**enum:** `yd`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 57 KiB |
@ -288,6 +288,7 @@ fn do_stdlib_inner(
|
||||
name: #arg_name.to_string(),
|
||||
type_: #ty_string.to_string(),
|
||||
schema: #schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: #required,
|
||||
}
|
||||
});
|
||||
@ -343,10 +344,12 @@ fn do_stdlib_inner(
|
||||
let return_type = if !ret_ty_string.is_empty() || ret_ty_string != "()" {
|
||||
let ret_ty_string = rust_type_to_openapi_type(&ret_ty_string);
|
||||
quote! {
|
||||
let schema = <#return_type_inner>::json_schema(&mut generator);
|
||||
Some(#docs_crate::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: #ret_ty_string.to_string(),
|
||||
schema: <#return_type_inner>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
@ -414,17 +417,19 @@ fn do_stdlib_inner(
|
||||
vec![#(#tags),*]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<#docs_crate::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<#docs_crate::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
// We set this to false so we can recurse them later.
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
|
||||
vec![#(#arg_types),*]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<#docs_crate::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<#docs_crate::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
// We set this to false so we can recurse them later.
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
|
||||
#return_type
|
||||
|
@ -74,26 +74,29 @@ impl crate::docs::StdLibFn for SomeFn {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![crate::docs::StdLibFnArg {
|
||||
name: "data".to_string(),
|
||||
type_: "Foo".to_string(),
|
||||
schema: Foo::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
}]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <i32>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "i32".to_string(),
|
||||
schema: <i32>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -74,26 +74,29 @@ impl crate::docs::StdLibFn for SomeFn {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![crate::docs::StdLibFnArg {
|
||||
name: "data".to_string(),
|
||||
type_: "string".to_string(),
|
||||
schema: str::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
}]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <i32>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "i32".to_string(),
|
||||
schema: <i32>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -107,26 +107,29 @@ impl crate::docs::StdLibFn for Show {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![crate::docs::StdLibFnArg {
|
||||
name: "args".to_string(),
|
||||
type_: "[number]".to_string(),
|
||||
schema: <[f64; 2usize]>::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
}]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <f64>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "number".to_string(),
|
||||
schema: <f64>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -74,26 +74,29 @@ impl crate::docs::StdLibFn for Show {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![crate::docs::StdLibFnArg {
|
||||
name: "args".to_string(),
|
||||
type_: "number".to_string(),
|
||||
schema: f64::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
}]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <f64>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "number".to_string(),
|
||||
schema: <f64>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -108,26 +108,29 @@ impl crate::docs::StdLibFn for MyFunc {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![crate::docs::StdLibFnArg {
|
||||
name: "args".to_string(),
|
||||
type_: "kittycad::types::InputFormat".to_string(),
|
||||
schema: <Option<kittycad::types::InputFormat>>::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: false,
|
||||
}]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <Vec<Sketch>>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "[Sketch]".to_string(),
|
||||
schema: <Vec<Sketch>>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -108,34 +108,38 @@ impl crate::docs::StdLibFn for LineTo {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![
|
||||
crate::docs::StdLibFnArg {
|
||||
name: "data".to_string(),
|
||||
type_: "LineToData".to_string(),
|
||||
schema: LineToData::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
},
|
||||
crate::docs::StdLibFnArg {
|
||||
name: "sketch".to_string(),
|
||||
type_: "Sketch".to_string(),
|
||||
schema: Sketch::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <Sketch>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "Sketch".to_string(),
|
||||
schema: <Sketch>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -107,26 +107,29 @@ impl crate::docs::StdLibFn for Min {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![crate::docs::StdLibFnArg {
|
||||
name: "args".to_string(),
|
||||
type_: "[number]".to_string(),
|
||||
schema: <Vec<f64>>::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
}]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <f64>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "number".to_string(),
|
||||
schema: <f64>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -74,26 +74,29 @@ impl crate::docs::StdLibFn for Show {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![crate::docs::StdLibFnArg {
|
||||
name: "args".to_string(),
|
||||
type_: "number".to_string(),
|
||||
schema: <Option<f64>>::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: false,
|
||||
}]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <f64>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "number".to_string(),
|
||||
schema: <f64>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -74,26 +74,29 @@ impl crate::docs::StdLibFn for Import {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![crate::docs::StdLibFnArg {
|
||||
name: "args".to_string(),
|
||||
type_: "kittycad::types::InputFormat".to_string(),
|
||||
schema: <Option<kittycad::types::InputFormat>>::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: false,
|
||||
}]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <f64>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "number".to_string(),
|
||||
schema: <f64>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -74,26 +74,29 @@ impl crate::docs::StdLibFn for Import {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![crate::docs::StdLibFnArg {
|
||||
name: "args".to_string(),
|
||||
type_: "kittycad::types::InputFormat".to_string(),
|
||||
schema: <Option<kittycad::types::InputFormat>>::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: false,
|
||||
}]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <Vec<Sketch>>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "[Sketch]".to_string(),
|
||||
schema: <Vec<Sketch>>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -74,26 +74,29 @@ impl crate::docs::StdLibFn for Import {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![crate::docs::StdLibFnArg {
|
||||
name: "args".to_string(),
|
||||
type_: "kittycad::types::InputFormat".to_string(),
|
||||
schema: <Option<kittycad::types::InputFormat>>::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: false,
|
||||
}]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <Vec<Sketch>>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "[Sketch]".to_string(),
|
||||
schema: <Vec<Sketch>>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -74,26 +74,29 @@ impl crate::docs::StdLibFn for Show {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![crate::docs::StdLibFnArg {
|
||||
name: "args".to_string(),
|
||||
type_: "[number]".to_string(),
|
||||
schema: <Vec<f64>>::json_schema(&mut generator),
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
}]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <()>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "()".to_string(),
|
||||
schema: <()>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -74,21 +74,23 @@ impl crate::docs::StdLibFn for SomeFunction {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn return_value(&self) -> Option<crate::docs::StdLibFnArg> {
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<crate::docs::StdLibFnArg> {
|
||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
||||
settings.inline_subschemas = true;
|
||||
settings.inline_subschemas = inline_subschemas;
|
||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
||||
let schema = <i32>::json_schema(&mut generator);
|
||||
Some(crate::docs::StdLibFnArg {
|
||||
name: "".to_string(),
|
||||
type_: "i32".to_string(),
|
||||
schema: <i32>::json_schema(&mut generator),
|
||||
schema,
|
||||
schema_definitions: generator.definitions().clone(),
|
||||
required: true,
|
||||
})
|
||||
}
|
||||
|
@ -314,16 +314,23 @@ fn generate_function(internal_fn: Box<dyn StdLibFn>) -> Result<BTreeMap<String,
|
||||
|
||||
// Generate the type markdown files for each argument.
|
||||
let mut types = BTreeMap::new();
|
||||
for arg in internal_fn.args() {
|
||||
for arg in internal_fn.args(false) {
|
||||
if !arg.is_primitive()? {
|
||||
add_to_types(&arg.type_, &arg.schema, &mut types)?;
|
||||
// Add each definition as well.
|
||||
for (name, definition) in &arg.schema_definitions {
|
||||
add_to_types(name, definition, &mut types)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the type markdown for the return value.
|
||||
if let Some(ret) = internal_fn.return_value() {
|
||||
if let Some(ret) = internal_fn.return_value(false) {
|
||||
if !ret.is_primitive()? {
|
||||
add_to_types(&ret.type_, &ret.schema, &mut types)?;
|
||||
for (name, definition) in &ret.schema_definitions {
|
||||
add_to_types(name, definition, &mut types)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +343,7 @@ fn generate_function(internal_fn: Box<dyn StdLibFn>) -> Result<BTreeMap<String,
|
||||
"tags": internal_fn.tags(),
|
||||
"examples": examples,
|
||||
"is_utilities": internal_fn.tags().contains(&"utilities".to_string()),
|
||||
"args": internal_fn.args().iter().map(|arg| {
|
||||
"args": internal_fn.args(false).iter().map(|arg| {
|
||||
json!({
|
||||
"name": arg.name,
|
||||
"type_": arg.type_,
|
||||
@ -344,7 +351,7 @@ fn generate_function(internal_fn: Box<dyn StdLibFn>) -> Result<BTreeMap<String,
|
||||
"required": arg.required,
|
||||
})
|
||||
}).collect::<Vec<_>>(),
|
||||
"return_value": internal_fn.return_value().map(|ret| {
|
||||
"return_value": internal_fn.return_value(false).map(|ret| {
|
||||
json!({
|
||||
"type_": ret.type_,
|
||||
"description": ret.description(),
|
||||
@ -493,6 +500,8 @@ fn generate_type(
|
||||
|
||||
// Make sure the name is pascal cased.
|
||||
if !(name.is_case(convert_case::Case::Pascal)
|
||||
|| name == "Point3d"
|
||||
|| name == "Point2d"
|
||||
|| name == "CircularPattern2dData"
|
||||
|| name == "CircularPattern3dData"
|
||||
|| name == "LinearPattern2dData"
|
||||
@ -594,6 +603,27 @@ fn recurse_and_create_references(
|
||||
));
|
||||
};
|
||||
|
||||
// If we already have a reference add the metadata to the reference if it has none.
|
||||
if o.reference.is_some() {
|
||||
let mut obj = o.clone();
|
||||
let t = types
|
||||
.get(name)
|
||||
.ok_or_else(|| anyhow::anyhow!("Failed to get type: {}", name))?;
|
||||
let schemars::schema::Schema::Object(to) = t else {
|
||||
return Err(anyhow::anyhow!(
|
||||
"Failed to get object schema, should have not been a primitive"
|
||||
));
|
||||
};
|
||||
if let Some(metadata) = obj.metadata.as_mut() {
|
||||
if metadata.description.is_none() {
|
||||
metadata.description = to.metadata.as_ref().and_then(|m| m.description.clone());
|
||||
}
|
||||
} else {
|
||||
obj.metadata = to.metadata.clone();
|
||||
}
|
||||
return Ok(schemars::schema::Schema::Object(obj));
|
||||
}
|
||||
|
||||
// Check if this is the type we already know about.
|
||||
for (n, s) in types {
|
||||
if is_same_schema(schema, s) && name != n && !n.starts_with("[") {
|
||||
|
@ -53,6 +53,9 @@ pub struct StdLibFnArg {
|
||||
/// The schema of the argument.
|
||||
#[ts(type = "any")]
|
||||
pub schema: schemars::schema::Schema,
|
||||
/// The schema definitions for the argument.
|
||||
#[ts(type = "any")]
|
||||
pub schema_definitions: schemars::Map<String, schemars::schema::Schema>,
|
||||
/// If the argument is required.
|
||||
pub required: bool,
|
||||
}
|
||||
@ -86,7 +89,7 @@ impl StdLibFnArg {
|
||||
}
|
||||
|
||||
pub fn description(&self) -> Option<String> {
|
||||
get_description_string_from_schema(&self.schema.clone())
|
||||
get_description_string_from_schema(&self.schema.clone(), &self.schema_definitions)
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,10 +123,10 @@ pub trait StdLibFn: std::fmt::Debug + Send + Sync {
|
||||
fn tags(&self) -> Vec<String>;
|
||||
|
||||
/// The args of the function.
|
||||
fn args(&self) -> Vec<StdLibFnArg>;
|
||||
fn args(&self, inline_subschemas: bool) -> Vec<StdLibFnArg>;
|
||||
|
||||
/// The return value of the function.
|
||||
fn return_value(&self) -> Option<StdLibFnArg>;
|
||||
fn return_value(&self, inline_subschemas: bool) -> Option<StdLibFnArg>;
|
||||
|
||||
/// If the function is unpublished.
|
||||
fn unpublished(&self) -> bool;
|
||||
@ -147,8 +150,8 @@ pub trait StdLibFn: std::fmt::Debug + Send + Sync {
|
||||
summary: self.summary(),
|
||||
description: self.description(),
|
||||
tags: self.tags(),
|
||||
args: self.args(),
|
||||
return_value: self.return_value(),
|
||||
args: self.args(false),
|
||||
return_value: self.return_value(false),
|
||||
unpublished: self.unpublished(),
|
||||
deprecated: self.deprecated(),
|
||||
examples: self.examples(),
|
||||
@ -158,7 +161,7 @@ pub trait StdLibFn: std::fmt::Debug + Send + Sync {
|
||||
fn fn_signature(&self) -> String {
|
||||
let mut signature = String::new();
|
||||
signature.push_str(&format!("{}(", self.name()));
|
||||
for (i, arg) in self.args().iter().enumerate() {
|
||||
for (i, arg) in self.args(false).iter().enumerate() {
|
||||
if i > 0 {
|
||||
signature.push_str(", ");
|
||||
}
|
||||
@ -169,7 +172,7 @@ pub trait StdLibFn: std::fmt::Debug + Send + Sync {
|
||||
}
|
||||
}
|
||||
signature.push(')');
|
||||
if let Some(return_value) = self.return_value() {
|
||||
if let Some(return_value) = self.return_value(false) {
|
||||
signature.push_str(&format!(" -> {}", return_value.type_));
|
||||
}
|
||||
|
||||
@ -212,7 +215,7 @@ pub trait StdLibFn: std::fmt::Debug + Send + Sync {
|
||||
fn to_autocomplete_snippet(&self) -> Result<String> {
|
||||
let mut args = Vec::new();
|
||||
let mut index = 0;
|
||||
for arg in self.args().iter() {
|
||||
for arg in self.args(true).iter() {
|
||||
if let Some((i, arg_str)) = arg.get_autocomplete_snippet(index)? {
|
||||
index = i + 1;
|
||||
args.push(arg_str);
|
||||
@ -238,7 +241,7 @@ pub trait StdLibFn: std::fmt::Debug + Send + Sync {
|
||||
self.summary()
|
||||
},
|
||||
})),
|
||||
parameters: Some(self.args().into_iter().map(|arg| arg.into()).collect()),
|
||||
parameters: Some(self.args(true).into_iter().map(|arg| arg.into()).collect()),
|
||||
active_parameter,
|
||||
}],
|
||||
active_signature: Some(0),
|
||||
@ -308,13 +311,22 @@ impl Clone for Box<dyn StdLibFn> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_description_string_from_schema(schema: &schemars::schema::Schema) -> Option<String> {
|
||||
pub fn get_description_string_from_schema(
|
||||
schema: &schemars::schema::Schema,
|
||||
definitions: &schemars::Map<String, schemars::schema::Schema>,
|
||||
) -> Option<String> {
|
||||
if let schemars::schema::Schema::Object(o) = schema {
|
||||
if let Some(metadata) = &o.metadata {
|
||||
if let Some(description) = &metadata.description {
|
||||
return Some(description.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(reference) = &o.reference {
|
||||
if let Some(definition) = definitions.get(reference.split('/').last().unwrap_or("")) {
|
||||
return get_description_string_from_schema(definition, definitions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
@ -692,7 +704,7 @@ pub fn completion_item_from_enum_schema(
|
||||
kind: CompletionItemKind,
|
||||
) -> Result<CompletionItem> {
|
||||
// Get the docs for the schema.
|
||||
let description = get_description_string_from_schema(schema).unwrap_or_default();
|
||||
let description = get_description_string_from_schema(schema, &Default::default()).unwrap_or_default();
|
||||
let schemars::schema::Schema::Object(o) = schema else {
|
||||
anyhow::bail!("expected object schema: {:#?}", schema);
|
||||
};
|
||||
@ -754,7 +766,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_function() {
|
||||
let some_function_string = r#"{"type":"StdLib","func":{"name":"line","summary":"","description":"","tags":[],"returnValue":{"type":"","required":false,"name":"","schema":{}},"args":[],"unpublished":false,"deprecated":false, "examples": []}}"#;
|
||||
let some_function_string = r#"{"type":"StdLib","func":{"name":"line","summary":"","description":"","tags":[],"returnValue":{"type":"","required":false,"name":"","schema":{},"schemaDefinitions":{}},"args":[],"unpublished":false,"deprecated":false, "examples": []}}"#;
|
||||
let some_function: crate::ast::types::Function = serde_json::from_str(some_function_string).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
|
10
src/wasm-lib/kcl/src/docs/templates/schema.hbs
vendored
@ -4,18 +4,16 @@
|
||||
|
||||
{{#if $ref}}
|
||||
{{pretty_ref $ref}}
|
||||
{{else if enum}}
|
||||
**enum:** {{pretty_enum enum}}
|
||||
{{else if type}}
|
||||
**Type:** `{{type}}`{{~ #if format }} (`{{format}}`){{/if ~}}
|
||||
{{/if}}
|
||||
|
||||
{{#if $schema}}
|
||||
**Schema:** `{{$schema}}`
|
||||
{{/if}}
|
||||
|
||||
{{#if enum}}
|
||||
**enum:** {{pretty_enum enum}}
|
||||
{{else if type}}
|
||||
**Type:** `{{type}}`
|
||||
{{/if}}
|
||||
|
||||
{{#if items}}
|
||||
{{>array}}
|
||||
{{/if}}
|
||||
|
@ -41,9 +41,10 @@ fn lint_too_many_args_std_lib_function(f: Box<dyn StdLibFn>, exp: &CallExpressio
|
||||
return Ok(findings);
|
||||
}
|
||||
|
||||
if exp.arguments.len() > f.args().len() {
|
||||
let fn_args_len = f.args(false).len();
|
||||
if exp.arguments.len() > fn_args_len {
|
||||
findings.push(Z0002.at(
|
||||
format!("expected {} arguments, found {}", f.args().len(), exp.arguments.len()),
|
||||
format!("expected {} arguments, found {}", fn_args_len, exp.arguments.len()),
|
||||
SourceRange::new(exp.start, exp.end),
|
||||
));
|
||||
}
|
||||
|
@ -1651,7 +1651,7 @@ fn fn_call(i: TokenSlice) -> PResult<CallExpression> {
|
||||
let args = arguments(i)?;
|
||||
if let Some(std_fn) = crate::std::get_stdlib_fn(&fn_name.name) {
|
||||
// Type check the arguments.
|
||||
for (i, spec_arg) in std_fn.args().iter().enumerate() {
|
||||
for (i, spec_arg) in std_fn.args(false).iter().enumerate() {
|
||||
let Some(arg) = &args.get(i) else {
|
||||
// The executor checks the number of arguments, so we don't need to check it here.
|
||||
continue;
|
||||
|