-
-
Notifications
You must be signed in to change notification settings - Fork 18
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support required and validator attributes in avro files #82
feat: support required and validator attributes in avro files #82
Conversation
08e9a8a
to
e78ebe9
Compare
@@ -121,13 +182,18 @@ async function convertAvroToJsonSchema(avroDefinition, isTopLevel) { | |||
case 'enum': | |||
jsonSchema.enum = avroDefinition.symbols; | |||
break; | |||
case 'float': | |||
case 'double': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this fall-through is intentional, but I think it should be marked/flagged as such - maybe a comment or something as a heads-up to the next person who makes changes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
case 'int': | ||
case 'long': | ||
case 'float': | ||
case 'double': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this fall-through is intentional, but I think it should be marked/flagged as such - maybe a comment or something as a heads-up to the next person who makes changes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
to-json-schema.js
Outdated
setAdditionalAttribute('maximum'); | ||
setAdditionalAttribute('exclusiveMinimum'); | ||
setAdditionalAttribute('exclusiveMaximum'); | ||
setAdditionalAttribute('multipleOf'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subjective style idea - a setAdditionalAttributes
helper function that takes an array of strings would help simplify this bit.
setAdditionalAttributes(['minimum', 'maximum', 'exclusiveMinimum', ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea, done !
cb1fc1d
to
1a849a5
Compare
- supports of required fields: required fields are field without default value or without a union containing the 'null' element - brings supports for additional attributes in avro file. See the README.MD for the list of supported attributes - also add the format precision for the double and float type by setting the format attribute in the json definition Closes asyncapi#17,asyncapi#18
Co-authored-by: Dale Lane <dale.lane@gmail.com>
0de4e09
to
139c8bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super tiny stuff from my side
Co-authored-by: Lukasz Gornicki <lpgornicki@gmail.com>
Kudos, SonarCloud Quality Gate passed!聽 聽 0 Bugs No Coverage information |
@dalelane is it ok for you too? can you approve? you had some comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 馃憤
馃帀 This PR is included in version 0.6.0 馃帀 The release is available on: Your semantic-release bot 馃摝馃殌 |
logicalType
avro attributeClose #18
Description
I introduce a new
asyncapi-avro-1.9.0-additional-attributes.yaml
to illustrate the supported attributes and to easily generate the specification from the CLI to see the result in the html template 馃憤Related issue(s)