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
Copy file name to clipboardExpand all lines: docs/src/content/docs/node.md
+46-2
Original file line number
Diff line number
Diff line change
@@ -118,7 +118,7 @@ That would result in the following change:
118
118
119
119
```diff
120
120
- updated_at?: string;
121
-
+ updated_at?: Date;
121
+
+ updated_at: Date | null;
122
122
```
123
123
124
124
#### Example: `Blob` types
@@ -158,7 +158,51 @@ Resultant diff with correctly-typed `file` property:
158
158
159
159
```diff
160
160
- file?: string;
161
-
+ file?: Blob;
161
+
+ file: Blob | null;
162
+
```
163
+
164
+
#### Example: Add "?" token to property
165
+
166
+
It is not possible to create a property with the optional "?" token with the above `transform` functions. The transform function also accepts a different return object, which allows you to add a "?" token to the property. Here's an example schema:
167
+
168
+
```yaml
169
+
Body_file_upload:
170
+
type: object;
171
+
properties:
172
+
file:
173
+
type: string;
174
+
format: binary;
175
+
required: true;
176
+
```
177
+
178
+
Here we return an object with a schema property, which is the same as the above example, but we also add a `questionToken` property, which will add the "?" token to the property.
Resultant diff with correctly-typed `file` property and "?" token:
202
+
203
+
```diff
204
+
- file: Blob;
205
+
+ file?: Blob | null;
162
206
```
163
207
164
208
Any [Schema Object](https://spec.openapis.org/oas/latest.html#schema-object) present in your schema will be run through this formatter (even remote ones!). Also be sure to check the `metadata` parameter for additional context that may be helpful.
0 commit comments