From 46617b1b9bd06fae9f825d12e40aa09afaf48305 Mon Sep 17 00:00:00 2001 From: Sambhav Gupta <81870866+sambhavgupta0705@users.noreply.github.com> Date: Tue, 18 Jul 2023 12:36:30 +0530 Subject: [PATCH] chore: clean up the repository (#121) Co-authored-by: Lukasz Gornicki --- .github/workflows/bump.yml | 34 ----- .github/workflows/if-nodejs-pr-testing.yml | 78 ----------- .github/workflows/if-nodejs-release.yml | 113 --------------- .github/workflows/if-nodejs-version-bump.yml | 49 ------- README.md | 125 +---------------- _config.yml | 1 - extensions/http/0.1.0.yaml | 47 ------- extensions/sqs/0.1.0.yml | 117 ---------------- extensions/twitter/0.1.0.yaml | 16 --- extensions/twitter/README.md | 26 ++++ package-lock.json | 137 ------------------- package.json | 38 ----- schema.json | 86 ------------ test/test.js | 77 ----------- 14 files changed, 33 insertions(+), 911 deletions(-) delete mode 100644 .github/workflows/bump.yml delete mode 100644 .github/workflows/if-nodejs-pr-testing.yml delete mode 100644 .github/workflows/if-nodejs-release.yml delete mode 100644 .github/workflows/if-nodejs-version-bump.yml delete mode 100644 _config.yml delete mode 100644 extensions/http/0.1.0.yaml delete mode 100644 extensions/sqs/0.1.0.yml delete mode 100644 extensions/twitter/0.1.0.yaml create mode 100644 extensions/twitter/README.md delete mode 100644 package-lock.json delete mode 100644 package.json delete mode 100644 schema.json delete mode 100644 test/test.js diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml deleted file mode 100644 index 68daa7c..0000000 --- a/.github/workflows/bump.yml +++ /dev/null @@ -1,34 +0,0 @@ -# This action is centrally managed in https://github.com/asyncapi/.github/ -# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo - -# Purpose of this action is to update npm package in libraries that use it. It is like dependabot for asyncapi npm modules only. -# It runs in a repo after merge of release commit and searches for other packages that use released package. Every found package gets updated with lates version - -name: Bump package version in dependent repos - if Node project - -on: - # It cannot run on release event as when release is created then version is not yet bumped in package.json - # This means we cannot extract easily latest version and have a risk that package is not yet on npm - push: - branches: - - master - -jobs: - bump-in-dependent-projects: - name: Bump this package in repositories that depend on it - if: startsWith(github.event.commits[0].message, 'chore(release):') - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v2 - - name: Check if Node.js project and has package.json - id: packagejson - run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" - - if: steps.packagejson.outputs.exists == 'true' - name: Bumping latest version of this package in other repositories - uses: derberg/npm-dependency-manager-for-your-github-org@v4 - with: - github_token: ${{ secrets.GH_TOKEN }} - committer_username: asyncapi-bot - committer_email: info@asyncapi.io - repos_to_ignore: html-template # this is temporary until react component releases 1.0, then it can be removed diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml deleted file mode 100644 index 9ce9f9a..0000000 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ /dev/null @@ -1,78 +0,0 @@ -# This action is centrally managed in https://github.com/asyncapi/.github/ -# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo - -# It does magic only if there is package.json file in the root of the project -name: PR testing - if Node project - -on: - pull_request: - types: [opened, reopened, synchronize, ready_for_review] - -jobs: - test-nodejs-pr: - name: Test NodeJS PR - ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - steps: - - if: > - !github.event.pull_request.draft && !( - (github.actor == 'asyncapi-bot' && ( - startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || - startsWith(github.event.pull_request.title, 'chore(release):') - )) || - (github.actor == 'asyncapi-bot-eve' && ( - startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || - startsWith(github.event.pull_request.title, 'chore(release):') - )) || - (github.actor == 'allcontributors[bot]' && - startsWith(github.event.pull_request.title, 'docs: add') - ) - ) - id: should_run - name: Should Run - run: echo "shouldrun=true" >> $GITHUB_OUTPUT - - if: steps.should_run.outputs.shouldrun == 'true' - name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - if: steps.should_run.outputs.shouldrun == 'true' - name: Checkout repository - uses: actions/checkout@v3 - - if: steps.should_run.outputs.shouldrun == 'true' - name: Check if Node.js project and has package.json - id: packagejson - run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT - shell: bash - - if: steps.packagejson.outputs.exists == 'true' - name: Check package-lock version - uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master - id: lockversion - - if: steps.packagejson.outputs.exists == 'true' - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: "${{ steps.lockversion.outputs.version }}" - cache: 'npm' - cache-dependency-path: '**/package-lock.json' - - if: steps.packagejson.outputs.exists == 'true' - name: Install dependencies - id: first-installation - run: npm install --loglevel verbose - continue-on-error: true - - if: steps.first-installation.outputs.status == 'failure' && steps.packagejson.outputs.exists == 'true' - name: Clear NPM cache and install deps again - run: | - npm cache clean --force - npm install --loglevel verbose - - if: steps.packagejson.outputs.exists == 'true' - name: Test - run: npm test --if-present - - if: steps.packagejson.outputs.exists == 'true' - name: Run linter - run: npm run lint --if-present - - if: steps.packagejson.outputs.exists == 'true' - name: Run release assets generation to make sure PR does not break it - run: npm run generate:assets --if-present diff --git a/.github/workflows/if-nodejs-release.yml b/.github/workflows/if-nodejs-release.yml deleted file mode 100644 index 73bffb0..0000000 --- a/.github/workflows/if-nodejs-release.yml +++ /dev/null @@ -1,113 +0,0 @@ -# This action is centrally managed in https://github.com/asyncapi/.github/ -# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo - -# It does magic only if there is package.json file in the root of the project -name: Release - if Node project - -on: - push: - branches: - - master - # below lines are not enough to have release supported for these branches - # make sure configuration of `semantic-release` package mentions these branches - - next-spec - - next-major - - next-major-spec - - beta - - alpha - -jobs: - - test-nodejs: - # We just check the message of first commit as there is always just one commit because we squash into one before merging - # "commits" contains array of objects where one of the properties is commit "message" - # Release workflow will be skipped if release conventional commits are not used - if: | - startsWith( github.repository, 'asyncapi/' ) && - (startsWith( github.event.commits[0].message , 'fix:' ) || - startsWith( github.event.commits[0].message, 'fix!:' ) || - startsWith( github.event.commits[0].message, 'feat:' ) || - startsWith( github.event.commits[0].message, 'feat!:' )) - name: Test NodeJS release on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - steps: - - name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - name: Checkout repository - uses: actions/checkout@v2 - - name: Check if Node.js project and has package.json - id: packagejson - run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" - shell: bash - - if: steps.packagejson.outputs.exists == 'true' - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 14 - cache: 'npm' - cache-dependency-path: '**/package-lock.json' - - if: steps.packagejson.outputs.exists == 'true' - name: Install dependencies - run: npm install - - if: steps.packagejson.outputs.exists == 'true' - name: Run test - run: npm test - - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel - name: Report workflow run status to Slack - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,action,workflow - text: 'Release workflow failed in testing job' - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} - - release: - needs: [test-nodejs] - name: Publish to any of NPM, Github, and Docker Hub - runs-on: ubuntu-latest - steps: - - name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - name: Checkout repository - uses: actions/checkout@v2 - - name: Check if Node.js project and has package.json - id: packagejson - run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" - - if: steps.packagejson.outputs.exists == 'true' - name: Setup Node.js - uses: actions/setup-node@v1 - with: - node-version: 14 - - if: steps.packagejson.outputs.exists == 'true' - name: Install dependencies - run: npm install - - if: steps.packagejson.outputs.exists == 'true' - name: Publish to any of NPM, Github, and Docker Hub - id: release - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - GIT_AUTHOR_NAME: asyncapi-bot - GIT_AUTHOR_EMAIL: info@asyncapi.io - GIT_COMMITTER_NAME: asyncapi-bot - GIT_COMMITTER_EMAIL: info@asyncapi.io - run: npm run release - - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel - name: Report workflow run status to Slack - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,action,workflow - text: 'Release workflow failed in release job' - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} \ No newline at end of file diff --git a/.github/workflows/if-nodejs-version-bump.yml b/.github/workflows/if-nodejs-version-bump.yml deleted file mode 100644 index 721caa9..0000000 --- a/.github/workflows/if-nodejs-version-bump.yml +++ /dev/null @@ -1,49 +0,0 @@ -# This action is centrally managed in https://github.com/asyncapi/.github/ -# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo - -# It does magic only if there is package.json file in the root of the project -name: Version bump - if Node.js project - -on: - release: - types: - - published - -jobs: - version_bump: - name: Generate assets and bump NodeJS - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - # target branch of release. More info https://docs.github.com/en/rest/reference/repos#releases - # in case release is created from release branch then we need to checkout from given branch - # if @semantic-release/github is used to publish, the minimum version is 7.2.0 for proper working - ref: ${{ github.event.release.target_commitish }} - - name: Check if Node.js project and has package.json - id: packagejson - run: test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" - - if: steps.packagejson.outputs.exists == 'true' - name: Install dependencies - run: npm install - - if: steps.packagejson.outputs.exists == 'true' - name: Assets generation - run: npm run generate:assets - - if: steps.packagejson.outputs.exists == 'true' - name: Bump version in package.json - # There is no need to substract "v" from the tag as version script handles it - # When adding "bump:version" script in package.json, make sure no tags are added by default (--no-git-tag-version) as they are already added by release workflow - # When adding "bump:version" script in package.json, make sure --allow-same-version is set in case someone forgot and updated package.json manually and we want to avoide this action to fail and raise confusion - run: VERSION=${{github.event.release.tag_name}} npm run bump:version - - if: steps.packagejson.outputs.exists == 'true' - name: Create Pull Request with updated asset files including package.json - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ secrets.GH_TOKEN }} - commit-message: 'chore(release): ${{github.event.release.tag_name}}' - committer: asyncapi-bot - author: asyncapi-bot - title: 'chore(release): ${{github.event.release.tag_name}}' - body: 'Version bump in package.json for release [${{github.event.release.tag_name}}](${{github.event.release.html_url}})' - branch: version-bump/${{github.event.release.tag_name}} \ No newline at end of file diff --git a/README.md b/README.md index 67f9884..f409e6a 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ # Extensions catalog -This is a placeholder for definitions of AsyncAPI specification extensions and bindings objects. +This is a repository for definitions of AsyncAPI specification extensions. -#### Index: +#### Table of Contents - [What's an extension?](#whats-an-extension) -- [Examples of extension definition](#examples-of-extension-definition) -- [Types of extensions](#types-of-extensions) +- [Usage in an AsyncAPI document](#usage-in-an-AsyncAPI-document) - [Adding your extension to the catalog](#adding-your-extension-to-the-catalog) - [Questions?](#questions) @@ -18,128 +17,18 @@ This is a placeholder for definitions of AsyncAPI specification extensions and b Extensions are the mechanism AsyncAPI has to allow you use custom or protocol-specific features. Extensions follow a separate release cycle and everyone can create their own. This repository is meant to contain a list of official and community supported extensions. -## Examples of extension definition - > Both, JSON or YAML, are supported formats. Please, take into account that only the subset of YAML that can be translated to JSON is allowed. -### Twitter - -This is the definition of a generic extension that allows you to add information about your team/company Twitter account. - -```yaml -id: twitter -type: generic # Means it's an "x-" type of extension. In this case, x-twitter. -title: Twitter information -description: This extension allows you to place the Twitter account of the team/company in charge of the API. -version: '0.1.0' -author: Mike Ralphson -contributors: - - Fran Mendez (fmvilas.com) -definitions: - - hooks: - - 'info' # JMESPath query to indicate where this extension is allowed in the AsyncAPI document. In this case, it's only allowed in the "info" object. - schema: - type: string - pattern: '^@?(\\w){1,15}$' - examples: - - example: '@PermittedSoc' -``` - -#### Usage in an AsyncAPI document - -```yaml -asyncapi: '2.0.0' -info: - title: My wonderful API - version: '12.4.2' - x-twitter: '@wonderapi' -... -``` - -### HTTP Binding - -This is the example definition of an HTTP bindings extension. - -```yaml -id: http -type: bindings # Means it's a "bindings" type of extension. -title: HTTP Binding Extension -description: This object allows you to define HTTP-specific details in AsyncAPI. -version: '0.1.0' -author: Fran Mendez (fmvilas.com) -definitions: - - hooks: # JMESPath queries to indicate where this extension is allowed in the AsyncAPI document. In this case, it's allowed in all the operation (publish/subscribe) objects. - - 'channels.*.subscribe' - - 'channels.*.publish' - schema: # This is the schema that validates the extension content. It's in JSON Schema Draft 07. - type: object - required: - - version - properties: - version: - type: string - const: '0.1.0' # It's a good idea to specify what version of the extension are you using. It will facilitate things to tooling and will allow you to have different versions of the same extension in a single document. - response: - type: object - additionalProperties: false - properties: - headers: - type: object - additionalProperties: true - propertyNames: - type: string - pattern: '^[a-zA-Z0-9\\.\\-_]+$' - request: - type: object - additionalProperties: false - properties: - headers: - type: object - additionalProperties: true - propertyNames: - type: string - pattern: '^[a-zA-Z0-9\\.\\-_]+$' - examples: - - description: Usage for HTTP streaming APIs. - example: - http: - version: '0.1.0' - response: - headers: - Transfer-Encoding: chunked - Trailer: '\\r\\n' -``` #### Usage in an AsyncAPI document - -```yaml -asyncapi: '2.0.0' -... -channels: - /tweets: - subscribe: - bindings: - http: - version: '0.1.0' - response: - headers: - Transfer-Encoding: chunked - Trailer: '\\r\\n' -... -``` - -## Types of extensions - -Extensions can be of type `generic` or `bindings`. - -Generic extensions are those that are preceeded by `x-`, e.g., `x-twitter`, and they can be placed anywhere in the AsyncAPI document. - -Bindings extensions are those that live inside a `bindings` object and are related to protocol-specific functionality or characteristics. E.g., `http`, `kafka`, `amqp`, etc. As opposed to generic extensions, these can only be applied in a very limited set of places, namely, where the `bindings` is allowed, i.e., a channel object, an operation object or a message object. +AsyncAPI extensions are those that are preceded by `x-`, e.g., `x-twitter`. They can be placed in the AsyncAPI document in locations specified by documentation of given extension. ## Adding your extension to the catalog If you'd like to add your extension to the catalog, please submit a pull request to this repository. Make sure the extension doesn't exist already, in which case it would be better to improve the existing one so everybody benefits from it. + + ## Questions? -If you have questions, please submit an issue to this repository or [join our Slack workspace](https://join.slack.com/t/asyncapi/shared_invite/enQtNDY3MzI0NjU5OTQyLWU4ZGU2MTg1MDIyZDFjMTI2YjkxYTdlMzc1NjgzYTAxZDM1YTg1NDhhMTE2NDliMjlhZjYxNzk0ZTE5ZGU1ZTg). +If you have questions, please submit an issue to this repository or [join our Slack workspace](https://asyncapi.com/slack-invite). diff --git a/_config.yml b/_config.yml deleted file mode 100644 index 2f7efbe..0000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-minimal \ No newline at end of file diff --git a/extensions/http/0.1.0.yaml b/extensions/http/0.1.0.yaml deleted file mode 100644 index 4a0cd08..0000000 --- a/extensions/http/0.1.0.yaml +++ /dev/null @@ -1,47 +0,0 @@ -id: http -type: bindings -title: HTTP Binding Extension -description: This object allows you to define HTTP-specific details in AsyncAPI. -version: '0.1.0' -author: Fran Mendez (fmvilas.com) -definitions: - - hooks: - - 'channels.*.subscribe' - - 'channels.*.publish' - schema: - type: object - required: - - version - properties: - version: - type: string - const: '0.1.0' - response: - type: object - additionalProperties: false - properties: - headers: - type: object - additionalProperties: true - propertyNames: - type: string - pattern: '^[a-zA-Z0-9\\.\\-_]+$' - request: - type: object - additionalProperties: false - properties: - headers: - type: object - additionalProperties: true - propertyNames: - type: string - pattern: '^[a-zA-Z0-9\\.\\-_]+$' - examples: - - description: Usage for HTTP streaming APIs. - example: - http: - version: '0.1.0' - response: - headers: - Transfer-Encoding: chunked - Trailer: '\\r\\n' \ No newline at end of file diff --git a/extensions/sqs/0.1.0.yml b/extensions/sqs/0.1.0.yml deleted file mode 100644 index b488215..0000000 --- a/extensions/sqs/0.1.0.yml +++ /dev/null @@ -1,117 +0,0 @@ - -id: sqs -type: generic -title: SQS Extension supporting FIFO & Standard Queques -description: Defines the configuration parameters required for AWS SQS for both standard and FIFO ordered queues -version: '0.1.0' -author: Paul Taylor -contact: - email: p.taylor@mulesoft.com - url: https://github.com/Paul-T-AU - name: Paul Taylor -tags: - - queues - - ordering - - fifo -definitions: - - - hooks: - - 'channels.*.publish' - - 'channels.*.subscribe' - schema: - type: object - required: - - version - - queueType - - name - if: - queueType: fifo - - messageGroupId - - messageDeduplicationId - properties: - version: - type: string - const: '0.1.0' - queueType: - type: string - emum: - - fifo - - standard - name: - type: string - pattern: '^[a-zA-Z0-9\\.\\-_]+$' - if: - queueType: fifo - messageGroupId: - type: string - pattern: '^[a-zA-Z0-9\\.\\-_]+$' - messageDeduplicationId: - type: string - pattern: '^[a-zA-Z0-9\\.\\-_]+$' - receiveRequestAttemptId: - type: string - pattern: '^[a-zA-Z0-9\\.\\-_]+$' - action: - type: string - pattern: '^[a-zA-Z0-9\\.\\-_]+$' - maxNumberOfMessages: - type: integer - visibilityTimeout: - type: integer - waitTimeSeconds: - type: integer - attributeNames: - type: array - items: - type: string - - All - - ApproximateFirstReceiveTimestamp - - ApproximateReceiveCount - - AWSTraceHeader - - SenderId - - SentTimestamp - - MessageDeduplicationId - - MessageGroupId - - SequenceNumber - messageAttributeName: - type: array - items: - type: string - examples: - - description: Example configuration for both fifo & standard queues - exampleFIFOPublish: - publish: - bindings: - sqs: - version: '0.1.0' - queueType: fifo - name: 'https://sqs.ap-soautheast-2.amazonaws.com/75555555/msqs-test.fifo' - messageGroupId: 10020 - messageDeduplicationId: 102 - action: SendMessage - exampleFIFOSubscribe: - subscribe: - bindings: - sqs: - version: '0.1.0' - queueType: fifo - name: 'https://sqs.ap-soautheast-2.amazonaws.com/75555555/msqs-test.fifo' - attributeNames: 'MessageGroupId' - maxNumberOfMessages: 10 - visibilityTimeout: 20 - waitTimeSeconds: 2 - receiveRequestAttemptId: 'attempt123' - messageAttributeName: - - 'myCustomAttribute1' - - 'myCustomAttribute2' - action: 'ReceiveMessage' - exampleStandardSubscribe: - subscribe: - bindings: - sqs: - subscribe: - version: '0.1.0' - queueType: standard - name: 'https://sqs.ap-soautheast-2.amazonaws.com/75555555/msqs-test' - action: 'ReceiveMessage' - diff --git a/extensions/twitter/0.1.0.yaml b/extensions/twitter/0.1.0.yaml deleted file mode 100644 index ac4aaf3..0000000 --- a/extensions/twitter/0.1.0.yaml +++ /dev/null @@ -1,16 +0,0 @@ -id: twitter -type: generic -title: Twitter information -description: This extension allows you to place the Twitter account of the team/company in charge of the API. -version: '0.1.0' -author: Mike Ralphson -contributors: - - Fran Mendez (fmvilas.com) -definitions: - - hooks: - - 'info' - schema: - type: string - pattern: '^@?(\\w){1,15}$' - examples: - - example: '@PermittedSoc' \ No newline at end of file diff --git a/extensions/twitter/README.md b/extensions/twitter/README.md new file mode 100644 index 0000000..e08d9c0 --- /dev/null +++ b/extensions/twitter/README.md @@ -0,0 +1,26 @@ +# Twitter extension +This document defines how to use `twitter` extension in AsyncAPI documents. + +## Overview +This extension allows you to provide the Twitter username of the account representing the team/company of the API. + +## Extension Definition + +### Type: String + +Name of the Twitter username. + +## Extension Location + +This extension can be used in the following locations: +- [Info Object](https://www.asyncapi.com/docs/reference/specification/v2.6.0#infoObject) + +## Example + +```yaml +asyncapi: '2.6.0' +info + title: Strretlights Kafka API + version: '1.0.0' + x-twitter: StreetLightData +``` diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 8376e29..0000000 --- a/package-lock.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "name": "extensions-catalog", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "ajv": { - "version": "6.12.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz", - "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "async": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", - "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", - "dev": true - }, - "call-me-maybe": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", - "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=", - "dev": true - }, - "colors": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz", - "integrity": "sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg==", - "dev": true - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "format-util": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/format-util/-/format-util-1.0.3.tgz", - "integrity": "sha1-Ay3KShFiYqEsQ/TD7IVmQWxbLZU=", - "dev": true - }, - "fs-walk": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/fs-walk/-/fs-walk-0.0.2.tgz", - "integrity": "sha1-IhA4W9vDKrUZM87lAu8YUWeXYE0=", - "dev": true, - "requires": { - "async": "*" - } - }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "json-schema-ref-parser": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/json-schema-ref-parser/-/json-schema-ref-parser-6.1.0.tgz", - "integrity": "sha512-pXe9H1m6IgIpXmE5JSb8epilNTGsmTb2iPohAXpOdhqGFbQjNeHHsZxU+C8w6T81GZxSPFLeUoqDJmzxx5IGuw==", - "dev": true, - "requires": { - "call-me-maybe": "^1.0.1", - "js-yaml": "^3.12.1", - "ono": "^4.0.11" - } - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "ono": { - "version": "4.0.11", - "resolved": "https://registry.npmjs.org/ono/-/ono-4.0.11.tgz", - "integrity": "sha512-jQ31cORBFE6td25deYeD80wxKBMj+zBmHTrVxnc6CKhx8gho6ipmWM5zj/oeoqioZ99yqBls9Z/9Nss7J26G2g==", - "dev": true, - "requires": { - "format-util": "^1.0.3" - } - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 62a3db4..0000000 --- a/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "extensions-catalog", - "version": "1.0.0", - "description": "This repo holds the definition of all the specification extensions and protocolInfo objects the AsyncAPI Initiative supports.", - "directories": { - "test": "test" - }, - "scripts": { - "test": "node test/test.js", - "generate:assets": "echo 'No assets to generate yet'", - "bump:version": "echo 'No automated version bump as we do not release this package yet'", - "lint": "echo 'No linter integrated yet'", - "release": "echo 'This package is not yet released'" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/asyncapi/extensions-catalog.git" - }, - "keywords": [ - "asyncapi", - "extensions", - "protocolinfo", - "protocol-info" - ], - "author": "Fran Mendez (fmvilas.com)", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/asyncapi/extensions-catalog/issues" - }, - "homepage": "https://github.com/asyncapi/extensions-catalog#readme", - "devDependencies": { - "ajv": "^6.12.3", - "colors": "^1.3.3", - "fs-walk": "0.0.2", - "js-yaml": "^3.13.1", - "json-schema-ref-parser": "^6.1.0" - } -} diff --git a/schema.json b/schema.json deleted file mode 100644 index 80e5719..0000000 --- a/schema.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "title": "AsyncAPI specification extensions schema.", - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "required": [ - "id", - "type", - "title", - "version" - ], - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "description": "A unique id for the extension" - }, - "type": { - "type": "string", - "description": "Type of extension. Either bindings or generic.", - "enum": [ - "bindings", - "generic" - ] - }, - "title": { - "type": "string", - "description": "A nice human-readable name for your extension." - }, - "description": { - "type": "string", - "description": "A nice human-readable description for your extension." - }, - "version": { - "type": "string", - "description": "The version of your extension." - }, - "author": { - "type": "string", - "description": "The extension author information. Supports the `Name (website)` format." - }, - "contributors": { - "type": "array", - "description": "A list of extension contributors.", - "items": { - "type": "string", - "description": "An extension contributor information. Supports the `Name (website)` format." - } - }, - "definitions": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "hooks": { - "type": "array", - "description": "An array of A JMESPath queries indicating where it's possible to apply the extension in the AsyncAPI document.", - "items": { - "type": "string", - "description": "A JMESPath query indicating where it's possible to apply the extension in the AsyncAPI document." - } - }, - "schema": { - "description": "The JSON Schema Draft 07 schema that validates the extension content.", - "$ref": "http://json-schema.org/draft-07/schema#" - }, - "examples": { - "type": "array", - "description": "An array of usage examples.", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "description": { - "type": "string", - "description": "A human-readable description of the example." - }, - "example": {} - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 3e6736c..0000000 --- a/test/test.js +++ /dev/null @@ -1,77 +0,0 @@ -// Usage: npm test [-- --versions 1.2.0,next] - -const util = require('util'); -const fs = require('fs'); -const path = require('path'); -const Ajv = require('ajv'); -const YAML = require('js-yaml'); -const RefParser = require('json-schema-ref-parser'); -const walk = require('fs-walk'); -require('colors'); - -const validate = async (content, schema) => { - let json = YAML.safeLoad(content); - - json = await RefParser.dereference(json, { - dereference: { - circular: 'ignore' - } - }); - - const ajv = new Ajv({ schemaId: 'auto' }); - //ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json')); - - const valid = ajv.validate(schema, json); - - if (!valid) { - return { - valid: false, - errors: ajv.errors, - }; - } - - return { - valid: true, - }; -}; - -const runTest = () => new Promise((resolve, reject) => { - const schema = require(path.resolve(__dirname, '../schema.json')); - - walk.walk(path.resolve(__dirname, '../extensions'), async (basedir, filename, stat, next) => { - if (!filename.match(/\.(y[a]?ml)|(json)$/)) return next(); - - process.stdout.write(`Running test for ${path.relative(path.resolve(__dirname, '../extensions'), path.resolve(basedir, filename))}... `.cyan); - const content = fs.readFileSync(path.resolve(basedir, filename)).toString(); - try { - const result = await validate(content, schema); - - if (result.valid) { - process.stdout.write('OK\n'.green); - return next(); - } - - console.error('FAILED\n'.red); - console.error('Error details:\n'.red.underline); - console.error(util.inspect(result.errors, { depth: null, colors: true })); - result.errors.logged = true; - next(result.errors); - } catch (e) { - next(e); - } - }, (err) => { - if (err) return reject(err); - resolve(); - }); -}); - -// RUNNING TESTS - -console.log('Running tests...'); - -runTest() - .then(() => { - console.log('\nAll good!'.green); - }).catch((e) => { - if (e && !e.logged) console.error(e); - });