cli
cli copied to clipboard
[FEATURE] Avro Validation
Why do we need this improvement?
Currently, the Avro Schema is not validated with the CLI.
How will this change help?
This change will help to write valid Avro Schemas in AsyncAPI.
Screenshots
No response
How could it be implemented/designed?
- Extract the Avro schemas (can also be helpful as a separate command)
- Parse the Avro schema.
- Show errors and warnings if any come up.
🚧 Breaking changes
No
👀 Have you checked for similar open issues?
- [x] I checked and didn't find a similar issue
🏢 Have you read the Contributing Guidelines?
- [x] I have read the Contributing Guidelines
Are you willing to work on this issue?
None
Minimal example
AsyncAPI with an Avro schema that contains a single field with a wrong type: type: notexisting.
The cli however, does not detect the error:
$ asyncapi validate asyncapi.yaml
File asyncapi.yaml is valid! File asyncapi.yaml and referenced documents don't have governance issues.
# yaml-language-server: $schema=https://asyncapi.com/schema-store/3.0.0-without-$id.json
asyncapi: 3.0.0
info:
title: Coffee Bar Checkout Events
version: 1.0.0
description: AsyncAPI definition for order execution events in a coffee bar microservice.
channels:
orderExecuted:
address: coffee-bar.checkout.order-executed
messages:
orderExecuted:
$ref: '#/components/messages/orderExecuted'
operations:
sendAdCreated:
action: receive
channel:
$ref: '#/channels/orderExecuted'
components:
messages:
orderExecuted:
payload:
schemaFormat: 'application/vnd.apache.avro+yaml;version=1.9.0'
schema:
type: record
namespace: io.examples.checkout
name: OrderExecuted
fields:
- name: orderId
type: notexisting
Hi @Lazzaretti,
I have submitted a pull request according to the contributions.md file.
Let me know if any further changes are needed. Thanks!
Hi @sarthakNITT, thanks a lot for the PR! I started looking at the PR and added some questions.