forked from conventional-changelog/standard-version
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add OpenAPI version support (#136)
* test: add openapi crlf mocks * test: add openapi lf mocks * feat: add support for openapi version bumping (almost identical to yaml-updater) * test: OpenAPI updater tests * fix: Add debug messages for exclusions during bump lifecycle (#131) * chore: Add debug messages for exclusions in lifecycle bump Code has been modified to include debug messages in the bump lifecycle. When a filename is ignored by Git or is not a file, the program will now log a debug-level message. * chore(#131): Update formatting * chore(#131): Improve debug messages for exclusions during bump lifecycle * chore(master): release 12.3.0 (#139) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * docs: add documentation about how to bump OpenAPI version --------- Co-authored-by: Markus Schulte <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Timothy Jones <[email protected]>
- Loading branch information
1 parent
7a5b806
commit 007b1b0
Showing
8 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const yaml = require('yaml'); | ||
const detectNewline = require('detect-newline'); | ||
|
||
module.exports.readVersion = function (contents) { | ||
return yaml.parse(contents).info.version; | ||
}; | ||
|
||
module.exports.writeVersion = function (contents, version) { | ||
const newline = detectNewline(contents); | ||
const document = yaml.parseDocument(contents); | ||
|
||
document.get('info').set('version', version); | ||
|
||
return document.toString().replace(/\r?\n/g, newline); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
openapi: "3.0.2" | ||
info: | ||
title: Mock API | ||
description: >- | ||
Description of Mock API | ||
version: "1.2.3" | ||
termsOfService: http://swagger.io/terms/ | ||
externalDocs: | ||
description: Find out more | ||
url: https://example.com/foo/bar | ||
servers: | ||
- url: http://example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
openapi: "3.0.2" | ||
info: | ||
title: Mock API | ||
description: >- | ||
Description of Mock API | ||
version: "1.2.3" | ||
termsOfService: http://swagger.io/terms/ | ||
externalDocs: | ||
description: Find out more | ||
url: https://example.com/foo/bar | ||
servers: | ||
- url: http://example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
openapi: "3.0.2" | ||
info: | ||
title: Mock API | ||
description: >- | ||
Description of Mock API | ||
version: "1.3.0" | ||
termsOfService: http://swagger.io/terms/ | ||
externalDocs: | ||
description: Find out more | ||
url: https://example.com/foo/bar | ||
servers: | ||
- url: http://example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
openapi: "3.0.2" | ||
info: | ||
title: Mock API | ||
description: >- | ||
Description of Mock API | ||
version: "1.3.0" | ||
termsOfService: http://swagger.io/terms/ | ||
externalDocs: | ||
description: Find out more | ||
url: https://example.com/foo/bar | ||
servers: | ||
- url: http://example.com |