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
This will output the same result as the async version:
107
+
108
+
```js
109
+
{
110
+
type:'string',
111
+
format:'date-time',
112
+
nullable:true
113
+
}
114
+
```
115
+
116
+
### Options for convertSync
117
+
118
+
`convertSync` supports a subset of the options available to `convert`:
119
+
120
+
#### `cloneSchema` (boolean)
121
+
122
+
If set to `false`, converts the provided schema in place. If `true`, clones the schema by converting it to JSON and back. The overhead of the cloning is usually negligible. Defaults to `true`.
123
+
124
+
#### `convertUnreferencedDefinitions` (boolean)
125
+
126
+
Defaults to `true`.
127
+
128
+
If a schema has a `definitions` property (valid in JSON Schema), and only some entries are referenced, we'll still try to convert the remaining definitions to OpenAPI. If you do not want this behavior, set this to `false`.
129
+
130
+
### ⚠️ Limitations
131
+
132
+
`convertSync` does **not** support dereferencing external references (`$ref` to HTTP/HTTPS URLs or external files). If your schema contains external references, use the async `convert` function with the `dereference: true` option instead.
**Note:** External references will remain as `$ref` pointers in the output schema. They will not be expanded or validated.
156
+
89
157
## Why?
90
158
91
159
OpenAPI is often described as an extension of JSON Schema, but both specs have changed over time and grown independently. OpenAPI v2 was based on JSON Schema draft v4 with a long list of deviations, but OpenAPI v3 shrank that list, upping their support to draft v4 and making the list of discrepancies shorter. This has been solved for OpenAPI v3.1, but for those using OpenAPI v3.0, you can use this tool to solve [the divergence](https://apisyouwonthate.com/blog/openapi-and-json-schema-divergence).
0 commit comments