Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/generate-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ ! -s release-description.md ]; then
echo "Release summary is empty, skipping release creation"
exit 0
fi

# Create GitHub Release
gh release create ${{ steps.version.outputs.new_version }} \
--title "${{ steps.version.outputs.new_version }}" \
--notes-file final-release-description.md
17 changes: 10 additions & 7 deletions scripts/api-diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,15 @@ function comparePaths() {
if (!previousMethods[method]) {
if (!changes.added[path]) changes.added[path] = new Set();
changes.added[path].add(method.toUpperCase());
} else if (JSON.stringify(previousMethods[method]) !== JSON.stringify(details)) {
if (!changes.modified[path]) changes.modified[path] = [];
changes.modified[path].push({
method: method.toUpperCase(),
changes: getChanges(previousMethods[method], details)
});
} else {
const changedFields = getChanges(previousMethods[method], details);
if (changedFields.length > 0) { // Only add if there are meaningful changes
if (!changes.modified[path]) changes.modified[path] = [];
changes.modified[path].push({
method: method.toUpperCase(),
changes: changedFields
});
}
}
});
});
Expand All @@ -116,7 +119,7 @@ function comparePaths() {

function getChanges(previous, current) {
const changes = [];
const fields = ['summary', 'description', 'operationId', 'parameters', 'requestBody', 'responses'];
const fields = ['operationId', 'parameters', 'requestBody', 'responses'];

fields.forEach(field => {
if (JSON.stringify(previous[field]) !== JSON.stringify(current[field])) {
Expand Down
1 change: 0 additions & 1 deletion tests/fixtures/modified-route-and-method/expected.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
## Modified
- [POST] `/user`
- responses
- summary
75 changes: 75 additions & 0 deletions tests/fixtures/modified-summary/current.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"openapi": "3.0.3",
"info": {
"title": "Test API",
"description": "A sample API to for testing",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.example.com/v1"
}
],
"paths": {
"/user": {
"post": {
"summary": "Creates a new user profile",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewUser"
}
}
}
},
"responses": {
"201": {
"description": "User created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"email": {
"type": "string"
}
}
},
"NewUser": {
"type": "object",
"required": [
"name",
"email"
],
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string"
}
}
}
}
}
}
Empty file.
75 changes: 75 additions & 0 deletions tests/fixtures/modified-summary/previous.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"openapi": "3.0.3",
"info": {
"title": "Test API",
"description": "A sample API to for testing",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.example.com/v1"
}
],
"paths": {
"/user": {
"post": {
"summary": "Create a new user profile",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewUser"
}
}
}
},
"responses": {
"201": {
"description": "User created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"email": {
"type": "string"
}
}
},
"NewUser": {
"type": "object",
"required": [
"name",
"email"
],
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string"
}
}
}
}
}
}