Skip to content
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

Fix incorrect warning for service errors property #1120

Merged
merged 2 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ public void projectionsThatCannotCreateModelsFailGracefully() throws URISyntaxEx
assertTrue(result.anyBroken());

// Now validate that we got the failure to serialize the model.
List<ValidationEvent> events = result.getProjectionResults().get(0).getEvents();
List<ValidationEvent> events = result.getProjectionResultsMap().get("foo").getEvents();
assertThat(events, not(empty()));
assertThat(events.get(0).getSeverity(), is(Severity.ERROR));
assertThat(events.get(0).getMessage(), containsString("Unable to serialize trait"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ final class IdlModelParser extends SimpleParser {
private static final String IDENTIFIERS_KEY = "identifiers";
private static final String VERSION_KEY = "version";
private static final String TYPE_KEY = "type";
private static final String ERRORS_KEYS = "errors";
private static final String ERRORS_KEY = "errors";

static final Collection<String> RESOURCE_PROPERTY_NAMES = ListUtils.of(
TYPE_KEY, CREATE_KEY, READ_KEY, UPDATE_KEY, DELETE_KEY, LIST_KEY,
IDENTIFIERS_KEY, RESOURCES_KEY, OPERATIONS_KEY, PUT_KEY, COLLECTION_OPERATIONS_KEY);
static final List<String> SERVICE_PROPERTY_NAMES = ListUtils.of(
TYPE_KEY, VERSION_KEY, OPERATIONS_KEY, RESOURCES_KEY, RENAME_KEY);
TYPE_KEY, VERSION_KEY, OPERATIONS_KEY, RESOURCES_KEY, RENAME_KEY, ERRORS_KEY);
private static final Collection<String> OPERATION_PROPERTY_NAMES = ListUtils.of("input", "output", "errors");
private static final Set<String> SHAPE_TYPES = new HashSet<>();

Expand Down Expand Up @@ -551,7 +551,7 @@ private void parseOperationStatement(ShapeId id, SourceLocation location) {
modelFile.onShape(builder);
optionalId(node, "input", builder::input);
optionalId(node, "output", builder::output);
optionalIdList(node, ERRORS_KEYS, builder::addError);
optionalIdList(node, ERRORS_KEY, builder::addError);
}

private void parseServiceStatement(ShapeId id, SourceLocation location) {
Expand All @@ -563,7 +563,7 @@ private void parseServiceStatement(ShapeId id, SourceLocation location) {
modelFile.onShape(builder);
optionalIdList(shapeNode, OPERATIONS_KEY, builder::addOperation);
optionalIdList(shapeNode, RESOURCES_KEY, builder::addResource);
optionalIdList(shapeNode, ERRORS_KEYS, builder::addError);
optionalIdList(shapeNode, ERRORS_KEY, builder::addError);
AstModelLoader.loadServiceRenameIntoBuilder(builder, shapeNode);
}

Expand Down