-
Notifications
You must be signed in to change notification settings - Fork 207
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
ExampleValues annotation for schema generation along with date examples #5088
ExampleValues annotation for schema generation along with date examples #5088
Conversation
…ration. Adds a new annotation ExampleValues. Updates the schema generation with an InstanceAttributeOverride to add the examples to the schemas. Adds ExampleValues to the date processor. Signed-off-by: David Venable <dlv@amazon.com>
d80a881
to
5440445
Compare
@chenqi0805 , I had to rebase with |
assertThat(propertyNode.get("examples").get(1).get("description").getNodeType(), equalTo(JsonNodeType.STRING)); | ||
assertThat(propertyNode.get("examples").get(1).get("description").textValue(), equalTo("This is the second value.")); | ||
} | ||
|
||
@JsonClassDescription("test config") | ||
static class TestConfig { | ||
@JsonPropertyDescription("The aggregate action description") |
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.
maybe make this description more generic
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.
This is just for testing.
* | ||
* @since 2.11 | ||
*/ | ||
@interface Example { |
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.
Does it have to be an inner interface? As it is inner, at the time of specifying these example values it looks overly verbose
@ExampleValues({
@ExampleValues.Example("some example value"),
@ExampleValues.Example(value = "second example value", description = "This is the second value.")
})
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.
This is actually quite common for annotations that are coupled with their parent. You can add ExampleValues
as a static import.
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 pushed a revision that imports ExampleValues.Example
.
…ProcessorConfig. Signed-off-by: David Venable <dlv@amazon.com>
Description
Introduces
@ExampleValues
annotation for schema and documentation generation.@ExampleValues
.InstanceAttributeOverride
to add the examples to the schemas.@ExampleValues
annotations to the date processor.Issues Resolved
Resolves #5077
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.