Skip to content

Commit

Permalink
HCK-8865: implemented schema version change for Swagger Schema FE (#39)
Browse files Browse the repository at this point in the history
* HCK-8865: implemented schema version change for Swagger Schema FE

* HCK-8865: renamed appTargetVersion to apiTargetVersion

* HCK-8865: added versions check
  • Loading branch information
WilhelmWesser authored Dec 5, 2024
1 parent d0c8713 commit d407bf8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion forward_engineering/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const utils = require('./utils/utils');
const filtrationConfig = require('./utils/filtrationConfig');
const mapJsonSchema = require('../reverse_engineering/helpers/adaptJsonSchema/mapJsonSchema');
const handleReferencePath = require('./helpers/handleReferencePath');
const versions = require('../package.json').contributes.target.versions;

module.exports = {
generateModelScript(data, logger, cb) {
Expand All @@ -26,6 +27,8 @@ module.exports = {
security: modelSecurity,
securityDefinitions: modelSecurityDefinitions,
} = data.modelData[0];
const apiTargetVersion = data?.options?.apiTargetVersion;
const specVersion = apiTargetVersion && versions.includes(apiTargetVersion) ? apiTargetVersion : dbVersion;

const resolveApiExternalRefs = data.options?.additionalOptions?.find(
option => option.id === 'resolveApiExternalRefs',
Expand All @@ -52,7 +55,7 @@ module.exports = {
const securityDefinitions = commonHelper.mapSecurityDefinitions(modelSecurityDefinitions);

const swaggerSchema = {
swagger: dbVersion,
swagger: specVersion,
info,
host,
basePath,
Expand Down

0 comments on commit d407bf8

Please sign in to comment.