@penkov/swagger-code-gen 1.9.0 → 1.9.1
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/dist/components-parse.js +7 -3
- package/package.json +1 -1
package/dist/components-parse.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Collection, mutable, option } from 'scats';
|
|
1
|
+
import { Collection, mutable, Nil, option } from 'scats';
|
|
2
2
|
import { SchemaFactory, SchemaObject } from './schemas.js';
|
|
3
3
|
import { SCHEMA_PREFIX } from './property.js';
|
|
4
4
|
import { Method, supportedBodyMimeTypes } from './method.js';
|
|
5
5
|
export function resolveSchemasTypes(json) {
|
|
6
6
|
const jsonSchemas = json.components.schemas;
|
|
7
7
|
const schemasNames = Collection.from(Object.keys(jsonSchemas));
|
|
8
|
-
const sharedBodies =
|
|
8
|
+
const sharedBodies = option(json?.components?.requestBodies)
|
|
9
|
+
.map(x => Collection.from(Object.keys(x)))
|
|
10
|
+
.getOrElseValue(Nil)
|
|
9
11
|
.toMap(name => {
|
|
10
12
|
const sharedBodyDef = json.components.requestBodies[name];
|
|
11
13
|
const mimeTypes = Collection.from(Object.keys(sharedBodyDef['content']));
|
|
@@ -23,7 +25,9 @@ export function resolveSchemasTypes(json) {
|
|
|
23
25
|
export function resolveSchemas(json, schemasTypes, options) {
|
|
24
26
|
const schemas = Collection.from(Object.keys(json.components.schemas))
|
|
25
27
|
.toMap(schemaName => [schemaName, json.components.schemas[schemaName]])
|
|
26
|
-
.appendedAll(
|
|
28
|
+
.appendedAll(option(json?.components?.requestBodies)
|
|
29
|
+
.map(x => Collection.from(Object.keys(x)))
|
|
30
|
+
.getOrElseValue(Nil)
|
|
27
31
|
.filter(rb => option(json.components.requestBodies[rb]['content']).isDefined)
|
|
28
32
|
.toMap(rb => {
|
|
29
33
|
const sharedBodyDef = json.components.requestBodies[rb];
|