swagger-editor 4.11.2 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -177,6 +177,62 @@ You can then view the app by navigating to `http://localhost` in your browser.
177
177
 
178
178
  * [Contributing](https://github.com/swagger-api/.github/blob/master/CONTRIBUTING.md)
179
179
 
180
+ ### Using older version of React
181
+
182
+ > [!IMPORTANT]
183
+ > By older versions we specifically refer to `React >=17 <18`.
184
+
185
+ By default [swagger-editor@5](https://www.npmjs.com/package/swagger-editor) npm package comes with latest version of [React@18](https://react.dev/blog/2022/03/29/react-v18).
186
+ It's possible to use _swagger-editor@5_ npm package with older version of React.
187
+
188
+ Let's say my application integrates with _swagger-editor@5_ npm package and uses [React@17.0.2](https://www.npmjs.com/package/react/v/17.0.2).
189
+
190
+ ### npm
191
+
192
+ In order to inform `swagger-editor@5` npm package that I require it to use my React version, I need to use [npm overrides](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides).
193
+
194
+ ```json
195
+ {
196
+ "dependencies": {
197
+ "react": "=17.0.2",
198
+ "react-dom": "=17.0.2"
199
+ },
200
+ "overrides": {
201
+ "swagger-editor": {
202
+ "react": "$react",
203
+ "react": "$react-dom",
204
+ "react-redux": "^8"
205
+ }
206
+ }
207
+ }
208
+ ```
209
+
210
+ > [!NOTE]
211
+ > The React and ReactDOM override are defined as a reference to the dependency. Since _react-redux@9_ only supports `React >= 18`, we need to use _react-redux@8_.
212
+
213
+
214
+ ### yarn
215
+
216
+ In order to inform `swagger-editor@5` npm package that I require it to use my specific React version, I need to use [yarm resolutions](https://yarnpkg.com/cli/set/resolution).
217
+
218
+
219
+ ```json
220
+ {
221
+ "dependencies": {
222
+ "react": "17.0.2",
223
+ "react-dom": "17.0.2"
224
+ },
225
+ "resolutions": {
226
+ "swagger-editor/react": "17.0.2",
227
+ "swagger-editor/react-dom": "17.0.2",
228
+ "swagger-editor/react-redux": "^8"
229
+ }
230
+ }
231
+ ```
232
+
233
+ > [!NOTE]
234
+ > The React and ReactDOM resolution cannot be defined as a reference to the dependency. Unfortunately *yarn* does not support aliasing like `$react` or `$react-dom` as *npm* does. You'll need to specify the exact versions.
235
+
180
236
  ## Security contact
181
237
 
182
238
  Please disclose any security-related issues or vulnerabilities by emailing [security@swagger.io](mailto:security@swagger.io), instead of using the public issue tracker.