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:
@@ -0,0 +1,11 @@
|
||||
---
|
||||
'@backstage/plugin-bitbucket-cloud-common': minor
|
||||
---
|
||||
|
||||
Update Bitbucket Cloud models to latest OAS version.
|
||||
|
||||
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.
|
||||
@@ -33,37 +33,22 @@ export type FilterAndSortOptions = {
|
||||
// @public (undocumented)
|
||||
export namespace Models {
|
||||
export interface Account extends ModelObject {
|
||||
account_status?: string;
|
||||
// (undocumented)
|
||||
created_on?: string;
|
||||
// (undocumented)
|
||||
display_name?: string;
|
||||
// (undocumented)
|
||||
has_2fa_enabled?: boolean;
|
||||
// (undocumented)
|
||||
links?: AccountLinks;
|
||||
nickname?: string;
|
||||
// (undocumented)
|
||||
username?: string;
|
||||
// (undocumented)
|
||||
uuid?: string;
|
||||
// (undocumented)
|
||||
website?: string;
|
||||
}
|
||||
// (undocumented)
|
||||
export interface AccountLinks {
|
||||
// (undocumented)
|
||||
[key: string]: unknown;
|
||||
// (undocumented)
|
||||
avatar?: Link;
|
||||
// (undocumented)
|
||||
followers?: Link;
|
||||
// (undocumented)
|
||||
following?: Link;
|
||||
// (undocumented)
|
||||
html?: Link;
|
||||
// (undocumented)
|
||||
repositories?: Link;
|
||||
// (undocumented)
|
||||
self?: Link;
|
||||
}
|
||||
export interface Author extends ModelObject {
|
||||
raw?: string;
|
||||
@@ -176,7 +161,7 @@ export namespace Models {
|
||||
// (undocumented)
|
||||
state?: ParticipantStateEnum;
|
||||
// (undocumented)
|
||||
user?: User;
|
||||
user?: Account;
|
||||
}
|
||||
const // (undocumented)
|
||||
ParticipantRoleEnum: {
|
||||
@@ -339,11 +324,21 @@ export namespace Models {
|
||||
// (undocumented)
|
||||
readonly text?: string;
|
||||
}
|
||||
export interface Team extends Account {}
|
||||
export interface User extends Account {
|
||||
account_id?: string;
|
||||
export interface Team extends Account {
|
||||
// (undocumented)
|
||||
is_staff?: boolean;
|
||||
links?: TeamLinks;
|
||||
}
|
||||
export interface TeamLinks extends AccountLinks {
|
||||
// (undocumented)
|
||||
html?: Link;
|
||||
// (undocumented)
|
||||
members?: Link;
|
||||
// (undocumented)
|
||||
projects?: Link;
|
||||
// (undocumented)
|
||||
repositories?: Link;
|
||||
// (undocumented)
|
||||
self?: Link;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -21,7 +21,7 @@
|
||||
"clean": "backstage-cli package clean",
|
||||
"prepack": "backstage-cli package prepack",
|
||||
"postpack": "backstage-cli package postpack",
|
||||
"refresh-schema": "scripts/prepare-schema.js && prettier --check bitbucket-cloud.oas.json -w",
|
||||
"refresh-schema": "scripts/prepare-schema.js && yarn run -T prettier --check bitbucket-cloud.oas.json -w",
|
||||
"generate-models": "scripts/generate-models.sh",
|
||||
"reduce-models": "scripts/reduce-models.js",
|
||||
"update-models": "yarn refresh-schema && yarn generate-models && yarn reduce-models"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -33,33 +33,20 @@ export namespace Models {
|
||||
* @public
|
||||
*/
|
||||
export interface Account extends ModelObject {
|
||||
/**
|
||||
* The status of the account. Currently the only possible value is "active", but more values may be added in the future.
|
||||
*/
|
||||
account_status?: string;
|
||||
created_on?: string;
|
||||
display_name?: string;
|
||||
has_2fa_enabled?: boolean;
|
||||
links?: AccountLinks;
|
||||
/**
|
||||
* Account name defined by the owner. Should be used instead of the "username" field. Note that "nickname" cannot be used in place of "username" in URLs and queries, as "nickname" is not guaranteed to be unique.
|
||||
*/
|
||||
nickname?: string;
|
||||
username?: string;
|
||||
uuid?: string;
|
||||
website?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Links related to an Account.
|
||||
* @public
|
||||
*/
|
||||
export interface AccountLinks {
|
||||
[key: string]: unknown;
|
||||
avatar?: Link;
|
||||
followers?: Link;
|
||||
following?: Link;
|
||||
html?: Link;
|
||||
repositories?: Link;
|
||||
self?: Link;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -278,7 +265,7 @@ export namespace Models {
|
||||
participated_on?: string;
|
||||
role?: ParticipantRoleEnum;
|
||||
state?: ParticipantStateEnum;
|
||||
user?: User;
|
||||
user?: Account;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -516,17 +503,19 @@ export namespace Models {
|
||||
* A team object.
|
||||
* @public
|
||||
*/
|
||||
export interface Team extends Account {}
|
||||
export interface Team extends Account {
|
||||
links?: TeamLinks;
|
||||
}
|
||||
|
||||
/**
|
||||
* A user object.
|
||||
* Links related to a Team.
|
||||
* @public
|
||||
*/
|
||||
export interface User extends Account {
|
||||
/**
|
||||
* The user's Atlassian account ID.
|
||||
*/
|
||||
account_id?: string;
|
||||
is_staff?: boolean;
|
||||
export interface TeamLinks extends AccountLinks {
|
||||
html?: Link;
|
||||
members?: Link;
|
||||
projects?: Link;
|
||||
repositories?: Link;
|
||||
self?: Link;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user