Skip to content
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

ci: script to validate embedded examples in the asyncapi.md file #1059

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
915f808
chore: copy files from test branch
AnimeshKumar923 Jun 7, 2024
74e3080
Delete file
AnimeshKumar923 Jun 7, 2024
0515628
fix: add comment in asyncapi.md for validation
AnimeshKumar923 Jun 8, 2024
f64f32c
chore: test commit to see diff in files
AnimeshKumar923 Jun 8, 2024
532c4c2
fix: update script to handle component object ex
AnimeshKumar923 Jun 10, 2024
4529772
fix: update comments in spec, update base doc
AnimeshKumar923 Jun 11, 2024
293a172
Merge branch 'master' into embedded-examples-validation
smoya Jun 12, 2024
dd069b0
Merge branch 'master' into embedded-examples-validation
smoya Jun 12, 2024
544d999
Merge branch 'master' into embedded-examples-validation
AnimeshKumar923 Jun 12, 2024
a51107d
chore: remove added JSON examples
AnimeshKumar923 Jun 12, 2024
34dd72a
chore: remove non-essential packages
AnimeshKumar923 Jun 13, 2024
150f3f5
fix: update file, create new base doc
AnimeshKumar923 Jun 13, 2024
9986715
fix: update script, update base doc
AnimeshKumar923 Jun 13, 2024
5806a60
fix: update script
AnimeshKumar923 Jun 14, 2024
96871f5
Merge branch 'master' into embedded-examples-validation
AnimeshKumar923 Jun 14, 2024
375070a
Merge branch 'asyncapi:master' into embedded-examples-ci
AnimeshKumar923 Jun 14, 2024
ef231f0
fix: update script, update asyncapi.md
AnimeshKumar923 Jun 14, 2024
9ad0cc8
fix: add missing dependency in base doc
AnimeshKumar923 Jun 15, 2024
1d806c6
chore: remove comments from YAML examples
AnimeshKumar923 Jun 15, 2024
f9b725e
chore: update script, more log statements for debug
AnimeshKumar923 Jun 16, 2024
754e50e
fix: add function to validate the files
AnimeshKumar923 Jun 16, 2024
d78f639
fix: update script, asynchronous validation
AnimeshKumar923 Jun 16, 2024
6878498
chore: update asyncapi.md, improve comments
AnimeshKumar923 Jun 16, 2024
8534ae3
Merge branch 'embedded-examples-ci'
AnimeshKumar923 Jun 16, 2024
9c82ffa
chore: clear the clutter, rename files, move files
AnimeshKumar923 Jun 16, 2024
46f32a5
fix: add ci workflow file
AnimeshKumar923 Jun 16, 2024
dc81343
ci: update working directory
AnimeshKumar923 Jun 16, 2024
71eebd5
ci: update working directory
AnimeshKumar923 Jun 16, 2024
e1c8798
ci: update working directory
AnimeshKumar923 Jun 16, 2024
6f18cbc
fix: update base doc, update script, update spec
AnimeshKumar923 Jun 16, 2024
9e160c1
Merge branch 'master' into embedded-examples-validation
asyncapi-bot Jun 16, 2024
9d83edf
chore: remove extra lines, fix markdown lint
AnimeshKumar923 Jun 17, 2024
ac4443f
Merge branch 'master' into embedded-examples-validation
asyncapi-bot Jun 18, 2024
ced626f
Merge branch 'master' into embedded-examples-validation
asyncapi-bot Jun 18, 2024
ed55789
fix: put comment in proper place
AnimeshKumar923 Jun 18, 2024
4bb29e0
Merge branch 'master' into embedded-examples-validation
asyncapi-bot Jun 18, 2024
b8174d8
Merge branch 'master' into embedded-examples-validation
asyncapi-bot Jun 18, 2024
10ad1ed
fix: put comments in proper place
AnimeshKumar923 Jun 18, 2024
d7eb944
fix: update script, remove cli validation
AnimeshKumar923 Jun 18, 2024
53290ea
fix: add comments for YAML examples
AnimeshKumar923 Jun 18, 2024
cf62169
fix: modify script to support YAML versions
AnimeshKumar923 Jun 18, 2024
4cb0ea7
chore: add updated file version of json examples + yaml examples
AnimeshKumar923 Jun 18, 2024
208afe0
chore: remove extra lines, fix markdown lint
AnimeshKumar923 Jun 18, 2024
02cbeb2
Merge branch 'master' into embedded-examples-validation
asyncapi-bot Jun 19, 2024
e2cc95a
fix: update script, make validation in-memory
AnimeshKumar923 Jun 19, 2024
742a2a2
chore: add error text coloring for better readability
AnimeshKumar923 Jun 19, 2024
1b97ec1
Merge branch 'master' into embedded-examples-validation
asyncapi-bot Jun 19, 2024
803a30d
fix: update script, update spec, json merge patch
AnimeshKumar923 Jun 19, 2024
2bfc0c8
Merge branch 'master' into embedded-examples-validation
asyncapi-bot Jun 20, 2024
e017f3b
fix: change json pointer, spell check
AnimeshKumar923 Jun 20, 2024
cc79163
chore: replace `json_path` with `json_pointer`
AnimeshKumar923 Jun 20, 2024
13d56c7
fix: update script
AnimeshKumar923 Jun 20, 2024
f7fdf63
fix: add comments to support array objects
AnimeshKumar923 Jun 21, 2024
fa8b894
fix: add support for the array object in script
AnimeshKumar923 Jun 21, 2024
3059384
fix: add missing parameter and values in example
AnimeshKumar923 Jun 21, 2024
4ef63f7
fix: replace references to correct position
AnimeshKumar923 Jun 21, 2024
3edc981
fix: remove array handling code section
AnimeshKumar923 Jun 21, 2024
f9d057f
fix: change pointer type to URI Representation
AnimeshKumar923 Jun 21, 2024
3928ef3
fix: add function to handle URI Representation
AnimeshKumar923 Jun 21, 2024
54fab4b
fix: potential example fixes, convert to URI
AnimeshKumar923 Jun 26, 2024
f31ff2a
fix: delete temporary files
AnimeshKumar923 Jul 2, 2024
882a512
fix: OAuth Flow Object example fix
AnimeshKumar923 Jul 2, 2024
b0d36e7
chore: remove comments
AnimeshKumar923 Jul 2, 2024
e1b0e65
Merge branch 'embedded-examples-validation' into spec-examples-fix
AnimeshKumar923 Jul 2, 2024
7ebc2b3
chore: remove fixes which will be added later on
AnimeshKumar923 Jul 4, 2024
91e8478
chore: update and add new files
AnimeshKumar923 Jul 4, 2024
9347567
Merge pull request #2 from AnimeshKumar923/spec-examples-fix
AnimeshKumar923 Jul 4, 2024
af9b533
chore: add error report file
AnimeshKumar923 Jul 4, 2024
ca76882
fix: remove extra comma from the example
AnimeshKumar923 Jul 4, 2024
4ad2444
fix: add more example fixes
AnimeshKumar923 Jul 4, 2024
0534dae
chore: add files which are failing the validation
AnimeshKumar923 Jul 4, 2024
e3d6a78
chore: remove packages which isn't required
AnimeshKumar923 Jul 4, 2024
f814d82
fix: add user-create.avsc file, update reference
AnimeshKumar923 Jul 5, 2024
5e1b0be
chore: make file reference more explicit
AnimeshKumar923 Jul 5, 2024
ba11484
Merge branch 'master' into embedded-examples-validation
asyncapi-bot Jul 5, 2024
c60f9ba
chore: make output message more meaningful
AnimeshKumar923 Jul 5, 2024
c8271ca
chore: test run for the workflow
AnimeshKumar923 Jul 5, 2024
b196b73
chore: test run for workflow
AnimeshKumar923 Jul 5, 2024
8c0e78c
fix: modify output message
AnimeshKumar923 Jul 5, 2024
aa1564f
chore: change workflow trigger target
AnimeshKumar923 Jul 5, 2024
3dcfe50
chore: remove non-essential files
AnimeshKumar923 Jul 5, 2024
c788faf
fix: make consistency with the quotes
AnimeshKumar923 Jul 5, 2024
b24f71d
chore: add missing heading
AnimeshKumar923 Jul 5, 2024
b60d353
fix: fix more consistency issues for yaml examples
AnimeshKumar923 Jul 5, 2024
5c5d91a
fix: update script
AnimeshKumar923 Jul 5, 2024
2c3c55b
fix: modify yaml example
AnimeshKumar923 Jul 5, 2024
34e00e0
fix: applied suggestion
AnimeshKumar923 Jul 5, 2024
6faca8d
fix: revert back to JSON String representation
AnimeshKumar923 Jul 5, 2024
81b40a5
fix: apply suggestions and fixes
AnimeshKumar923 Jul 5, 2024
fd16aef
Update scripts/validation/embedded-examples-validation.js
AnimeshKumar923 Jul 5, 2024
caf79b5
fix: modify script
AnimeshKumar923 Jul 5, 2024
47c77f3
Update scripts/validation/package.json
smoya Jul 5, 2024
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
576 changes: 576 additions & 0 deletions scripts/validation/base-document.json

Large diffs are not rendered by default.

336 changes: 336 additions & 0 deletions scripts/validation/base-document.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,336 @@
asyncapi: 3.0.0
info:
title: My Event-Driven API
version: 1.0.0
description: This API provides real-time event streaming capabilities.
termsOfService: https://example.com/terms-of-service
contact:
name: Rohit
email: [email protected]
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
tags:
- name: Events
description: APIs related to event streaming
- name: Authentication
description: APIs for authentication and authorization
externalDocs:
description: Additional documentation
url: https://example.com/docs
servers:
production:
host: rabbitmq.in.mycompany.com:5672
pathname: /v1
protocol: amqp
protocolVersion: "1.0"
description: Production RabbitMQ broker (uses the `production` vhost).
title: Production Server
summary: Production environment server
security:
- type: http
scheme: bearer
tags:
- name: production
description: Production environment
externalDocs:
description: Additional documentation for the production server
url: https://example.com/docs/production
bindings:
amqp:
exchange: my-exchange
queue: my-queue
staging:
host: rabbitmq.in.mycompany.com:5672
pathname: /v1
protocol: amqp
protocolVersion: "1.0"
description: Staging RabbitMQ broker (uses the `staging` vhost).
title: Staging Server
summary: Staging environment server
security:
- type: apiKey
in: user
description: Provide your API key as the user and leave the password empty.
tags:
- name: staging
description: Staging environment
externalDocs:
description: Additional documentation for the staging server
url: https://example.com/docs/staging
bindings:
amqp:
exchange: my-exchange
queue: my-queue
channels:
user:
address: 'users.{userId}'
title: Users channel
description: This channel is used to exchange messages about user events.
messages:
userSignedUp:
$ref: '#/components/messages/userSignedUp'
userCompletedOrder:
$ref: '#/components/messages/userCompletedOrder'
parameters:
userId:
$ref: '#/components/parameters/userId'
servers:
- $ref: '#/servers/production'
bindings:
amqp:
is: queue
queue:
exclusive: true
tags:
- name: user
description: User-related messages
externalDocs:
description: 'Find more info here'
url: 'https://example.com'
userSignupReply:
address: 'users.signup.reply'
description: Channel for user signup replies
messages:
userSignedUpReply:
summary: User signup reply message
payload:
type: object
properties:
status:
type: string
description: Status of the signup process
message:
type: string
description: Additional information


operations:
sendUserSignUp:
action: send
title: User sign up
summary: Action to sign a user up.
description: A longer description
channel:
$ref: '#/channels/user'
security:
- type: oauth2
description: The oauth security descriptions
flows:
clientCredentials:
tokenUrl: 'https://example.com/api/oauth/dialog'
availableScopes:
'subscribe:auth_revocations': Scope required for authorization revocation topic
scopes:
- 'subscribe:auth_revocations'
tags:
- name: user
- name: signup
- name: register
bindings:
amqp:
ack: false
messages:
- $ref: '#/channels/user/messages/userSignedUp'
reply:
address:
location: '$message.header#/replyTo'
channel:
$ref: '#/channels/userSignupReply'
messages:
- $ref: '#/channels/userSignupReply/messages/userSignedUpReply'

components:
schemas:
Category:
type: object
properties:
id:
type: integer
format: int64
AvroExample:
schemaFormat: application/vnd.apache.avro+json;version=1.9.0
schema:
type: record
name: UserCreate
namespace: com.example
fields:
- name: id
type: int
- name: name
type: string

servers:
development:
host: '{stage}.in.mycompany.com'
protocol: amqp
description: RabbitMQ broker
bindings:
$ref: '#/components/serverBindings/devAmqp'
variables:
stage:
$ref: '#/components/serverVariables/stage'
security:
- $ref: '#/components/securitySchemes/oauth'

serverVariables:
stage:
default: demo
description: This value is assigned by the service provider in this example of `mycompany.com`

channels:
user:
address: 'users.{userId}'
title: Users channel
description: This channel is used to exchange messages about user events.
messages:
userSignedUp:
$ref: '#/components/messages/userSignUp'
parameters:
userId:
$ref: '#/components/parameters/userId'
servers:
- $ref: '#/components/servers/development'
bindings:
$ref: '#/components/channelBindings/user'
tags:
- $ref: '#/components/tags/user'
externalDocs:
$ref: '#/components/externalDocs/infoDocs'

messages:
userSignUp:
summary: Action to sign a user up.
traits:
- $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: '#/components/schemas/Category'
correlationId:
$ref: '#/components/correlationIds/default'
bindings:
$ref: '#/components/messageBindings/user'
userSignedUp:
summary: User signed up event
contentType: application/json
payload:
type: object
properties:
userId:
type: string
description: The ID of the user
email:
type: string
description: The email of the user
userCompletedOrder:
summary: User completed order event
contentType: application/json
payload:
type: object
properties:
orderId:
type: string
description: The ID of the order
userId:
type: string
description: The ID of the user
amount:
type: number
description: The total amount of the order


parameters:
userId:
description: Id of the user.

correlationIds:
default:
description: Default Correlation ID
location: '$message.header#/correlationId'

operations:
sendUserSignUp:
action: send
title: User sign up
channel:
$ref: '#/channels/user'
bindings:
$ref: '#/components/operationBindings/sendUser'
traits:
- $ref: '#/components/operationTraits/binding'
reply:
$ref: '#/components/replies/signupReply'

replies:
signupReply:
address:
$ref: '#/components/replyAddresses/signupReply'
channel:
$ref: '#/channels/userSignupReply'

replyAddresses:
signupReply:
location: '$message.header#/replyTo'


securitySchemes:
oauth:
type: oauth2
description: The oauth security descriptions
flows:
clientCredentials:
tokenUrl: 'https://example.com/api/oauth/dialog'
availableScopes:
'subscribe:auth_revocations': Scope required for authorization revocation topic
scopes:
- 'subscribe:auth_revocations'

operationTraits:
binding:
bindings:
amqp:
ack: false

messageTraits:
commonHeaders:
headers:
type: object
properties:
my-app-header:
type: integer
minimum: 0
maximum: 100

tags:
user:
name: user
description: User-related messages

externalDocs:
infoDocs:
url: https://example.com/docs
description: 'Find more info here'

serverBindings:
devAmqp:
amqp:
exchange: my-exchange
queue: my-queue

channelBindings:
user:
amqp:
is: queue
queue:
exclusive: true

operationBindings:
sendUser:
amqp:
ack: false

messageBindings:
user:
amqp:
contentEncoding: gzip
messageType: 'user.signup'
bindingVersion: '0.3.0'
Loading
Loading