@oslo-flanders/swagger-generator 1.3.1 → 1.4.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.
|
@@ -385,16 +385,19 @@ let SwaggerGenerationService = class SwaggerGenerationService {
|
|
|
385
385
|
const requiredProperties = properties
|
|
386
386
|
? Object.keys(properties)
|
|
387
387
|
: undefined;
|
|
388
|
-
|
|
389
|
-
let item
|
|
390
|
-
if (
|
|
391
|
-
|
|
388
|
+
const isPrimitive = [...core_1.DataTypes.values()].includes(attributeDatatypeId);
|
|
389
|
+
let item;
|
|
390
|
+
if (isPrimitive) {
|
|
391
|
+
/* Wrap primitive property in its own named schema to avoid naming collisions */
|
|
392
|
+
const schemaName = `${label}.${attributeLabel}`;
|
|
393
|
+
schemas[schemaName] = {
|
|
394
|
+
title: schemaName,
|
|
392
395
|
type: 'object',
|
|
393
396
|
description: description,
|
|
394
397
|
properties: properties,
|
|
395
398
|
required: requiredProperties,
|
|
396
399
|
};
|
|
397
|
-
|
|
400
|
+
item = { $ref: `#/components/schemas/${schemaName}` };
|
|
398
401
|
}
|
|
399
402
|
else {
|
|
400
403
|
item = properties;
|
|
@@ -403,7 +406,7 @@ let SwaggerGenerationService = class SwaggerGenerationService {
|
|
|
403
406
|
/* minItems must be 1, empty arrays are removed by not including the attribute, even if minCount == 0 */
|
|
404
407
|
attributes[label][attributeLabel] = {
|
|
405
408
|
type: 'array',
|
|
406
|
-
description:
|
|
409
|
+
description: `${description} Lijst van ${attributeDatatypeLabel} items.`,
|
|
407
410
|
items: item,
|
|
408
411
|
minItems: Math.max(parseInt(attributeMinCount), 1),
|
|
409
412
|
maxItems: attributeMaxCount == '*'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslo-flanders/swagger-generator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Generate OpenAPI Swagger YAML documentation.",
|
|
5
5
|
"author": "Digitaal Vlaanderen <https://data.vlaanderen.be/id/organisatie/OVO002949>",
|
|
6
6
|
"homepage": "https://github.com/informatievlaanderen/OSLO-UML-Transformer/tree/main/packages/oslo-generator-swagger#readme",
|