Skip to content

Commit 310868a

Browse files
authored
fix(avro)!: support named type references (#32)
* feat: add Obfuscan workflow for pull requests Adds a new job named Obfuscan to the CI workflow to scan the pull request diff using the ByteBardOrg/obfuscan-action. This job runs only when a pull request is opened, and it uses the head SHA of the pull request to check for potential issues in the code changes before the main build proceeds. * fix(avro)!: support named type references Adds Avro-specific named type handling for schemas that reference previously defined records, enums, or fixed types by name. Introduces `AvroNamedType`, keeps AsyncAPI `$ref` handling unchanged, supports recursive schemas like `LongList`, and widens map `values` to accept any Avro schema instead of only primitive types. Existing construction with `AvroPrimitiveType` is preserved through the existing implicit conversion to `AsyncApiAvroSchema`, and primitive schema values can be converted back with an explicit cast. BREAKING CHANGE: `AvroMap.Values` now uses `AsyncApiAvroSchema` instead of `AvroPrimitiveType`. * refactor: error and warning collection in document reader Changed how validation errors and warnings are added to the diagnostic collection. Previously, all items from the validation result were iterated over. This change explicitly separates the handling of AsyncApiValidatorError into diagnostic.Errors and AsyncApiValidatorWarning into diagnostic.Warnings, ensuring correct categorization of validation feedback. * docs: add schema wiki page * remove docs file
1 parent 5a27618 commit 310868a

9 files changed

Lines changed: 771 additions & 137 deletions

File tree

src/ByteBard.AsyncAPI.Readers/AsyncApiJsonDocumentReader.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,15 @@ public T ReadFragment<T>(JsonNode input, AsyncApiVersion version, out AsyncApiDi
165165
if (this.settings.RuleSet != null && this.settings.RuleSet.Rules.Count > 0)
166166
{
167167
var errors = element.Validate(this.settings.RuleSet);
168-
foreach (var item in errors)
168+
foreach (var item in errors.OfType<AsyncApiValidatorError>())
169169
{
170170
diagnostic.Errors.Add(item);
171171
}
172+
173+
foreach (var item in errors.OfType<AsyncApiValidatorWarning>())
174+
{
175+
diagnostic.Warnings.Add(item);
176+
}
172177
}
173178

174179
return (T)element;

0 commit comments

Comments
 (0)