asyncapi-validator
asyncapi-validator copied to clipboard
Does not support avro in AsynApi
Validation fails with the following error when the AsyncApi has an avro schema:
/Users/ikanel/code/SwaggerHub/node_modules/asyncapi-validator/src/Parser.js:27 throw new ValidationError(this._formatError(err), undefined, err.validationErrors) ^
AsyncAPIValidationError: PARSERS[String(...)] is not a function Error Details: at Parser.parse (/Users/ikanel/code/SwaggerHub/node_modules/asyncapi-validator/src/Parser.js:27:13) at async ValidatorFactory.fromSource (/Users/ikanel/code/SwaggerHub/node_modules/asyncapi-validator/src/ValidatorFactory.js:13:29) at async file:///Users/ikanel/code/SwaggerHub/Contracts/AsyncApi/Validator/validate.js:6:10 { key: undefined, errors: undefined }
Node.js v19.2.0
The fragment of the asynApi schema which causes this exception:
channels: avroExample: publish: message: #see https://github.com/asyncapi/avro-schema-parser name: avro-message schemaFormat: 'application/vnd.apache.avro;version=1.9.0' payload: # The following is an Avro schema in YAML format (JSON format is also supported) type: record name: User namespace: com.company doc: User information fields: - name: displayName type: string - name: email type: string - name: age type: int
Yes, it doesn't support Avro schema. There is a package to add the support. If you want, you may create PR.
Or I'll look into it later. 🤞