You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: adrs/0014-avro-support.md
+10-10
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Accepted
10
10
11
11
## Context
12
12
13
-
Async 2.x supports AVRO Schemas, and we currently don't.
13
+
Async 2.x supports AVRO Schemas, and we currently don't.
14
14
We want to add support of AVRO Schemas:
15
15
- inside Async APIs
16
16
- as a standalone document
@@ -54,33 +54,33 @@ We've also added 3 AVRO-specific fields to the `AnyShape` Model via the `AvroFie
54
54
55
55
### Where we support and DON'T support AVRO Schemas
56
56
We Support AVRO Schemas (inline or inside a `$ref`):
57
-
- as a standalone document or file
58
-
- we encourage users to use the `.avsc` file type to indicate that's an avro file, for better suggestions and so on in the platform)
57
+
- as a standalone document or file
58
+
- we encourage users to use the `.avsc` file type to indicate that's an avro file
59
59
- must use the specific `AvroConfiguration`
60
60
- inside a message payload in an AsyncAPI
61
61
- the key `schemaFormat` MUST be declared and specify it's an AVRO payload
62
-
- we only support avro schema version 1.9.0
62
+
-**we only support avro schema version 1.9.0**
63
63
- the avro specific document `AvroSchemaDocument` can only be parsed with the specific `AvroConfiguration`
64
64
65
65
We don't support AVRO Schemas:
66
66
- inside components --> schemas in an AsyncAPI
67
67
- because we can't determine if it's an AVRO Schema or any other schema
68
68
69
69
### AVRO Validation
70
-
We'll use the Apache official libraries for JVM and JS.
70
+
We'll use the Apache official libraries for JVM and JS, in the version 1.11.3, due Java8 binary compatibility requirements.
71
71
72
72
## Consequences / Constraints
73
73
74
-
The validation plugins differ in interfaces and implementations, and each has some constraints:
74
+
The validation libraries differ in interfaces and implementations, and each has some constraints:
75
75
76
-
### JVM avro validation plugin
76
+
### JVM avro validation library
77
77
- validation per se is not supported, we try to parse an avro schema and throw parsing results if there are any
78
78
- this means it's difficult to have location of where the error is thrown, we may give an approximate location from our end post-validation
79
79
- when a validation is thrown, the rest of the file is not being searched for more validations
80
80
- this is particularly important in large avro schemas, where many errors can be found but only one is shown
81
81
82
-
### Both JVM & JS validation plugins
82
+
### Both JVM & JS validation libraries
83
83
-`"default"` values are not being validated when the type is `bytes`, `map`, or `array`
84
84
- the validator treats as invalid an empty array as the default value for arrays (`"default": []`) even though the [Avro Schema Specification](https://avro.apache.org/docs/1.12.0/specification) has some examples with it
85
-
-if an avro record has a field that is a union that includes the root record itself (recursive reference) we fail to validate it correctly because we treat that shape as an unresolved/undefined shape
86
-
-in the future we'll try to ignore the cases that we are now failing and/or show a warning instead
85
+
-avro schemas of type union are not valid at the root level of the schema, but they are accepted as field types in a record or items in an array. For this reason, it is not possible to generate a `PayloadValidator` for an avro union shape.
86
+
- the avro libraries are very restrictives with the allowed characters in naming definition (names of records for example). They only allow letters, numbers and`_` chars. We are not modifying this behavior.
Copy file name to clipboardexpand all lines: amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/avro/parser/domain/AvroArrayShapeParser.scala
+3-1
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,9 @@ case class AvroArrayShapeParser(map: YMap)(implicit ctx: AvroSchemaContext)
Copy file name to clipboardexpand all lines: amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/avro/parser/domain/AvroInlineTypeParser.scala
Copy file name to clipboardexpand all lines: amf-api-contract/shared/src/main/scala/amf/apicontract/internal/spec/avro/parser/domain/AvroUnionShapeParser.scala
0 commit comments