-
-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: expose all AsyncAPI JSON Schema documents #502
Closed
jonaslagoni
wants to merge
12
commits into
asyncapi:master
from
jonaslagoni:feature/expose_spec_documents
Closed
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bcffd00
Merge branch 'master-main' into feature/expose_spec_documents
jonaslagoni d95f3e4
Add reroute and api router to fetch schema files.
jonaslagoni 1b964e4
Update package-lock.json
jonaslagoni 2913f0d
Switched to build
jonaslagoni 8317f48
Re-enabled next build
jonaslagoni 5e6f1eb
Merge branch 'master' into feature/expose_spec_documents
jonaslagoni 2f4de3a
Merge branch 'master' into feature/expose_spec_documents
jonaslagoni c3844a0
fix script fails
jonaslagoni 03a20ea
Merge branch 'master' into feature/expose_spec_documents
jonaslagoni 28d7ff8
Merge branch 'master' into feature/expose_spec_documents
quetzalliwrites 217a6c8
Merge branch 'master' into feature/expose_spec_documents
quetzalliwrites 4ac90b4
Merge branch 'master' into feature/expose_spec_documents
jonaslagoni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,40 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
/** | ||
* Look ma, it's cp -R. | ||
* | ||
* Pun intended https://stackoverflow.com/a/22185855/6803886 | ||
* | ||
* @param {string} src The path to the thing to copy. | ||
* @param {string} dest The path to the new copy. | ||
*/ | ||
var copyRecursiveSync = function(src, dest) { | ||
var exists = fs.existsSync(src); | ||
var stats = exists && fs.statSync(src); | ||
var isDirectory = exists && stats.isDirectory(); | ||
if (isDirectory) { | ||
fs.mkdirSync(dest); | ||
fs.readdirSync(src).forEach(function(childItemName) { | ||
copyRecursiveSync(path.join(src, childItemName), | ||
path.join(dest, childItemName)); | ||
}); | ||
} else { | ||
fs.copyFileSync(src, dest); | ||
} | ||
}; | ||
|
||
/** | ||
* Copy all the internal schema files to expose them as static files. | ||
*/ | ||
module.exports = function copySchemaFiles() { | ||
const sourcePath = path.resolve(__dirname, '../node_modules/@asyncapi/specs/definitions'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add a |
||
const destinationPath = path.resolve(__dirname, '../public/definitions') | ||
|
||
const destinationExists = fs.existsSync(sourcePath); | ||
|
||
//Ensure we have a clean slate | ||
if(destinationExists) fs.rmSync(destinationPath, {recursive: true}) | ||
|
||
copyRecursiveSync(sourcePath, destinationPath); | ||
}; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 3.0.0? Should we just use the latest stable version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the introduction of split schemas and bundling them is a breaking change, i.e. version 3.0.0 of the library :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, yeah, sorry. 😅