Skip to content

Commit 1b00a0d

Browse files
authored
Merge pull request #412 from RepreZen/task/308
[#308] OpenAPI v3: Validation for the value of Link#operationId
2 parents fe90082 + 79591da commit 1b00a0d

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

com.reprezen.swagedit.core/src/com/reprezen/swagedit/core/validation/Messages.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class Messages extends NLS {
4242
public static String error_scope_should_be_empty;
4343
public static String error_scope_should_not_be_empty;
4444
public static String error_invalid_scope_reference;
45+
public static String error_invalid_operation_id;
4546

4647
public static String error_array_missing_items;
4748
public static String error_object_type_missing;

com.reprezen.swagedit.core/src/com/reprezen/swagedit/core/validation/messages.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ error_wrong_type = Invalid type, should be object
3434
error_missing_properties = Invalid type definition, object has a required field but is missing a properties field
3535
warning_simple_reference = Simplified reference syntax is deprecated. The reference should be a valid JSON pointer.
3636
error_array_missing_items= Invalid array definition, items type should be present
37-
error_invalid_reference_type = Invalid object reference, the referenced object is not of expected type.
37+
error_invalid_reference_type = Invalid object reference, the referenced object is not of expected type.
3838
error_invalid_parameter_location = Invalid parameter location value, possible values are \"query\", \"header\", \"path\" or \"cookie\".
3939
content_assist_proposal_local = Press '%s' to show %s in the current file.
4040
content_assist_proposal_project = Press '%s' to show all %s in the project.
@@ -48,7 +48,8 @@ Example: "%s : []"
4848
error_scope_should_not_be_empty = %s is defined as an %s-typed security scheme. \n\
4949
Security requirements for oauth or openIdConnect schemes must specify a list of scope names required for execution.
5050
error_invalid_scope_reference = "%s" does not match any scope name defined in the %s security scheme.
51-
51+
error_invalid_operation_id = Invalid operationId. \n\
52+
This operationId does not match any existing and resolvable operation.
5253

5354
# yaml
5455
error_yaml_parser_indentation = Unable to parse content, an incorrect indentation may be the cause.

com.reprezen.swagedit.openapi3.tests/src/com/reprezen/swagedit/openapi3/validation/ValidatorTest.xtend

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ class ValidatorTest {
273273
document.set(content)
274274
val errors = validator.validate(document, null as URI)
275275
assertEquals(1, errors.size())
276+
assertTrue(errors.map[message].forall[it.equals(Messages.error_invalid_operation_id)])
276277
}
277278

278279
@Test

com.reprezen.swagedit.openapi3/src/com/reprezen/swagedit/openapi3/validation/OpenApi3Validator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ protected void validateOperationIdReferences(Model model, AbstractNode node, Set
168168
}
169169

170170
if (!found) {
171-
errors.add(error(node, IMarker.SEVERITY_ERROR, Messages.error_invalid_reference_type));
171+
errors.add(error(node, IMarker.SEVERITY_ERROR, Messages.error_invalid_operation_id));
172172
}
173173
}
174174
}

0 commit comments

Comments
 (0)