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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stream schema #8201
Merged
Merged
Stream schema #8201
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
31cfce7
Add schema validation for stream event
fredericbarthelet 3cb071a
Remove shape checking tests
fredericbarthelet 6536a44
Implement distinction for type required in onFailure
fredericbarthelet 7766524
Implement distinction for type required in event
fredericbarthelet 3b17faf
Implement arn and type definition only in oneOf descriptions
fredericbarthelet File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Going that route is problematic for error reporting.
As e.g. if one makes error in
batchSize
, we will get error for both alternatives, and error normalizer, not being able to decide which alternative was chosen to be followed by user, will expose the error as genericfunctions[].events[].sns: unsupported configuration format
which doesn't give a hint of what the real error is.I think this can be cleanly solved solved by using
additionalProperties
as a container to define two options forarn
antype
, and keep others defined as it was in previous versionIt also doesn't feel good, that we repeat definitions for most of properties, seems error-prone.
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.
Hi @medikoo , not sur what you mean by using
additionalProperties
. Could you provide an exemple ?In the meantime, I found a solution detailed in json-schema/json-schema#158 showing how to implement validation based on property value (the correct way of JSON schema is schema dependency based on property existence with
dependencies
keyword).The resulting error message when specifying a CF intrinsic function without
type
isConfiguration error at 'functions.toto.events[0].stream.destinations.onFailure.arn': should be string
which seems correct. WDYT ?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.
Sorry, that was an invalid suggestion, via
additionalProperties
you can enforce schema for other properties, but obviously not one by one, but for all generally.Looks great to me!