@oslo-flanders/swagger-generator 3.0.1 → 3.1.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.
|
@@ -129,7 +129,9 @@ let SwaggerGenerationService = class SwaggerGenerationService {
|
|
|
129
129
|
},
|
|
130
130
|
};
|
|
131
131
|
/* Create embedded (self-contained) variant with all $ref resolved inline */
|
|
132
|
-
const embeddedComponents = this.
|
|
132
|
+
const embeddedComponents = this.configuration.generateEmbedded
|
|
133
|
+
? this.resolveRefs(components, schemas)
|
|
134
|
+
: undefined;
|
|
133
135
|
/* Create Swagger endpoint paths as example */
|
|
134
136
|
const swagger = this.createSwagger(schemas, links);
|
|
135
137
|
/* Only append the language suffix when the generated language differs from the primary language */
|
|
@@ -143,7 +145,9 @@ let SwaggerGenerationService = class SwaggerGenerationService {
|
|
|
143
145
|
for (const label of Object.keys(links))
|
|
144
146
|
await this.writeOutput(format, links[label], `swagger/components/links/${label}${languageSuffix}${ext}`);
|
|
145
147
|
await this.writeOutput(format, components, `swagger/components${languageSuffix}${ext}`);
|
|
146
|
-
|
|
148
|
+
if (embeddedComponents) {
|
|
149
|
+
await this.writeOutput(format, embeddedComponents, `swagger/_embedded${languageSuffix}${ext}`);
|
|
150
|
+
}
|
|
147
151
|
await this.writeOutput(format, swagger, `swagger/example${languageSuffix}${ext}`);
|
|
148
152
|
}
|
|
149
153
|
}
|
|
@@ -50,6 +50,11 @@ class SwaggerGenerationServiceRunner extends core_1.AppRunner {
|
|
|
50
50
|
describe: 'Disable the creation of links.',
|
|
51
51
|
default: false,
|
|
52
52
|
boolean: true,
|
|
53
|
+
})
|
|
54
|
+
.option('generateEmbedded', {
|
|
55
|
+
describe: 'Generate the embedded (self-contained) variant with all $ref resolved inline.',
|
|
56
|
+
default: false,
|
|
57
|
+
boolean: true,
|
|
53
58
|
})
|
|
54
59
|
.option('expanded', {
|
|
55
60
|
describe: 'Use JSON-LD expanded format instead of default compact format.',
|
|
@@ -78,6 +78,10 @@ export declare class SwaggerGenerationServiceConfiguration implements IConfigura
|
|
|
78
78
|
* Whether to disable the creation of links
|
|
79
79
|
*/
|
|
80
80
|
private _disableLinks;
|
|
81
|
+
/**
|
|
82
|
+
* Whether to generate the embedded (self-contained) variant with all $ref resolved inline
|
|
83
|
+
*/
|
|
84
|
+
private _generateEmbedded;
|
|
81
85
|
/**
|
|
82
86
|
* Whether to use expanded JSON-LD format or not
|
|
83
87
|
*/
|
|
@@ -110,6 +114,7 @@ export declare class SwaggerGenerationServiceConfiguration implements IConfigura
|
|
|
110
114
|
get excludeProperties(): string[];
|
|
111
115
|
get outputFormat(): OutputFormat[];
|
|
112
116
|
get disableLinks(): boolean;
|
|
117
|
+
get generateEmbedded(): boolean;
|
|
113
118
|
get expanded(): boolean;
|
|
114
119
|
get excludeClassesExpanded(): string[];
|
|
115
120
|
get excludePropertiesExpanded(): string[];
|
|
@@ -30,6 +30,7 @@ let SwaggerGenerationServiceConfiguration = class SwaggerGenerationServiceConfig
|
|
|
30
30
|
this._excludeProperties = params.excludeProperties;
|
|
31
31
|
this._outputFormat = params.outputFormat;
|
|
32
32
|
this._disableLinks = params.disableLinks;
|
|
33
|
+
this._generateEmbedded = params.generateEmbedded;
|
|
33
34
|
this._expanded = params.expanded;
|
|
34
35
|
this._excludeClassesExpanded = params.excludeClassesExpanded;
|
|
35
36
|
this._excludePropertiesExpanded = (params.excludePropertiesExpanded);
|
|
@@ -116,6 +117,9 @@ let SwaggerGenerationServiceConfiguration = class SwaggerGenerationServiceConfig
|
|
|
116
117
|
get disableLinks() {
|
|
117
118
|
return !!this._disableLinks;
|
|
118
119
|
}
|
|
120
|
+
get generateEmbedded() {
|
|
121
|
+
return !!this._generateEmbedded;
|
|
122
|
+
}
|
|
119
123
|
get expanded() {
|
|
120
124
|
return !!this._expanded;
|
|
121
125
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslo-flanders/swagger-generator",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.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",
|