Workflow to detect breaking changes (#12532)

New CI to detect breaking changes in the REST API or the GraphQL API
This commit is contained in:
Félix Malfait
2025-06-11 23:17:41 +02:00
committed by GitHub
parent 04dd0e50bb
commit ecbc116f8b
8 changed files with 1039 additions and 30 deletions

View File

@ -14,7 +14,7 @@ exports[`computeSchemaComponents Float without decimals 1`] = `
],
"type": "object",
},
"ObjectName for Response": {
"ObjectNameForResponse": {
"description": undefined,
"properties": {
"number2": {
@ -23,7 +23,7 @@ exports[`computeSchemaComponents Float without decimals 1`] = `
},
"type": "object",
},
"ObjectName for Update": {
"ObjectNameForUpdate": {
"description": undefined,
"properties": {
"number2": {
@ -49,7 +49,7 @@ exports[`computeSchemaComponents Integer dataType with decimals 1`] = `
],
"type": "object",
},
"ObjectName for Response": {
"ObjectNameForResponse": {
"description": undefined,
"properties": {
"number1": {
@ -58,7 +58,7 @@ exports[`computeSchemaComponents Integer dataType with decimals 1`] = `
},
"type": "object",
},
"ObjectName for Update": {
"ObjectNameForUpdate": {
"description": undefined,
"properties": {
"number1": {
@ -84,7 +84,7 @@ exports[`computeSchemaComponents Integer with a 0 decimals 1`] = `
],
"type": "object",
},
"ObjectName for Response": {
"ObjectNameForResponse": {
"description": undefined,
"properties": {
"number3": {
@ -93,7 +93,7 @@ exports[`computeSchemaComponents Integer with a 0 decimals 1`] = `
},
"type": "object",
},
"ObjectName for Update": {
"ObjectNameForUpdate": {
"description": undefined,
"properties": {
"number3": {

View File

@ -223,7 +223,7 @@ describe('computeSchemaComponents', () => {
],
"type": "object",
},
"ObjectName for Response": {
"ObjectNameForResponse": {
"description": undefined,
"properties": {
"fieldActor": {
@ -413,7 +413,7 @@ describe('computeSchemaComponents', () => {
"fieldRelation": {
"oneOf": [
{
"$ref": "#/components/schemas/RelationTargetObject for Response",
"$ref": "#/components/schemas/RelationTargetObjectForResponse",
},
],
"type": "object",
@ -442,7 +442,7 @@ describe('computeSchemaComponents', () => {
},
"type": "object",
},
"ObjectName for Update": {
"ObjectNameForUpdate": {
"description": undefined,
"properties": {
"fieldActor": {

View File

@ -358,7 +358,7 @@ const getSchemaComponentsRelationProperties = (
{
$ref: `#/components/schemas/${capitalize(
field.relationTargetObjectMetadata.nameSingular,
)} for Response`,
)}ForResponse`,
},
],
};
@ -368,7 +368,7 @@ const getSchemaComponentsRelationProperties = (
items: {
$ref: `#/components/schemas/${capitalize(
field.relationTargetObjectMetadata.nameSingular,
)} for Response`,
)}ForResponse`,
},
};
}
@ -446,14 +446,14 @@ export const computeSchemaComponents = (
forResponse: false,
withRelations: false,
});
schemas[capitalize(item.nameSingular) + ' for Update'] =
schemas[capitalize(item.nameSingular) + 'ForUpdate'] =
computeSchemaComponent({
item,
withRequiredFields: false,
forResponse: false,
withRelations: false,
});
schemas[capitalize(item.nameSingular) + ' for Response'] =
schemas[capitalize(item.nameSingular) + 'ForResponse'] =
computeSchemaComponent({
item,
withRequiredFields: false,
@ -515,14 +515,14 @@ export const computeMetadataSchemaComponents = (
$ref: `#/components/schemas/${capitalize(item.nameSingular)}`,
},
};
schemas[`${capitalize(item.nameSingular)} for Update`] = {
schemas[`${capitalize(item.nameSingular)}ForUpdate`] = {
type: 'object',
description: `An object`,
properties: {
isActive: { type: 'boolean' },
},
};
schemas[`${capitalize(item.nameSingular)} for Response`] = {
schemas[`${capitalize(item.nameSingular)}ForResponse`] = {
...schemas[`${capitalize(item.nameSingular)}`],
properties: {
...schemas[`${capitalize(item.nameSingular)}`].properties,
@ -542,7 +542,7 @@ export const computeMetadataSchemaComponents = (
node: {
type: 'array',
items: {
$ref: '#/components/schemas/Field for Response',
$ref: '#/components/schemas/FieldForResponse',
},
},
},
@ -551,11 +551,11 @@ export const computeMetadataSchemaComponents = (
},
},
};
schemas[`${capitalize(item.namePlural)} for Response`] = {
schemas[`${capitalize(item.namePlural)}ForResponse`] = {
type: 'array',
description: `A list of ${item.namePlural}`,
items: {
$ref: `#/components/schemas/${capitalize(item.nameSingular)} for Response`,
$ref: `#/components/schemas/${capitalize(item.nameSingular)}ForResponse`,
},
};
@ -622,12 +622,12 @@ export const computeMetadataSchemaComponents = (
$ref: `#/components/schemas/${capitalize(item.nameSingular)}`,
},
};
schemas[`${capitalize(item.nameSingular)} for Update`] =
schemas[`${capitalize(item.nameSingular)}ForUpdate`] =
baseFieldProperties({
withImmutableFields: false,
withRequiredFields: false,
});
schemas[`${capitalize(item.nameSingular)} for Response`] = {
schemas[`${capitalize(item.nameSingular)}ForResponse`] = {
...baseFieldProperties({
withImmutableFields: true,
withRequiredFields: false,
@ -642,11 +642,11 @@ export const computeMetadataSchemaComponents = (
updatedAt: { type: 'string', format: 'date-time' },
},
};
schemas[`${capitalize(item.namePlural)} for Response`] = {
schemas[`${capitalize(item.namePlural)}ForResponse`] = {
type: 'array',
description: `A list of ${item.namePlural}`,
items: {
$ref: `#/components/schemas/${capitalize(item.nameSingular)} for Response`,
$ref: `#/components/schemas/${capitalize(item.nameSingular)}ForResponse`,
},
};

View File

@ -101,7 +101,7 @@ export const computeWebhooks = (
example: '2024-02-14T11:27:01.779Z',
},
record: {
$ref: `#/components/schemas/${capitalize(item.nameSingular)} for Response`,
$ref: `#/components/schemas/${capitalize(item.nameSingular)}ForResponse`,
},
...(type === DatabaseEventAction.UPDATED && { updatedFields }),
},

View File

@ -19,7 +19,7 @@ export const getUpdateRequestBody = (name: string) => {
content: {
'application/json': {
schema: {
$ref: `#/components/schemas/${name} for Update`,
$ref: `#/components/schemas/${name}ForUpdate`,
},
},
},

View File

@ -8,7 +8,7 @@ export const getFindManyResponse200 = (
) => {
const schemaRef = `#/components/schemas/${capitalize(
item.nameSingular,
)} for Response`;
)}ForResponse`;
return {
description: 'Successful operation',
@ -57,7 +57,7 @@ export const getFindManyResponse200 = (
export const getFindOneResponse200 = (
item: Pick<ObjectMetadataEntity, 'nameSingular'>,
) => {
const schemaRef = `#/components/schemas/${capitalize(item.nameSingular)} for Response`;
const schemaRef = `#/components/schemas/${capitalize(item.nameSingular)}ForResponse`;
return {
description: 'Successful operation',
@ -89,7 +89,7 @@ export const getCreateOneResponse201 = (
const schemaRef = `#/components/schemas/${capitalize(
item.nameSingular,
)} for Response`;
)}ForResponse`;
return {
description: 'Successful operation',
@ -118,7 +118,7 @@ export const getCreateManyResponse201 = (
) => {
const schemaRef = `#/components/schemas/${capitalize(
item.nameSingular,
)} for Response`;
)}ForResponse`;
return {
description: 'Successful operation',
@ -150,7 +150,7 @@ export const getUpdateOneResponse200 = (
fromMetadata = false,
) => {
const one = fromMetadata ? 'One' : '';
const schemaRef = `#/components/schemas/${capitalize(item.nameSingular)} for Response`;
const schemaRef = `#/components/schemas/${capitalize(item.nameSingular)}ForResponse`;
return {
description: 'Successful operation',
@ -269,7 +269,7 @@ export const getFindDuplicatesResponse200 = (
) => {
const schemaRef = `#/components/schemas/${capitalize(
item.nameSingular,
)} for Response`;
)}ForResponse`;
return {
description: 'Successful operation',