chore: update Bitbucket Cloud models
The latest specification contained some BREAKING CHANGES due to removed fields. All of these fields are not used at other plugins, though. Therefore, this change has no impact on other modules here. Signed-off-by: Patrick Jungermann <Patrick.Jungermann@gmail.com>
This commit is contained in:
@@ -99,6 +99,18 @@ function setPaginatedResultItemType(modelsModule) {
|
||||
});
|
||||
}
|
||||
|
||||
function fixTeamLinksExtension(modelsModule) {
|
||||
const accountLinks = modelsModule.getInterfaceOrThrow('AccountLinks');
|
||||
const teamLinks = modelsModule.getInterfaceOrThrow('TeamLinks');
|
||||
teamLinks.addExtends(accountLinks.getName());
|
||||
accountLinks.getProperties().forEach(prop => {
|
||||
const other = teamLinks.getProperty(prop.getName());
|
||||
if (other && other.getText() === prop.getText()) {
|
||||
other.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const project = new tsMorph.Project({
|
||||
tsConfigFilePath: '../../tsconfig.json',
|
||||
skipAddingFilesFromTsConfig: true,
|
||||
@@ -111,5 +123,6 @@ const modelsModule = modelsFile.getModuleOrThrow('Models');
|
||||
cleanupWrongAllOfModels(modelsModule);
|
||||
makePaginatedGeneric(modelsModule);
|
||||
setPaginatedResultItemType(modelsModule);
|
||||
fixTeamLinksExtension(modelsModule);
|
||||
|
||||
project.saveSync();
|
||||
|
||||
@@ -22,4 +22,4 @@ PLUGIN_DIR="${SCRIPT_DIR}/.."
|
||||
yarn --cwd "${PLUGIN_DIR}" openapi-generator-cli generate --generator-key backstage
|
||||
rm -d "${PLUGIN_DIR}/src/apis" # empty dir or fails
|
||||
"${SCRIPT_DIR}"/adjust-models.js
|
||||
yarn --cwd "${PLUGIN_DIR}" prettier --check . -w
|
||||
yarn run -T prettier --check . -w
|
||||
|
||||
@@ -214,19 +214,6 @@ const preventHardToDetectDuplicateInterfacesDueToAllOf = json => {
|
||||
return json;
|
||||
};
|
||||
|
||||
const removeBuggyDescription = json => {
|
||||
const valueProp =
|
||||
json.components.schemas.branchrestriction.allOf[1].properties.value;
|
||||
if (!valueProp.description.startsWith('<staticmethod')) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('[WARN] "removeBuggyDescription" is not necessary anymore.');
|
||||
return json;
|
||||
}
|
||||
|
||||
delete valueProp.description;
|
||||
return json;
|
||||
};
|
||||
|
||||
const resolveConflictingInheritance = json => {
|
||||
const schema = json.components.schemas.pipeline_selector;
|
||||
const extension = schema.allOf[1];
|
||||
@@ -269,7 +256,6 @@ fetch(SCHEMA_SOURCE)
|
||||
.then(addPaginatedDefinition)
|
||||
.then(paginatedDefinitionsExtendPaginated)
|
||||
.then(preventHardToDetectDuplicateInterfacesDueToAllOf)
|
||||
.then(removeBuggyDescription)
|
||||
.then(resolveConflictingInheritance)
|
||||
.then(escapeTsdocInDescription)
|
||||
.then(relativeToAbsoluteUrls)
|
||||
|
||||
Reference in New Issue
Block a user