You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| attribute annotation | Not supported. We are planning to add an extension `deprecate` field to the KCL-OpenAPI |
101
-
| attribute name | The key of the property under the `property` object |
102
-
| attribute optional modifiers(`?`) | In each element in the `definition` object, here's an optional `required` field which lists the all the required attributes of that model, and the attributes not listed are optional |
103
-
| attribute type | The basic types can be declared by a combination of `type` and `format`, and the schema type is declared by a `$ref` to the schema definition. KCL-OpenAPI spec adds a `x-kcl-types` extension to indicate a type union. `enum` indicates a union of several literal types. For the type declartion in KCL-OpenAPI, see the chapter - [basic data types](#basic-data-types)|
104
-
| attribute default value | The value of the `default` field is used to set the default value for the attribute |
98
+
| Elements of KCL Schema Attribute | Corresponding Elements in OpenAPI|
| attribute annotation | Not supported. We are planning to add an extension `deprecate` field to the KCL-OpenAPI|
101
+
| attribute name | The key of the property under the `property` object|
102
+
| attribute optional modifiers(`?`) | In each element in the `definition` object, here's an optional `required` field which lists the all the required attributes of that model, and the attributes not listed are optional|
103
+
| attribute type | The basic types can be declared by a combination of `type` and `format`, and the schema type is declared by a `$ref` to the schema definition. KCL-OpenAPI spec adds a `x-kcl-types` extension to indicate a type union. `enum` indicates a union of several literal types. For the type declaration in KCL-OpenAPI, see the chapter - [basic data types](#basic-data-types)|
104
+
| attribute default value | The value of the `default` field is used to set the default value for the attribute|
105
105
106
106
Example:
107
107
@@ -144,19 +144,19 @@ schema Pet:
144
144
145
145
### Schema Index Signature
146
146
147
-
In the KCL schema, the index signatures can be used to define attributes with unfined attribute names. The KCL schema index signature contains the following elements:
147
+
In the KCL schema, the index signatures can be used to define attributes with undefined attribute names. The KCL schema index signature contains the following elements:
148
148
149
149
- Type of the key in the index signature: Declared in square brackets. It must be the basic type
150
150
- Type of value in the index signature: Declared after the colon in the square brackets. It can be any valid KCL type
151
-
- Ellipses(`...`) in the index signature: In the square brackets, before the type declaration of the key. It indicates that the index signature is only used to constrain attributes not defined in the schema. The absentation of the symbol indicates that all defined and undefined attributes in the schema are constrained by the index signature.
151
+
- Ellipses(`...`) in the index signature: In the square brackets, before the type declaration of the key. It indicates that the index signature is only used to constrain attributes not defined in the schema. The assentation of the symbol indicates that all defined and undefined attributes in the schema are constrained by the index signature.
152
152
- Alias for key in index signature: Declared in square brackets, immediately after the left square bracket and takes the form of `<name>:`. The alias can then be used to reference the index signature by name
153
153
- The default value of the index signature: Assign a value to the index signature as the default value
154
154
155
155
The index signature with its key in `string` type can be described based on the field `additionalProperties`. Other index signatures with a key in types besides `string`, and the `check` expressions used to validate the index signature are not supported by the KCL OpenAPI spec.
156
156
157
157
The mapping between them and the OpenAPI spec is as follows:
158
158
159
-
| Elements of KCL Index Signature|Corresponding Elements in OpenAPI|
159
+
|Elements of KCL Index Signature |Corresponding Elements in OpenAPI|
| Type of the key in the KCL index signature | Only string type is allowed in OpenAPI |
162
162
| Type of the value in the KCL index signature | Declared by the `type` in the `additionalProperties` field |
@@ -214,7 +214,7 @@ working in progress
214
214
215
215
OpenAPI supports models to be declared inline. But KCL currently does not support that. The model defined inline in OpenAPI will be converted to a schema with a name in KCL. And the naming convention will be:
216
216
217
-
| element to define an inline schema in OpenAPI |the name of the corresponding KCL schema|
217
+
| element to define an inline schema in OpenAPI |the name of the corresponding KCL schema|
0 commit comments